Programming languages and algorithms are the building blocks of all... Show more
Understanding Algorithms











Low Level vs. High Level Programming Languages
Ever wonder why there are so many programming languages? It's all about finding the right balance between human readability and machine efficiency.
Low-level languages like machine code (0's and 1's) and assembly language work directly with computer hardware. While they offer greater control and typically run faster, they're much harder to read and take longer to develop. Check out that Assembly code example—it takes 19 lines just to print "Hello World"!
High-level languages are designed to be human-readable and much quicker to program. They abstract away hardware details so you don't need to worry about memory addresses or processor instructions. The Python example accomplishes the same "Hello World" task in just two lines of code!
Did you know? System languages are somewhere in between—they're closer to the hardware but still more readable than pure assembly language. They're used in operating systems and applications where performance is critical.

Compiled vs. Interpreted Programming Languages
How your code turns into something a computer can actually run depends on whether it's compiled or interpreted.
Interpreted languages convert code to machine language at run-time, meaning they translate your instructions on the fly. While this makes development flexible, you need to have an interpreter installed on any computer running your program, and performance is generally slower.
Compiled languages convert code to machine language in advance. This creates a standalone executable file that can run without additional software. Your original code is hidden within the executable, and these programs typically run faster because the translation work is already done.
The development workflow differs too. With interpreted languages, you follow an edit-run cycle (write code, then immediately run it). Compiled languages require an edit-compile-link-run cycle (write code, compile to object code, link components, then run).
Think about it: Most mobile apps are compiled programs, while many web scripts are interpreted. Can you think of examples of each that you use regularly?

Programming Languages Fundamentals
There are thousands of programming languages, each with its own syntax and rules. Despite their differences, most share some fundamental elements.
Nearly all programming languages include data types for storing different kinds of information . They also have conditional statements that help your program make decisions based on certain conditions.
Programming languages typically provide loops that let you repeat instructions multiple times without writing the same code over and over. Another key feature is functions, which help you organize code into reusable blocks that perform specific tasks.
Quick tip: Learning one programming language makes it easier to learn others because these core concepts transfer between languages. The syntax may change, but the fundamental logic remains similar!

Giving Precise Instructions
Ever tried explaining how to make a peanut butter and jelly sandwich? It's harder than you think to be precise!
The drawing activity shows why computers need exact instructions. When one student describes a drawing using only simple shapes, qualifiers, and relationships (no gestures allowed!), the results from other students often vary wildly. That's because humans fill in gaps with assumptions, but computers can't.
This activity demonstrates why programming requires such precise language. When you write code, the computer follows your instructions exactly as written—not as you intended them. Any ambiguity or missing step leads to unexpected results.
Real-world connection: This is why debugging is such an important programming skill. Most errors happen not because computers make mistakes, but because our instructions weren't as clear as we thought they were!

What is an Algorithm?
An algorithm is a set of specific steps to accomplish a task without any ambiguity. Think of it as a recipe that must be followed exactly to get the right result.
For an algorithm to work properly, it must be clear (easy to understand), precise (exact in its instructions), and ordered (steps in the correct sequence). The beauty of algorithms is that they don't require intelligence to execute—just the ability to follow directions exactly.
You encounter algorithms daily: cooking recipes, furniture assembly instructions, or even the method for multiplying large numbers. Most algorithms take some input (information to work with) and produce an output (the result or answer).
Try this: Think about brushing your teeth—can you write down the algorithm for this simple task? You'll be surprised by how many steps are involved when you break it down completely!

Blockly Tutorial: Maze
Blockly gives us a visual way to learn programming concepts without worrying about syntax. The Maze game teaches fundamental programming structures through fun puzzles.
The repeat until block introduces loops that execute the same code multiple times until a condition is met. This saves you from writing the same instructions over and over. The if block allows your program to make decisions based on conditions, like checking if there's a path ahead before moving.
For some puzzles (6-8), the order of tasks inside a loop doesn't matter. However, in puzzle 9, the sequence becomes critical—just like in real programming where the order of operations often determines whether your program works correctly.
Programming insight: Notice how these blocks snap together like puzzle pieces? This visual approach helps beginners understand code structure before learning text-based programming languages.

