A is for Algorithm

A is for Algorithm

What is an Algorithm? Why do we need them? How do we use them in daily life? Can you give me an example of one?

In my quest to learn all-things-algorithm, I strolled down Warren Street, notebook in hand, to interview Tammy Nguyen, the owner and general manager of The Coder School, Tribeca.

The Coder School Tribeca Tammy

I had minimal coding experience (though did do about 4 hours of an online course on Solidity coding, the backbone of ‘smart contracts’ in Web 3, more on that later). No, the majority of my coding experience was in BASIC “back in the day”. My pride and joy was a stream of commands that would infuriate my brother–I think you’ll see why:

10 PRINT ‘Jenn’

20 GOTO 10

30 END

Yes, yes, I know.

The Tree of Coding Languages at The Coder School

 

The Coder School Tribeca is tucked in 28 Warren and is a great space, bright and welcoming with a big poster of a tree on the wall that lists all sorts of programming languages that are out there. It’s part of a franchise based in California, founded by Hansel Lynn (who quite awesomely had previously run his own rock music school for kids as a franchisee himself, as well as other things).

The most asked-for programming language by kids, Tammy says, is of course Unity, which allows for 3D creation in gaming. More specifically, in ROBLOX. But she notes, you have to walk before you run, so most kids start with SCRATCH, a block-coding language developed by MIT. The school has a banana lounge. Can't argue with that! 

The Coder School Tribeca

 

Once they graduate from SCRATCH and get the basic logical thinking skills, most of the kids at The Coder School are learning Python these days. “It’s the trend,” she confirms. So let’s get down to it, the question we’ve all been waiting for: what is an algorithm, really?

Tammy says an algorithm is nothing more than “step-by-step instructions” to get something done. “Like a bedtime routine,” she adds. “Ask yourself what are the steps. Then ask yourself what happens if you miss a step?” 

That’s not so hard: So an algorithm is just a series of if/then statements. The algorithm creates predictability, so every time you ask the computer to do something, it will execute exactly the same steps in exactly the same way. I think of my own children’s bedtime routine. If only we were so consistent!

Once you know one programming language, Tammy says it’s pretty easy to move to another. However, they’ll always be that one that you like the best–that feels easiest. Think Spanish-Portuguese-Italian-French. Mandarin-Cantonese-Vietnamese. Know one and you can get by enough in another. 

So why do I care about algorithms? Tammy reminds us that algorithms are behind everything that we see online, and IRL. They're not just for pocket-protector types. The whole fashion industry runs with designing programs chock-full of algorithms that are the tools that create designs and then prototypes. She notes that her daughters did a program Kode With Klossy, where they were shown how computer literacy was so instrumental in their favorite brands. Once kids' (or anyone’s) eyes are opened to how many cool applications there are for this skill—basically algorithm writing—they’ll be hooked. Beyond that, grit, the ability to fail and get back up, big-picture thinking, precision thinking, logic—so many skills are taught through algorithms.

The Coder School Tribeca

 

Want to practice making your first algorithm? Don’t be shy. The teachers at The Coder School were nice enough to lead the way! 

First of all algorithm basics:

  • They should be written with clear steps
  • There should be zero or more inputs
  • There should be one or more output
  • The algorithm is finite (unlike mine above!)
  • It's got to be feasible 
  • It should be written first before you get to what programming language you'll put it in

There are several things an algorithm is used to do:

  • Search
  • Sort
  • Insert
  • Update
  • Delete

In order to write my first algorithm, I must first have a problem or purpose. I'll have to describe this problem very very clearly. This is much harder than it seems!

       Perhaps I want to turn a pink rectangle into a yellow star, to piggyback off The ABCs of Crypto illustration above.

       But the rules say a rectangle can only turn into a triangle; a triangle can only turn into a circle and a circle can turn into a star. Furthermore, when you change shapes you cannot change color. Shapes can be several possible colors: blue, pink and yellow.

Then I'll have to analyze the problem and answer what information do I have, where is it, are there formulas that can be used and rules that limit my actions? What would a solution look like? How will I know I solved it?

Well first, it's pretty finite, I know when the pink rectangle is a yellow star I'm done. 

Replace rectangle with star

Step 1: Get the rectangle

Step 2: Replace rectangle with triangle

Step 3: Replace triangle with circle

Step 4: Replace circle with star

Step 5: Turn star yellow

Now that you know the steps, you can develop your algorithm. A programmer would do this step by step, little by little, checking and re-checking her work as she goes. 

This is only to get you thinking like someone who might write an algorithm. There are lots of resources to get you actually doing it with real problems and purposes. 

Where to start? Obviously first we'd say start with The Coder School. Some other resources that Nguyen likes: 

  • Code.org / A non-profit dedicated to the vision that all kids learn computer science as part of their K-12 education
  • Hour of Code / One-hour tutorials in over 45 languages that require no experience to start and are free
  • Girls Who Code / An organization on a mission to close the gender gap in tech (yeah!) offering clubs, college and career programs, summer coding programs and code-at-home opportunities

If you're an adult and this is piquing your curiosity, there are classes on Coursera that you can enroll in like Python for Everybody taught by University of Michigan (Go Blue!). I'll see you there!

Shop our A is for Algorithm framed print to commemorate your first step on your crypto journey!

Next up will be B is for Blockchain. This is a jump in complexity, I’m afraid, but we’ll try to break it down and make it visual. Keep in touch by subscribing at the bottom of the home page to be the first to know when the next letter drops!

Back to blog