# What Are Algorithms? A Guide to Algorithms for Children

POSTED ON SEPTEMBER 09, 2023

# What Are Algorithms? A Guide to Algorithms for Children

We live in a world where technology is constantly changing at an impressive pace. In fact, many older parents already find it difficult to keep up with some of the new gadgets and latest upgrades to familiar software, but it isn’t like that for kids. Today’s children have more exposure to technology compared to previous decades. With things like AI, natural language processing (NLP), or virtual reality, many expect even more changes in the coming years. So what can you do?

Turns out you can help your kids right now to learn vital skills that will equip them for the future. Children of all ages can learn complex concepts in an interactive game-like online environment that covers everything from basic topics like “what are algorithms” to more advanced skills. Good algorithm training can help kids develop their critical thinking and problem-solving abilities. Besides, they get to build vital skills for future-relevant careers. In this article, we have covered some of the essential details to help you understand how the algorithm works.

## What Is an Algorithm?

An algorithm definition is as simple as a set of step-by-step procedures or a list of rules to follow for completing a specific task or solving a particular problem. Even though the word ‘algorithm’ was first coined in the 9th century, they are all around us until today. Common algorithm examples include the recipe for baking a cake, the method we use to solve a long division problem, the process of doing laundry, and the workflow of Google’s search algorithm. Here’s what baking a cake might look like, written out as a list of instructions, just like an algorithm:

1. Gather all the ingredients

2. Preheat the oven

3. Measure out the ingredients

4. Mix together the ingredients to make the batter

5. Grease a pan and pour the batter into the pan

6. Put the pan in the oven

7. Set a timer

8. When the timer goes off, take the pan out of the oven

9. Enjoy!

This is a simple example of a data structure, meaning the organized sequence of procedures, numbers, etc. In computer science, an algorithm works similarly – it is all about writing a set of rules with a finite number of steps that tell the computer how to perform a task. A computer program is essentially an algorithm that indicates what specific actions a machine should execute to carry out any task. Algorithms are written using a particular syntax, depending on the programming language.

## Types of Algorithms

Apart from the algorithm's meaning, you should also distinguish their varieties. They are classified based on the concepts used to accomplish a task. While there are many types of algorithms, the most basic programming algorithm examples are:

• Divide and conquer algorithms. This one divides a problem into smaller ones of the same kind. Next, it solves those minor issues and comes up with a solution to the original problem. Neat, huh?

• Brute force algorithms. If you have seen anyone trying to open a locked door when they have lost their keys, then you have a pretty good idea of how this works. This programming algorithm example will basically try all possible solutions until a satisfactory one is found. It's kind of like you hit your lock with a hammer until it breaks open.

• Randomized algorithms. Everyone has tried to guess an answer to something before. Turns out you can do the same using an algorithm. You can try using a random number at least once during the calculations to find a solution to the problem.

• Greedy algorithms. This one is easy to guess. It tries to find the best solution at the local level to locate the best possible answer for the entire issue right away.

• Recursive algorithms. Remember that time you answered the simplest test questions before doing the tough ones. It’s the same thing here. Recursive algorithms solve the lowest and easiest version of a problem before moving to the increasingly larger versions of the issue. They do this until the solution to the original problem is found.

• Backtracking algorithms. This one is a bit like the first one but with a twist. This works by dividing the problem into subproblems and then trying to solve each of the little issues. But if it doesn’t find the right solution, it will move backward into the first problem until it finds the right path.

• Dynamic programming algorithms. This is another simple example of an algorithm. First, break a complex problem into a collection of simpler and smaller ones. Then, solve each of those minor issues only once, storing their solution for later instead of re-computing their solutions again and again.

• Sorting Algorithms. This sorts the elements of a list in a particular order, usually in numerical or lexicographical (i.e., alphabetical) order. This is an essential first step that makes it possible for the algorithms to solve more complex problems. There are different sorting systems, such as:

• Linear sort: Find the smallest element in the list to be sorted, add it to a new list, and remove it from the original list. Repeat this until you go through the whole original data set.

• Bubble sort: Compare the first two elements in the list, and if the first is greater than the second, swap them. Do this with every pair of adjacent elements in the set. Then, repeat this process until the list is fully sorted.

• Insertion sort: Compare each element in the list to all the prior ones until you find the smallest value. Then, locate the right spot for each component based on the order you try to achieve. Repeat this process until you fully sort the initial list.

Have questions about Juni Learning?
Our advisors can answer any questions you have about our curriculum or subscriptions. They can even provide a course recommendation.