Blockly Tutorial: Bird
In the Bird game, we learn more advanced programming concepts through controlling a bird's flight path.
The if-else block introduces more complex decision making. For example, in levels 2-3, you can set different directions before and after picking up the worm. This is similar to how programs might behave differently based on user input or changing conditions.
Level 4 introduces variables like x and y coordinates that store the bird's position. By testing these values, you can make the bird respond to its location in the game world. As you progress to levels 6-8, you'll build more complicated behaviors by testing different conditions in sequence.
Connect the dots: Variables in programming are like labeled containers that hold information. Just as the x and y variables track the bird's position, real programs use variables to track things like user scores, inventory items, or character health.

Blockly Tutorial: Turtle
The Turtle game introduces a different kind of loop that runs for a fixed number of times rather than until a condition is met.
Unlike the Maze game's "repeat until" block, Turtle uses loops that execute a specific number of iterations. This is perfect for drawing patterns where you know exactly how many steps are needed. For example, drawing a square requires exactly four repetitions of "move forward, turn right 90°".
Level 5 shows how loops can be nested within other loops, creating more complex patterns. This powerful concept lets you create intricate designs with surprisingly little code—for instance, using a loop inside another loop to draw five-pointed stars in different locations.
Creative challenge: Try modifying the code to create your own geometric patterns. What happens if you change the number of repetitions or the angle of turns?

Blockly Tutorial: Movie
The Movie tutorial introduces the concept of animation through variables that change over time.
A new variable called time (t) goes from 0 to 100 as the program runs. By setting the position of objects based on this time variable, you can create movement. In Level 2, setting y = t makes the right arm move up as time passes.
Level 3 shows how to create more complex movements using functions of t. For example, setting y = 100 - t for the left arm creates the opposite movement . Level 5 introduces even more complex functions like y = ²/5.
Math connection: Animation in games and movies uses these same principles! Movement is created by mathematically changing positions based on time variables. This is how characters walk, objects bounce, and explosions expand.

Algorithm Design: Finding the Heaviest Object
How would you find the heaviest object among several items using only a balance scale? This activity challenges you to develop an algorithm that works consistently.
The balance scale has limitations—it only compares two objects at a time and doesn't tell you actual weights. These constraints mirror real-world programming problems where resources or information are limited.
A simple approach is to compare objects in pairs, keeping track of the heavier one each time. For example, compare objects 1 and 2, keep the heavier one, then compare it with object 3, and so on. This algorithm works regardless of how many objects you have—a key characteristic of a good algorithm.
Think algorithmically: Good algorithms should be reproducible (give the same results each time) and scalable (work the same way regardless of input size). How many comparisons would your algorithm need for 5 objects? What about 100?
We thought you’d never ask...
What is the Knowunity AI companion?
Our AI companion is specifically built for the needs of students. Based on the millions of content pieces we have on the platform we can provide truly meaningful and relevant answers to students. But its not only about answers, the companion is even more about guiding students through their daily learning challenges, with personalised study plans, quizzes or content pieces in the chat and 100% personalisation based on the students skills and developments.
Where can I download the Knowunity app?
You can download the app in the Google Play Store and in the Apple App Store.
Is Knowunity really free of charge?
That's right! Enjoy free access to study content, connect with fellow students, and get instant help – all at your fingertips.
Most popular content in Computer Science / Programming
3AP Computer Science Principles Full Review
a full review to prepare for the AP CSP exam
HTML tags, codes, definition
HTML tags, codes, and definition with examples
Intro to Python Pt 1
This is a summary of the basics of python such as variables, print, and if statements.
Most popular content
9Origins and Dynamics of the Columbian Exchange
Analyze the ecological and economic motivations behind the initial transfer of goods, people, and diseases between the Old and New Worlds.
Introduction to Early Cultural Interactions
Analyze the initial social and religious encounters between Europeans, Africans, and Indigenous peoples in the colonial Americas.
Origins of Ancient River Civilizations
Analyze the environmental factors and technological innovations that led to the rise of early states in Mesopotamia, Egypt, and the Indus Valley.
Motivations for European Exploration
Analyze the economic, religious, and political factors that drove European powers to the Americas during the 15th and 16th centuries.
Foundations of Ethical Guidelines in Research
Practice the core principles of the APA ethical code including informed consent, debriefing, and the role of Institutional Review Boards.
Introduction to Native American Societies
Examine the diverse social, political, and economic structures of North American indigenous groups prior to European contact.
Introduction to Biological Elements of Life
Practice identifying the essential elements including carbon, nitrogen, phosphorus, and sulfur that compose biological macromolecules.
Introduction to the Spanish Encomienda System
Explore the fundamental economic and social structures of the Spanish colonial system, focusing on the encomienda and the casta social hierarchy.
Origins and Continuity of the Byzantine Empire
Analyze the political and cultural transitions from the Roman Empire to the Byzantine Empire, focusing on the reign of Justinian I and his code.
Can't find what you're looking for? Explore other subjects.
Students love us — and so will you.
The app is very easy to use and well designed. I have found everything I was looking for so far and have been able to learn a lot from the presentations! I will definitely use the app for a class assignment! And of course it also helps a lot as an inspiration.
This app is really great. There are so many study notes and help [...]. My problem subject is French, for example, and the app has so many options for help. Thanks to this app, I have improved my French. I would recommend it to anyone.
Wow, I am really amazed. I just tried the app because I've seen it advertised many times and was absolutely stunned. This app is THE HELP you want for school and above all, it offers so many things, such as workouts and fact sheets, which have been VERY helpful to me personally.
Understanding Algorithms
Programming languages and algorithms are the building blocks of all computer software. They allow us to communicate with computers through specific instructions and solve problems efficiently. Understanding how these languages work and how to design effective algorithms is essential for... Show more