## Example of an Algorithm – Solving a Rubik’s Cube

There are a number of different algorithms, from simple to very complicated, that exist for solving a Rubik’s cube. Below is just one simple algorithm example that significantly reduces the amount of time spent on solving this famous puzzle. First, let’s specify some important details (similarly to picking a programming language).

Each of the six faces of a Rubik’s cube can be represented by the first letter of their name:

• U - up

• D - down

• L - left

• R - right

• F - front

• B - back

Each face can be turned in three different ways/directions. Using U as an example, these are represented as:

• U - clockwise quarter-turn of the upper face

• U' - counter-clockwise quarter-turn of the upper face

• U2 - half turn in either direction of the upper face

Now, let’s go through the steps in our example of an algorithm to solve a Rubik’s Cube. Feel free to grab one of your own and follow along!

#### Step #1: The Cross

First, you should flip some edges to get a white cross on the upper face. To do that, apply the following turns: F → R’ → D’ → R → F2 → R’ → U → R → U’ → R’ → R2 → L2 → U2 → R2 → L2.

The cross is now solved!

#### Step #2: The White Corners

The edges on the white face are now complete, but the corners remain. Depending on where the white-orange-green corner is in the puzzle, apply one of the following series of turns:

• Bottom: R’ → D’ → R → D (repeat until the corner moves to its correct place)

• Top: R’ → D’ → R → D (this moves the corner to the bottom; then, follow the above instructions)

#### Step #3: Middle Layer Edges

Now that you have your corners in place, follow these steps:

1. Flip the cube so that the white is on the bottom.

2. Look for an edge that is on the top face and doesn’t have yellow on it.

3. Perform a U-turn so that the color on the front face of the edge matches with the center.

4. Depending on the direction that the edge could go, apply one of the following series of turns:

• Left: U’ → L’ → U → L → U → F → U’ → F’

• Right: U → R → U’ → R’ → U’ → F’ → U → F

#### Step #4: Yellow Cross

As our next step, let’s solve the yellow cross. To do that, follow these instructions:

1. Apply the following turns until you see a yellow cross with the yellow center: F → R → U → R’ → U’ → F’.

2. If there is an “L” shape, where the two yellow pieces showing are adjacent to each other, apply the following turns: F → U → R → U’ → R’ → F’.

3. If there is a horizontal “line” shape, apply the following turns: F → R → U → R’ → U’ → F’.

#### Step #5: Sune and Antisune

When you have your yellow cross ready, face it and apply one of the following series of turns:

• If there is only one oriented corner, follow these turns: R → U → R’ → U → R → U2 → R’ (repeat until the desired position is attained).

• In case there is one oriented corner and one right-facing corner, here is a solution: U2 → R → U2 → R’ → U’ → R → U’ → R’.

#### Step #6: Finishing the puzzle

You are just one step away from completing our algorithm example – solving your Rubik’s Cube. To finish up, follow this guidance:

1. Look for sets of “headlights” (two stickers of the same color in the same row, separated by a sticker of a different color).

2. Depending on how many there are, apply one of the following series of turns:

• If there is a set of headlights on each side, follow this combination: R → U’ → R → U → R → U → R → U’ → R’ → U’ → R2.

• Otherwise, these are the turns you need: R’ → F → R’ → B2 → R → F’ → R’ → B2 → R2.

Learn with instructors who inspire.
Juni's vetted instructors are from top US Universities and provide our students the support and mentorship they need to succeed.

## How Are Algorithms Used in Computer Science?

Algorithms are used in every part of computer science, and there are countless programming algorithm examples as they form this field's backbone. Consider these a few of the use cases:

• An algorithm gives the machine a specific set of instructions, defining every process the system does, whether running a calculator or a rocket.

• Computer programs are, at their core, algorithms written in programming languages that the machine can understand.

• Computer algorithms play a big role in how social media works: which posts show up, which ads are shown, and so on. These decisions are all made by algorithms. Google’s programmers use algorithms to optimize searches, predict what users are going to type, and more.

• In problem-solving, a big part of computer programming is learning about the formation and analysis of algorithms.

## Conclusion

Algorithmic thinking, or the ability to define clear steps to solve a problem, is crucial in many different fields, including machine learning (ML) and artificial intelligence (AI). Even if we’re not conscious of it, we use algorithms all the time. Knowing the answer to “What are algorithms?” and understanding algorithmic thinking allows students like you to break down problems and picture distinct steps and solutions. Being able to understand and implement an algorithm requires practicing logic and reasoning abilities. To further dive into the subject, read how programming algorithms help develop logical thinking skills.