Sign up to see the content. It's free!
- Access to all documents
- Improve your grades
- Join milions of students
Low Level vs. High Level Programming Languages
Ever wonder why there are so many programming languages? It's all about finding the right balance between human readability and machine efficiency.
Low-level languages like machine code (0's and 1's) and assembly language work directly with computer hardware. While they offer greater control and typically run faster, they're much harder to read and take longer to develop. Check out that Assembly code example—it takes 19 lines just to print "Hello World"!
High-level languages are designed to be human-readable and much quicker to program. They abstract away hardware details so you don't need to worry about memory addresses or processor instructions. The Python example accomplishes the same "Hello World" task in just two lines of code!
Did you know? System languages are somewhere in between—they're closer to the hardware but still more readable than pure assembly language. They're used in operating systems and applications where performance is critical.

Sign up to see the content. It's free!
- Access to all documents
- Improve your grades
- Join milions of students
Compiled vs. Interpreted Programming Languages
How your code turns into something a computer can actually run depends on whether it's compiled or interpreted.
Interpreted languages convert code to machine language at run-time, meaning they translate your instructions on the fly. While this makes development flexible, you need to have an interpreter installed on any computer running your program, and performance is generally slower.
Compiled languages convert code to machine language in advance. This creates a standalone executable file that can run without additional software. Your original code is hidden within the executable, and these programs typically run faster because the translation work is already done.
The development workflow differs too. With interpreted languages, you follow an edit-run cycle (write code, then immediately run it). Compiled languages require an edit-compile-link-run cycle (write code, compile to object code, link components, then run).
Think about it: Most mobile apps are compiled programs, while many web scripts are interpreted. Can you think of examples of each that you use regularly?

Sign up to see the content. It's free!
- Access to all documents
- Improve your grades
- Join milions of students
Programming Languages Fundamentals
There are thousands of programming languages, each with its own syntax and rules. Despite their differences, most share some fundamental elements.
Nearly all programming languages include data types for storing different kinds of information . They also have conditional statements that help your program make decisions based on certain conditions.
Programming languages typically provide loops that let you repeat instructions multiple times without writing the same code over and over. Another key feature is functions, which help you organize code into reusable blocks that perform specific tasks.
Quick tip: Learning one programming language makes it easier to learn others because these core concepts transfer between languages. The syntax may change, but the fundamental logic remains similar!

Sign up to see the content. It's free!
- Access to all documents
- Improve your grades
- Join milions of students
Giving Precise Instructions
Ever tried explaining how to make a peanut butter and jelly sandwich? It's harder than you think to be precise!
The drawing activity shows why computers need exact instructions. When one student describes a drawing using only simple shapes, qualifiers, and relationships (no gestures allowed!), the results from other students often vary wildly. That's because humans fill in gaps with assumptions, but computers can't.
This activity demonstrates why programming requires such precise language. When you write code, the computer follows your instructions exactly as written—not as you intended them. Any ambiguity or missing step leads to unexpected results.
Real-world connection: This is why debugging is such an important programming skill. Most errors happen not because computers make mistakes, but because our instructions weren't as clear as we thought they were!

Sign up to see the content. It's free!
- Access to all documents
- Improve your grades
- Join milions of students
What is an Algorithm?
An algorithm is a set of specific steps to accomplish a task without any ambiguity. Think of it as a recipe that must be followed exactly to get the right result.
For an algorithm to work properly, it must be clear (easy to understand), precise (exact in its instructions), and ordered (steps in the correct sequence). The beauty of algorithms is that they don't require intelligence to execute—just the ability to follow directions exactly.
You encounter algorithms daily: cooking recipes, furniture assembly instructions, or even the method for multiplying large numbers. Most algorithms take some input (information to work with) and produce an output (the result or answer).
Try this: Think about brushing your teeth—can you write down the algorithm for this simple task? You'll be surprised by how many steps are involved when you break it down completely!

Sign up to see the content. It's free!
- Access to all documents
- Improve your grades
- Join milions of students
Blockly Tutorial: Maze
Blockly gives us a visual way to learn programming concepts without worrying about syntax. The Maze game teaches fundamental programming structures through fun puzzles.
The repeat until block introduces loops that execute the same code multiple times until a condition is met. This saves you from writing the same instructions over and over. The if block allows your program to make decisions based on conditions, like checking if there's a path ahead before moving.
For some puzzles (6-8), the order of tasks inside a loop doesn't matter. However, in puzzle 9, the sequence becomes critical—just like in real programming where the order of operations often determines whether your program works correctly.
Programming insight: Notice how these blocks snap together like puzzle pieces? This visual approach helps beginners understand code structure before learning text-based programming languages.

Sign up to see the content. It's free!
- Access to all documents
- Improve your grades
- Join milions of students
Blockly Tutorial: Bird
In the Bird game, we learn more advanced programming concepts through controlling a bird's flight path.
The if-else block introduces more complex decision making. For example, in levels 2-3, you can set different directions before and after picking up the worm. This is similar to how programs might behave differently based on user input or changing conditions.
Level 4 introduces variables like x and y coordinates that store the bird's position. By testing these values, you can make the bird respond to its location in the game world. As you progress to levels 6-8, you'll build more complicated behaviors by testing different conditions in sequence.
Connect the dots: Variables in programming are like labeled containers that hold information. Just as the x and y variables track the bird's position, real programs use variables to track things like user scores, inventory items, or character health.

Sign up to see the content. It's free!
- Access to all documents
- Improve your grades
- Join milions of students
Blockly Tutorial: Turtle
The Turtle game introduces a different kind of loop that runs for a fixed number of times rather than until a condition is met.
Unlike the Maze game's "repeat until" block, Turtle uses loops that execute a specific number of iterations. This is perfect for drawing patterns where you know exactly how many steps are needed. For example, drawing a square requires exactly four repetitions of "move forward, turn right 90°".
Level 5 shows how loops can be nested within other loops, creating more complex patterns. This powerful concept lets you create intricate designs with surprisingly little code—for instance, using a loop inside another loop to draw five-pointed stars in different locations.
Creative challenge: Try modifying the code to create your own geometric patterns. What happens if you change the number of repetitions or the angle of turns?

Sign up to see the content. It's free!
- Access to all documents
- Improve your grades
- Join milions of students
Blockly Tutorial: Movie
The Movie tutorial introduces the concept of animation through variables that change over time.
A new variable called time (t) goes from 0 to 100 as the program runs. By setting the position of objects based on this time variable, you can create movement. In Level 2, setting y = t makes the right arm move up as time passes.
Level 3 shows how to create more complex movements using functions of t. For example, setting y = 100 - t for the left arm creates the opposite movement . Level 5 introduces even more complex functions like y = ²/5.
Math connection: Animation in games and movies uses these same principles! Movement is created by mathematically changing positions based on time variables. This is how characters walk, objects bounce, and explosions expand.

Sign up to see the content. It's free!
- Access to all documents
- Improve your grades
- Join milions of students
Algorithm Design: Finding the Heaviest Object
How would you find the heaviest object among several items using only a balance scale? This activity challenges you to develop an algorithm that works consistently.
The balance scale has limitations—it only compares two objects at a time and doesn't tell you actual weights. These constraints mirror real-world programming problems where resources or information are limited.
A simple approach is to compare objects in pairs, keeping track of the heavier one each time. For example, compare objects 1 and 2, keep the heavier one, then compare it with object 3, and so on. This algorithm works regardless of how many objects you have—a key characteristic of a good algorithm.
Think algorithmically: Good algorithms should be reproducible (give the same results each time) and scalable (work the same way regardless of input size). How many comparisons would your algorithm need for 5 objects? What about 100?
We thought you’d never ask...
What is the Knowunity AI companion?
Our AI companion is specifically built for the needs of students. Based on the millions of content pieces we have on the platform we can provide truly meaningful and relevant answers to students. But its not only about answers, the companion is even more about guiding students through their daily learning challenges, with personalised study plans, quizzes or content pieces in the chat and 100% personalisation based on the students skills and developments.
Where can I download the Knowunity app?
You can download the app in the Google Play Store and in the Apple App Store.
Is Knowunity really free of charge?
That's right! Enjoy free access to study content, connect with fellow students, and get instant help – all at your fingertips.
Most popular content in Computer Science / Programming
3AP Computer Science Principles Full Review
a full review to prepare for the AP CSP exam
HTML tags, codes, definition
HTML tags, codes, and definition with examples
Intro to Python Pt 1
This is a summary of the basics of python such as variables, print, and if statements.
Most popular content
9Origins and Dynamics of the Columbian Exchange
Analyze the ecological and economic motivations behind the initial transfer of goods, people, and diseases between the Old and New Worlds.
Introduction to Early Cultural Interactions
Analyze the initial social and religious encounters between Europeans, Africans, and Indigenous peoples in the colonial Americas.
Origins of Ancient River Civilizations
Analyze the environmental factors and technological innovations that led to the rise of early states in Mesopotamia, Egypt, and the Indus Valley.
Motivations for European Exploration
Analyze the economic, religious, and political factors that drove European powers to the Americas during the 15th and 16th centuries.
Foundations of Ethical Guidelines in Research
Practice the core principles of the APA ethical code including informed consent, debriefing, and the role of Institutional Review Boards.
Introduction to Native American Societies
Examine the diverse social, political, and economic structures of North American indigenous groups prior to European contact.
Introduction to Biological Elements of Life
Practice identifying the essential elements including carbon, nitrogen, phosphorus, and sulfur that compose biological macromolecules.
Introduction to the Spanish Encomienda System
Explore the fundamental economic and social structures of the Spanish colonial system, focusing on the encomienda and the casta social hierarchy.
Origins and Continuity of the Byzantine Empire
Analyze the political and cultural transitions from the Roman Empire to the Byzantine Empire, focusing on the reign of Justinian I and his code.
Can't find what you're looking for? Explore other subjects.
Students love us — and so will you.
The app is very easy to use and well designed. I have found everything I was looking for so far and have been able to learn a lot from the presentations! I will definitely use the app for a class assignment! And of course it also helps a lot as an inspiration.
This app is really great. There are so many study notes and help [...]. My problem subject is French, for example, and the app has so many options for help. Thanks to this app, I have improved my French. I would recommend it to anyone.
Wow, I am really amazed. I just tried the app because I've seen it advertised many times and was absolutely stunned. This app is THE HELP you want for school and above all, it offers so many things, such as workouts and fact sheets, which have been VERY helpful to me personally.