CodyCrossAnswers.com

  • A set of problem-solving operations in a computer

set of problem solving operations in a computer

HINTS AND TIPS:

Before giving away the correct answer, here are some more hints and tips for you to guess the solution on your own!

1. The first letter of the answer is: A

2. the last letter of the answer is: m, 3. there are 3 vowels in the hidden word:.

CORRECT ANSWER :

Other Related Levels

If you successfully solved the above puzzle and are looking for other related puzzles from the same level then select any of the following:

  • 2022 film in which Tom Holland plays Nathan Drake
  • Host of Weakest Link game show after George Gray
  • American Creole and Cajun rice dish
  • Weather temperature that has a negative sign
  • President drafted the Declaration of Independence
  • 2022 Tom Holland film where he plays Nathan Drake
  • A large hairy spider
  • Wise housekeeper from To Kill a Mockingbird
  • Chinese city known as the City of Flowers
  • Process with temperature change but no heat flow
  • Triangular brand of chocolate bar
  • Mattresses that are like sleeping on a wave

If you already solved this clue and are looking for other clues from the same puzzle then head over to CodyCross Rainforest Group 1212 Puzzle 3 Answers .

set of problem solving operations in a computer

Have a language expert improve your writing

Check your paper for plagiarism in 10 minutes, generate your apa citations for free.

  • Knowledge Base
  • Using AI tools
  • What Is an Algorithm? | Definition & Examples

What Is an Algorithm? | Definition & Examples

Published on August 9, 2023 by Kassiani Nikolopoulou . Revised on August 29, 2023.

An algorithm is a set of steps for accomplishing a task or solving a problem. Typically, algorithms are executed by computers, but we also rely on algorithms in our daily lives. Each time we follow a particular step-by-step process, like making coffee in the morning or tying our shoelaces, we are in fact following an algorithm.

In the context of computer science , an algorithm is a mathematical process for solving a problem using a finite number of steps. Algorithms are a key component of any computer program and are the driving force behind various systems and applications, such as navigation systems, search engines, and music streaming services.

Instantly correct all language mistakes in your text

Upload your document to correct all your mistakes in minutes

upload-your-document-ai-proofreader

Table of contents

What is an algorithm, how do algorithms work, examples of algorithms, other interesting articles, frequently asked questions about algorithms.

An algorithm is a sequence of instructions that a computer must perform to solve a well-defined problem. It essentially defines what the computer needs to do and how to do it. Algorithms can instruct a computer how to perform a calculation, process data, or make a decision.

The best way to understand an algorithm is to think of it as a recipe that guides you through a series of well-defined actions to achieve a specific goal. Just like a recipe produces a replicable result, algorithms ensure consistent and reliable outcomes for a wide range of tasks in the digital realm.

And just like there are numerous ways to make, for example, chocolate chip cookies by following different steps or using slightly different ingredients, different algorithms can be designed to solve the same problem, with each taking a distinct approach but achieving the same result.

Algorithms are virtually everywhere around us. Examples include the following:

  • Search engines rely on algorithms to find and present relevant results as quickly as possible
  • Social media platforms use algorithms to prioritize the content that we see in our feeds, taking into account factors like our past behavior, the popularity of posts, and relevance.
  • With the help of algorithms, navigation apps determine the most efficient route for us to reach our destination.
  • It must be correct . In other words, it should take a given problem and provide the right answer or result, even if it stops working due to an error.
  • It must consist of clear, practical steps that can be completed in a limited time, whether by a person or the machine that must execute the algorithm. For example, the instructions in a cookie recipe might be considered sufficiently concrete for a human cook, but they would not be specific enough for programming an automated cookie-making machine.
  • There should be no confusion about which step comes next , even if choices must be made (e.g., when using “if” statements).
  • It must have a set number of steps (not an infinite number) that can be managed using loops (statements describing repeated actions or iterations).
  • It must eventually reach an endpoint and not get stuck in a never-ending loop.

Check for common mistakes

Use the best grammar checker available to check for common mistakes in your text.

Fix mistakes for free

Algorithms use a set of initial data or input , process it through a series of logical steps or rules, and produce the output (i.e., the outcome, decision, or result).

Algorithm boxes

If you want to make chocolate chip cookies, for instance, the input would be the ingredients and quantities, the process would be the recipe you choose to follow, and the output would be the cookies.

Algorithms are eventually expressed in a programming language that a computer can process. However, when an algorithm is being created, it will be people, not a computer, who will need to understand it. For this reason, as a first step, algorithms are written as plain instructions.

  • Input: the input data is a single-digit number (e.g., 5).
  • Transformation/processing: the algorithm takes the input (number 5) and performs the specific operation (i.e., multiplies the number by itself).
  • Output: the result of the calculation is the square of the input number, which, in this case, would be 25 (since 5 * 5 = 25).

We could express this as an algorithm in the following way:

Algorithm: Calculate the square of a number

  • Input the number (N) whose square you want to find.
  • Multiply the number (N) by itself.
  • Store the result of the multiplication in a variable (result).
  • Output the value of the variable (result), which represents the square of the input number.

It is important to keep in mind that an algorithm is not the same as a program or code. It is the logic or plan for solving a problem represented as a simple step-by-step description. Code is the implementation of the algorithm in a specific programming language (like C++ or Python), while a program is an implementation of code that instructs a computer on how to execute an algorithm and perform a task.

Instead of telling a computer exactly what to do, some algorithms allow computers to learn on their own and improve their performance on a specific task. These machine learning algorithms use data to identify patterns and make predictions or conduct data mining to uncover hidden insights in data that can inform business decisions.

Broadly speaking, there are three different types of algorithms:

  • Linear sequence algorithms follow a specific set or steps, one after the other. Just like following a recipe, each step depends on the success of the previous one.
  • For example, in the context of a cookie recipe, you would include the step “if the dough is too sticky, you might need to refrigerate it.”
  • For example, a looping algorithm could be used to handle the process of making multiple cookies from a single batch of dough. The algorithm would repeat a specific set of instructions to form and bake cookies until all the dough has been used.

Algorithms are fundamental tools for problem-solving in both the digital world and many real-life scenarios. Each time we try to solve a problem by breaking it down into smaller, manageable steps, we are in fact using algorithmic thinking.

  • Identify which clothes are clean.
  • Consider the weather forecast for the day.
  • Consider the occasion for which you are getting dressed (e.g., work or school etc.).
  • Consider personal preferences (e.g., style or which items match).

In mathematics, algorithms are standard methods for performing calculations or solving equations because they are efficient, reliable, and applicable to various situations.

Suppose you want to add the numbers 345 and 278. You would follow a set of steps (i.e., the standard algorithm for addition):

  • Write down the numbers so the digits align.
  • Start from the rightmost digits (the ones place) and add them together: 5 + 8 = 13. Write down the 3 and carry over the 1 to the next column.
  • Move to the next column (the tens place) and add the digits along with the carried-over value: 4 + 7 + 1 = 12. Write down the 2 and carry over the 1 to the next column.
  • Move to the leftmost column (the hundreds place) and add the digits along with the carried-over value: 3 + 2 + 1 = 6. Write down the 6.

The final result is 623

Algorithm calculation example

Navigation systems are another example of the use of algorithms. Such systems use algorithms to help you find the easiest and fastest route to your destination while avoiding traffic jams and roadblocks.

If you want to know more about ChatGPT, AI tools , fallacies , and research bias , make sure to check out some of our other articles with explanations and examples.

  • ChatGPT vs human editor
  • ChatGPT citations
  • Is ChatGPT trustworthy?
  • Using ChatGPT for your studies
  • Sunk cost fallacy
  • Straw man fallacy
  • Slippery slope fallacy
  • Red herring fallacy
  • Ecological fallacy
  • Logical fallacy

Research bias

  • Implicit bias
  • Framing bias
  • Cognitive bias
  • Optimism bias
  • Hawthorne effect
  • Unconscious bias

In computer science, an algorithm is a list of unambiguous instructions that specify successive steps to solve a problem or perform a task. Algorithms help computers execute tasks like playing games or sorting a list of numbers. In other words, computers use algorithms to understand what to do and give you the result you need.

Algorithms and artificial intelligence (AI) are not the same, however they are closely related.

  • Artificial intelligence is a broad term describing computer systems performing tasks usually associated with human intelligence like decision-making, pattern recognition, or learning from experience.
  • Algorithms are the instructions that AI uses to carry out these tasks, therefore we could say that algorithms are the building blocks of AI—even though AI involves more advanced capabilities beyond just following instructions.

Algorithms and computer programs are sometimes used interchangeably, but they refer to two distinct but interrelated concepts.

  • An algorithm is a step-by-step instruction for solving a problem that is precise yet general.
  • Computer programs are specific implementations of an algorithm in a specific programming language. In other words, the algorithm is the high-level description of an idea, while the program is the actual implementation of that idea.

Algorithms are valuable to us because they:

  • Form the basis of much of the technology we use in our daily lives, from mobile apps to search engines.
  • Power innovations in various industries that augment our abilities (e.g., AI assistants or medical diagnosis).
  • Help analyze large volumes of data, discover patterns and make informed decisions in a fast and efficient way, at a scale humans are simply not able to do.
  • Automate processes. By streamlining tasks, algorithms increase efficiency, reduce errors, and save valuable time.

Cite this Scribbr article

If you want to cite this source, you can copy and paste the citation or click the “Cite this Scribbr article” button to automatically add the citation to our free Citation Generator.

Nikolopoulou, K. (2023, August 29). What Is an Algorithm? | Definition & Examples. Scribbr. Retrieved July 5, 2024, from https://www.scribbr.com/ai-tools/what-is-an-algorithm/

Is this article helpful?

Kassiani Nikolopoulou

Kassiani Nikolopoulou

Other students also liked, what is deep learning | a beginner's guide, what is data mining | definition & techniques, what is machine learning | a beginner's guide.

Kassiani Nikolopoulou

Kassiani Nikolopoulou (Scribbr Team)

Thanks for reading! Hope you found this article helpful. If anything is still unclear, or if you didn’t find what you were looking for here, leave a comment and we’ll see if we can help.

Still have questions?

"i thought ai proofreading was useless but..".

I've been using Scribbr for years now and I know it's a service that won't disappoint. It does a good job spotting mistakes”

  • 1. Micro-Worlds
  • 2. Light-Bot in Java
  • 3. Jeroos of Santong Island
  • 4. Problem Solving and Algorithms
  • 5. Creating Jeroo Methods
  • 6. Conditionally Executing Actions
  • 7. Repeating Actions
  • 8. Handling Touch Events
  • 9. Adding Text to the Screen

Problem Solving and Algorithms

Learn a basic process for developing a solution to a problem. Nothing in this chapter is unique to using a computer to solve a problem. This process can be used to solve a wide variety of problems, including ones that have nothing to do with computers.

Problems, Solutions, and Tools

I have a problem! I need to thank Aunt Kay for the birthday present she sent me. I could send a thank you note through the mail. I could call her on the telephone. I could send her an email message. I could drive to her house and thank her in person. In fact, there are many ways I could thank her, but that's not the point. The point is that I must decide how I want to solve the problem, and use the appropriate tool to implement (carry out) my plan. The postal service, the telephone, the internet, and my automobile are tools that I can use, but none of these actually solves my problem. In a similar way, a computer does not solve problems, it's just a tool that I can use to implement my plan for solving the problem.

Knowing that Aunt Kay appreciates creative and unusual things, I have decided to hire a singing messenger to deliver my thanks. In this context, the messenger is a tool, but one that needs instructions from me. I have to tell the messenger where Aunt Kay lives, what time I would like the message to be delivered, and what lyrics I want sung. A computer program is similar to my instructions to the messenger.

The story of Aunt Kay uses a familiar context to set the stage for a useful point of view concerning computers and computer programs. The following list summarizes the key aspects of this point of view.

A computer is a tool that can be used to implement a plan for solving a problem.

A computer program is a set of instructions for a computer. These instructions describe the steps that the computer must follow to implement a plan.

An algorithm is a plan for solving a problem.

A person must design an algorithm.

A person must translate an algorithm into a computer program.

This point of view sets the stage for a process that we will use to develop solutions to Jeroo problems. The basic process is important because it can be used to solve a wide variety of problems, including ones where the solution will be written in some other programming language.

An Algorithm Development Process

Every problem solution starts with a plan. That plan is called an algorithm.

There are many ways to write an algorithm. Some are very informal, some are quite formal and mathematical in nature, and some are quite graphical. The instructions for connecting a DVD player to a television are an algorithm. A mathematical formula such as πR 2 is a special case of an algorithm. The form is not particularly important as long as it provides a good way to describe and check the logic of the plan.

The development of an algorithm (a plan) is a key step in solving a problem. Once we have an algorithm, we can translate it into a computer program in some programming language. Our algorithm development process consists of five major steps.

Step 1: Obtain a description of the problem.

Step 2: analyze the problem., step 3: develop a high-level algorithm., step 4: refine the algorithm by adding more detail., step 5: review the algorithm..

This step is much more difficult than it appears. In the following discussion, the word client refers to someone who wants to find a solution to a problem, and the word developer refers to someone who finds a way to solve the problem. The developer must create an algorithm that will solve the client's problem.

The client is responsible for creating a description of the problem, but this is often the weakest part of the process. It's quite common for a problem description to suffer from one or more of the following types of defects: (1) the description relies on unstated assumptions, (2) the description is ambiguous, (3) the description is incomplete, or (4) the description has internal contradictions. These defects are seldom due to carelessness by the client. Instead, they are due to the fact that natural languages (English, French, Korean, etc.) are rather imprecise. Part of the developer's responsibility is to identify defects in the description of a problem, and to work with the client to remedy those defects.

The purpose of this step is to determine both the starting and ending points for solving the problem. This process is analogous to a mathematician determining what is given and what must be proven. A good problem description makes it easier to perform this step.

When determining the starting point, we should start by seeking answers to the following questions:

What data are available?

Where is that data?

What formulas pertain to the problem?

What rules exist for working with the data?

What relationships exist among the data values?

When determining the ending point, we need to describe the characteristics of a solution. In other words, how will we know when we're done? Asking the following questions often helps to determine the ending point.

What new facts will we have?

What items will have changed?

What changes will have been made to those items?

What things will no longer exist?

An algorithm is a plan for solving a problem, but plans come in several levels of detail. It's usually better to start with a high-level algorithm that includes the major part of a solution, but leaves the details until later. We can use an everyday example to demonstrate a high-level algorithm.

Problem: I need a send a birthday card to my brother, Mark.

Analysis: I don't have a card. I prefer to buy a card rather than make one myself.

High-level algorithm:

Go to a store that sells greeting cards Select a card Purchase a card Mail the card

This algorithm is satisfactory for daily use, but it lacks details that would have to be added were a computer to carry out the solution. These details include answers to questions such as the following.

"Which store will I visit?"

"How will I get there: walk, drive, ride my bicycle, take the bus?"

"What kind of card does Mark like: humorous, sentimental, risqué?"

These kinds of details are considered in the next step of our process.

A high-level algorithm shows the major steps that need to be followed to solve a problem. Now we need to add details to these steps, but how much detail should we add? Unfortunately, the answer to this question depends on the situation. We have to consider who (or what) is going to implement the algorithm and how much that person (or thing) already knows how to do. If someone is going to purchase Mark's birthday card on my behalf, my instructions have to be adapted to whether or not that person is familiar with the stores in the community and how well the purchaser known my brother's taste in greeting cards.

When our goal is to develop algorithms that will lead to computer programs, we need to consider the capabilities of the computer and provide enough detail so that someone else could use our algorithm to write a computer program that follows the steps in our algorithm. As with the birthday card problem, we need to adjust the level of detail to match the ability of the programmer. When in doubt, or when you are learning, it is better to have too much detail than to have too little.

Most of our examples will move from a high-level to a detailed algorithm in a single step, but this is not always reasonable. For larger, more complex problems, it is common to go through this process several times, developing intermediate level algorithms as we go. Each time, we add more detail to the previous algorithm, stopping when we see no benefit to further refinement. This technique of gradually working from a high-level to a detailed algorithm is often called stepwise refinement .

The final step is to review the algorithm. What are we looking for? First, we need to work through the algorithm step by step to determine whether or not it will solve the original problem. Once we are satisfied that the algorithm does provide a solution to the problem, we start to look for other things. The following questions are typical of ones that should be asked whenever we review an algorithm. Asking these questions and seeking their answers is a good way to develop skills that can be applied to the next problem.

Does this algorithm solve a very specific problem or does it solve a more general problem ? If it solves a very specific problem, should it be generalized?

For example, an algorithm that computes the area of a circle having radius 5.2 meters (formula π*5.2 2 ) solves a very specific problem, but an algorithm that computes the area of any circle (formula π*R 2 ) solves a more general problem.

Can this algorithm be simplified ?

One formula for computing the perimeter of a rectangle is:

length + width + length + width

A simpler formula would be:

2.0 * ( length + width )

Is this solution similar to the solution to another problem? How are they alike? How are they different?

For example, consider the following two formulae:

Rectangle area = length * width Triangle area = 0.5 * base * height

Similarities: Each computes an area. Each multiplies two measurements.

Differences: Different measurements are used. The triangle formula contains 0.5.

Hypothesis: Perhaps every area formula involves multiplying two measurements.

Example 4.1: Pick and Plant

This section contains an extended example that demonstrates the algorithm development process. To complete the algorithm, we need to know that every Jeroo can hop forward, turn left and right, pick a flower from its current location, and plant a flower at its current location.

Problem Statement (Step 1)

A Jeroo starts at (0, 0) facing East with no flowers in its pouch. There is a flower at location (3, 0). Write a program that directs the Jeroo to pick the flower and plant it at location (3, 2). After planting the flower, the Jeroo should hop one space East and stop. There are no other nets, flowers, or Jeroos on the island.

StartFinish

Analysis of the Problem (Step 2)

The flower is exactly three spaces ahead of the jeroo.

The flower is to be planted exactly two spaces South of its current location.

The Jeroo is to finish facing East one space East of the planted flower.

There are no nets to worry about.

High-level Algorithm (Step 3)

Let's name the Jeroo Bobby. Bobby should do the following:

Get the flower Put the flower Hop East

Detailed Algorithm (Step 4)

Get the flower Hop 3 times Pick the flower Put the flower Turn right Hop 2 times Plant a flower Hop East Turn left Hop once

Review the Algorithm (Step 5)

The high-level algorithm partitioned the problem into three rather easy subproblems. This seems like a good technique.

This algorithm solves a very specific problem because the Jeroo and the flower are in very specific locations.

This algorithm is actually a solution to a slightly more general problem in which the Jeroo starts anywhere, and the flower is 3 spaces directly ahead of the Jeroo.

Java Code for "Pick and Plant"

A good programmer doesn't write a program all at once. Instead, the programmer will write and test the program in a series of builds. Each build adds to the previous one. The high-level algorithm will guide us in this process.

FIRST BUILD

To see this solution in action, create a new Greenfoot4Sofia scenario and use the Edit Palettes Jeroo menu command to make the Jeroo classes visible. Right-click on the Island class and create a new subclass with the name of your choice. This subclass will hold your new code.

The recommended first build contains three things:

The main method (here myProgram() in your island subclass).

Declaration and instantiation of every Jeroo that will be used.

The high-level algorithm in the form of comments.

The instantiation at the beginning of myProgram() places bobby at (0, 0), facing East, with no flowers.

Once the first build is working correctly, we can proceed to the others. In this case, each build will correspond to one step in the high-level algorithm. It may seem like a lot of work to use four builds for such a simple program, but doing so helps establish habits that will become invaluable as the programs become more complex.

SECOND BUILD

This build adds the logic to "get the flower", which in the detailed algorithm (step 4 above) consists of hopping 3 times and then picking the flower. The new code is indicated by comments that wouldn't appear in the original (they are just here to call attention to the additions). The blank lines help show the organization of the logic.

By taking a moment to run the work so far, you can confirm whether or not this step in the planned algorithm works as expected.

THIRD BUILD

This build adds the logic to "put the flower". New code is indicated by the comments that are provided here to mark the additions.

FOURTH BUILD (final)

Example 4.2: replace net with flower.

This section contains a second example that demonstrates the algorithm development process.

There are two Jeroos. One Jeroo starts at (0, 0) facing North with one flower in its pouch. The second starts at (0, 2) facing East with one flower in its pouch. There is a net at location (3, 2). Write a program that directs the first Jeroo to give its flower to the second one. After receiving the flower, the second Jeroo must disable the net, and plant a flower in its place. After planting the flower, the Jeroo must turn and face South. There are no other nets, flowers, or Jeroos on the island.

Jeroo_2 is exactly two spaces behind Jeroo_1.

The only net is exactly three spaces ahead of Jeroo_2.

Each Jeroo has exactly one flower.

Jeroo_2 will have two flowers after receiving one from Jeroo_1. One flower must be used to disable the net. The other flower must be planted at the location of the net, i.e. (3, 2).

Jeroo_1 will finish at (0, 1) facing South.

Jeroo_2 is to finish at (3, 2) facing South.

Each Jeroo will finish with 0 flowers in its pouch. One flower was used to disable the net, and the other was planted.

Let's name the first Jeroo Ann and the second one Andy.

Ann should do the following: Find Andy (but don't collide with him) Give a flower to Andy (he will be straight ahead) After receiving the flower, Andy should do the following: Find the net (but don't hop onto it) Disable the net Plant a flower at the location of the net Face South
Ann should do the following: Find Andy Turn around (either left or right twice) Hop (to location (0, 1)) Give a flower to Andy Give ahead Now Andy should do the following: Find the net Hop twice (to location (2, 2)) Disable the net Toss Plant a flower at the location of the net Hop (to location (3, 2)) Plant a flower Face South Turn right

The high-level algorithm helps manage the details.

This algorithm solves a very specific problem, but the specific locations are not important. The only thing that is important is the starting location of the Jeroos relative to one another and the location of the net relative to the second Jeroo's location and direction.

Java Code for "Replace Net with Flower"

As before, the code should be written incrementally as a series of builds. Four builds will be suitable for this problem. As usual, the first build will contain the main method, the declaration and instantiation of the Jeroo objects, and the high-level algorithm in the form of comments. The second build will have Ann give her flower to Andy. The third build will have Andy locate and disable the net. In the final build, Andy will place the flower and turn East.

This build creates the main method, instantiates the Jeroos, and outlines the high-level algorithm. In this example, the main method would be myProgram() contained within a subclass of Island .

This build adds the logic for Ann to locate Andy and give him a flower.

This build adds the logic for Andy to locate and disable the net.

This build adds the logic for Andy to place a flower at (3, 2) and turn South.

What is an Algorithm? Algorithm Definition for Computer Science Beginners

Kolade Chris

If you’re a student and want to study computer science, or you’re learning to code, then there’s a chance you’ve heard of algorithms. Simply put, an algorithm is a set of instructions that performs a particular action.

Contrary to popular belief, an algorithm is not some piece of code that requires extremely advanced knowledge in order to implement. At the same time, I won't say that an algorithm is easy to implement, either. Some can be, but it depends on what you're trying to do.

In the end, the best way to get better at algorithms is by practicing them regularly.

In this article, you'll learn all about algorithms so you'll be prepared next time you encounter one, or have to write one yourself. I will also share some freeCodeCamp resources that will help you learn how to write algorithms in different languages.

What We'll Cover

What exactly is an algorithm.

  • Why Do You Need an Algorithm?

Types of Algorithms

  • Which Programming Language Is Best for Writing Algorithms? (rename)

Resources for Learning Algorithms

An algorithm is a set of steps for solving a known problem. Most algorithms are implemented to run following the four steps below:

  • take an input
  • access that input and make sure it's correct
  • show the result
  • terminate (the stage where the algorithm stop running)

Some steps of the algorithm may run repeatedly, but in the end, termination is what ends an algorithm.

For example, the algorithm below sort numbers in descending order. It loops through the numbers specified until it arranges them in descending order, then terminates when there are no more number to sort:

For a theoretical basis, for instance, an algorithm for dividing two numbers and showing the remainder could run through the steps below:

  • Step 1 : the user enters the first and second numbers – the dividend and the divisor
  • Step 2 : the algorithm written to perform the division takes in the number, then puts a division sign between the dividend and the divisor. It also checks for a remainder.
  • Step 3 : the result of the division and remainder is shown to the user
  • Step 4 : the algorithm terminates

Here's how that kind of algorithm is implemented in JavaScript:

If there's an error, the algorithm may not run, or might return the wrong output. If the programmer who wrote the algorithm took user experience into consideration, then an error handler could show an error to the user and let them know what to do.

Why do you Need an Algorithm?

If you’re one of those computer science students asking “why algorithms”, here are some reasons why you should learn about them:

Problem Solving : being able to write an algorithm improves your problem-solving capacity. It is a common belief that once you can solve a problem with one thing, you can solve problems with another closely related one. So, if you can solve problems with Python, you can solve problems with JavaScript.

Scalability : an algorithm helps your software/application/website respond appropriately to demands.

Proper Utilization of Resources: choosing the right algorithm ensures proper utilization of resources such as memory, storage, network, and others.

Algorithms in computer science can be broadly categorized into searching and sorting algorithms:

  • Sorting – selection sort, bubble sort, insertion sort, merge sort, quick sort, and so on.
  • Searching – binary search, exponential search, jump search, and so on.

But there are many types of algorithms that programers use regularly. Here are some other common algorithm types organized by category:

  • Hashing – SHA-256, SHA-1
  • Brute force – trial and error
  • Divide and conquer – merge sort algorithm
  • Greedy – Prim's algorithm, Kruskal's algorithm
  • Recursive – computer factorials

Which Programming Language Is Best for Writing Algorithms?

You can write angorithms in any programming language. There's no benefit to using one language over another.

Every language has its strengths and weaknesses, and each has unique syntax and features. So writing an algorithm might look different in one language compared to another.

But algorithms are universal concepts. So if you can write bubble sort in Python, you should also be able to write it in JavaScript or C#.

Here are some videos from the freeCodeCamp YouTube channel that can help you learn algorithms effectively:

  • Algorithms and Data Structures Tutorial - Full Course for Beginners
  • Algorithms in Python – Full Course for Beginners
  • Data Structures Easy to Advanced Course - Full Tutorial from a Google Engineer
  • Dynamic Programming - Learn to Solve Algorithmic Problems & Coding Challenges
  • Understanding Sorting Algorithms

Also, the interactive JavaScript Algorithms and Data Structures Certification on freeCodeCamp can give you a crash course in algorithmic thinking in JavaScript.

In this article, we went over what an algorithm is, their types, and resources for learning algorithms.

If you read this far, the next thing you should do is start learning algorithms with one or more of the resources listed in this article.

Thank you for reading.

Web developer and technical writer focusing on frontend technologies. I also dabble in a lot of other technologies.

If you read this far, thank the author to show them you care. Say Thanks

Learn to code for free. freeCodeCamp's open source curriculum has helped more than 40,000 people get jobs as developers. Get started

Tutorial Playlist

Data structure tutorial, arrays in data structures: a guide with examples, all you need to know about two-dimensional arrays, all you need to know about a linked list in a data structure, the complete guide to implement a singly linked list, the ultimate guide to implement a doubly linked list, the fundamentals for understanding circular linked list, the ultimate guide to understand the differences between stack and queue, implementing stacks in data structures, your one-stop solution for stack implementation using array, your one-stop solution for queue implementation using array, your one-stop solution to learn depth-first search(dfs) algorithm from scratch, your one-stop solution for stack implementation using linked-list, the definitive guide to understand stack vs heap memory allocation, all you need to know about linear search algorithm, all you need to know about breadth-first search algorithm, a one-stop solution for using binary search trees in data structure, the best tutorial to understand trees in data structure, a complete guide to implement binary tree in data structure, a holistic look at using avl trees in data structures, all you need to know about tree traversal in data structure, the best and easiest way to understand an algorithm, the best guide you’ll ever need to understand b-tree in data structure, the best guide you'll ever need to understand spanning tree in data structure, a one-stop solution guide to understand data structure and algorithm complexity, your one-stop solution to understand shell sort algorithm, your one-stop solution to quick sort algorithm, the most useful guide to learn selection sort algorithm, everything you need to know about radix sort algorithm, everything you need to know about the counting sort algorithm, everything you need to know about the merge sort algorithm, insertion sort algorithm: one-stop solution that will help you understand insertion sort, everything you need to know about the bubble sort algorithm, the best guide you’ll ever need to understand bucket sort algorithm, your one-stop solution to understand recursive algorithm in programming, the definitive guide to understanding greedy algorithm, your one-stop solution to understand backtracking algorithm, the fundamentals of the bellman-ford algorithm, your one-stop solution for graphs in data structures, the best guide to understand and implement solutions for tower of hanoi puzzle, a simplified and complete guide to learn space and time complexity, all you need to know about the knapsack problem : your complete guide, the fibonacci series: mathematical and programming interpretation, the holistic look at longest common subsequence problem, the best article to understand what is dynamic programming, a guide to implement longest increasing subsequence using dynamic programming, a holistic guide to learn stop solution using dynamic programming, one stop solution to all the dynamic programming problems, understanding the fundamentals of binomial distribution, here’s all you need to know about minimum spanning tree in data structures, understanding the difference between array and linked list, the best article out there to understand the b+ tree in data structure, a comprehensive look at queue in data structure, your one-stop solution to understand coin change problem, the best way to understand the matrix chain multiplication problem, your one-stop solution to learn floyd-warshall algorithm for using dynamic programming, the best tutorial you'll ever need for queue implementation using linked list, how to create a fake news detection system, all you need to know about how to create a react js portfolio project, a complete guide on the role of ai in healthcare, the best guide to learn how to make a wireframe: what is a wireframe, the best dsa projects for your resume, the best guide to understanding the working and implementation of selective repeat arq, one stop guide to understanding network layer in the osi model, the working and implementation of data-link layer in the osi model, top 5 best coding books you must read, the working and implementation of physical layer in the osi model, how to create an instagram clone using react, reactjs vs vuejs, what is an algorithm definition, types, characteristics.

Lesson 21 of 68

The Best and Easiest Way to Understand an Algorithm

Table of Contents

What is an algorithm.

An algorithm is a set of commands that must be followed for a computer to perform calculations or other problem-solving operations.According to its formal definition, an algorithm is a finite set of instructions carried out in a specific order to perform a particular task. It is not the entire program or code; it is simple logic to a problem represented as an informal description in the form of a flowchart or pseudocode.

what-is-an-algorithm-flowchart

  • Problem: A problem can be defined as a real-world problem or real-world instance problem for which you need to develop a program or set of instructions. An algorithm is a set of instructions. 
  • Algorithm: An algorithm is defined as a step-by-step process that will be designed for a problem.
  • Input: After designing an algorithm, the algorithm is given the necessary and desired inputs.
  • Processing unit: The input will be passed to the processing unit, producing the desired output.
  • Output: The outcome or result of the program is referred to as the output.

After defining what an algorithm is, you will now look at algorithm characteristics.

Want a Top Software Development Job? Start Here!

Want a Top Software Development Job? Start Here!

How do Algorithms Work?

Algorithms are step-by-step procedures designed to solve specific problems and perform tasks efficiently in the realm of computer science and mathematics. These powerful sets of instructions form the backbone of modern technology and govern everything from web searches to artificial intelligence. Here's how algorithms work:

Input: Algorithms take input data, which can be in various formats, such as numbers, text, or images.

Processing: The algorithm processes the input data through a series of logical and mathematical operations, manipulating and transforming it as needed.

Output: After the processing is complete, the algorithm produces an output, which could be a result, a decision, or some other meaningful information.

Efficiency: A key aspect of algorithms is their efficiency, aiming to accomplish tasks quickly and with minimal resources.

Optimization: Algorithm designers constantly seek ways to optimize their algorithms, making them faster and more reliable.

Implementation: Algorithms are implemented in various programming languages, enabling computers to execute them and produce desired outcomes.

What is the Need for Algorithms?

You require algorithms for the following reasons:

Scalability

It aids in your understanding of scalability. When you have a sizable real-world problem, you must break it down into small steps to analyze it quickly.

Performance

The real world is challenging to break down into smaller steps. If a problem can be easily divided into smaller steps, it indicates that the problem is feasible.

After understanding what is an algorithm, why you need an algorithm, you will look at how to write one using an example.

Use of the Algorithms

Algorithms are essential to many disciplines because they offer organized, practical answers to challenging issues. Here are a few significant applications of algorithms in various fields:

1. Data Analysis and Machine Learning

Algorithms are used in data analysis and machine learning to find patterns in big datasets and forecast outcomes. Thanks to machine learning methods like support vector machines, decision trees, and neural networks, computers can learn from data and improve over time. These techniques are essential for applications such as recommendation systems, natural language processing, and picture recognition.

2. Cryptography & Security

Cryptography algorithms safeguard data by using encryption and decryption techniques, guaranteeing safe data storage and communication. Algorithms such as SHA-256, AES, and RSA are commonly employed in data integrity maintenance, user authentication, and sensitive information security . These algorithms comprise the foundation of cybersecurity measures used in secure communications, data encryption, and online transactions.

3. Information Retrieval and Search Engines

Search engines can efficiently index and retrieve pertinent information thanks to search algorithms such as PageRank and Hummingbird. By prioritizing web pages according to their significance and relevancy, these algorithms assist users in locating the most relevant information available online. Effective search algorithms are necessary to manage the enormous volume of online information.

4. Optimization problems

Optimization methods are utilized to select the optimal answer from various options. In various industries, including banking, engineering, logistics, and artificial intelligence, sophisticated issues are resolved using methods like gradient descent, linear programming, and genetic algorithms. These algorithms increase productivity, reduce expenses, and optimize resources for operations and decision-making.

5. Genomics and medical diagnostics

Due to their ability to analyze medical images, forecast disease outbreaks, and recognize genetic changes, algorithms are indispensable in medical diagnostics. Personalized medicine has been transformed by machine learning algorithms, in particular, which enable the creation of customized treatment regimens based on each patient's unique genetic profile. Additionally, algorithms help to speed up the sequencing and interpretation of genomic data, improving biotechnology and genomics research.

Characteristics of an Algorithm

An algorithm is a methodical process used to solve a task or solve a problem. Several important factors impact an algorithm's effectiveness:

1. Finiteness

An algorithm must always have a finite number of steps before it ends. When the operation is finished, it must have a defined endpoint or output and not enter an endless loop .

2. Definiteness

An algorithm needs to have exact definitions for each step. Clear and straightforward directions ensure that every step is understood and can be taken easily.

An algorithm requires one or more inputs . The values that are first supplied to the algorithm before its processing are known as inputs. These inputs come from a predetermined range of acceptable values.

One or more outputs must be produced by an algorithm. The output is the outcome of the algorithm after every step has been completed. The relationship between the input and the result should be clear.

5. Effectiveness

An algorithm's stages must be sufficiently straightforward to be carried out in a finite time utilizing fundamental operations. With the resources at hand, every operation in the algorithm should be doable and practicable.

6. Generality

Rather than being limited to a single particular case , an algorithm should be able to solve a group of issues. It should offer a generic fix that manages a variety of inputs inside a predetermined range or domain.

Types of Algorithms

Brute Force Algorithm: A straightforward approach that exhaustively tries all possible solutions, suitable for small problem instances but may become impractical for larger ones due to its high time complexity.

Recursive Algorithm: A method that breaks a problem into smaller, similar subproblems and repeatedly applies itself to solve them until reaching a base case, making it effective for tasks with recursive structures.

Encryption Algorithm: Utilized to transform data into a secure, unreadable form using cryptographic techniques, ensuring confidentiality and privacy in digital communications and transactions.

Backtracking Algorithm: A trial-and-error technique used to explore potential solutions by undoing choices when they lead to an incorrect outcome, commonly employed in puzzles and optimization problems.

Searching Algorithm: Designed to find a specific target within a dataset, enabling efficient retrieval of information from sorted or unsorted collections.

Sorting Algorithm: Aimed at arranging elements in a specific order, like numerical or alphabetical, to enhance data organization and retrieval.

Hashing Algorithm: Converts data into a fixed-size hash value, enabling rapid data access and retrieval in hash tables, commonly used in databases and password storage.

Divide and Conquer Algorithm: Breaks a complex problem into smaller subproblems, solves them independently, and then combines their solutions to address the original problem effectively.

Greedy Algorithm: Makes locally optimal choices at each step in the hope of finding a global optimum, useful for optimization problems but may not always lead to the best solution.

Dynamic Programming Algorithm : Stores and reuses intermediate results to avoid redundant computations, enhancing the efficiency of solving complex problems.

Randomized Algorithm: Utilizes randomness in its steps to achieve a solution, often used in situations where an approximate or probabilistic answer suffices.

How to Write an Algorithm?

  • There are no well-defined standards for writing algorithms. It is, however, a problem that is resource-dependent. Algorithms are never written with a specific programming language in mind.
  • As you all know, basic code constructs such as loops like do, for, while, all programming languages share flow control such as if-else, and so on. An algorithm can be written using these common constructs.
  • Algorithms are typically written in a step-by-step fashion, but this is not always the case. Algorithm writing is a process that occurs after the problem domain has been well-defined. That is, you must be aware of the problem domain for which you are developing a solution.

Now, use an example to learn how to write algorithms.

Problem: Create an algorithm that multiplies two numbers and displays the output.

Step 1 − Start

Step 2 − declare three integers x, y & z

Step 3 − define values of x & y

Step 4 − multiply values of x & y

Step 5 − store result of step 4 to z

Step 6 − print z

Step 7 − Stop

Algorithms instruct programmers on how to write code. In addition, the algorithm can be written as:

Step 1 − Start mul

Step 2 − get values of x & y

Step 3 − z ← x * y

Step 4 − display z

Step 5 − Stop

In algorithm design and analysis, the second method is typically used to describe an algorithm. It allows the analyst to analyze the algorithm while ignoring all unwanted definitions easily. They can see which operations are being used and how the process is progressing. It is optional to write step numbers. To solve a given problem, you create an algorithm. A problem can be solved in a variety of ways.

how-to-write-an-algorithm_Example

As a result, many solution algorithms for a given problem can be derived. The following step is to evaluate the proposed solution algorithms and implement the most appropriate solution.

As you progress through this "what is an Algorithm" tutorial, you will learn about some of the components of an algorithm.

Factors of an Algorithm

The following are the factors to consider when designing an algorithm:

  • Modularity: This feature was perfectly designed for the algorithm if you are given a problem and break it down into small-small modules or small-small steps, which is a basic definition of an algorithm.
  • Correctness: An algorithm's correctness is defined as when the given inputs produce the desired output, indicating that the algorithm was designed correctly. An algorithm's analysis has been completed correctly.
  • Maintainability: It means that the algorithm should be designed in a straightforward, structured way so that when you redefine the algorithm, no significant changes are made to the algorithm.
  • Functionality: It takes into account various logical steps to solve a real-world problem.
  • Robustness: Robustness refers to an algorithm's ability to define your problem clearly.
  • User-friendly: If the algorithm is difficult to understand, the designer will not explain it to the programmer.
  • Simplicity: If an algorithm is simple, it is simple to understand.
  • Extensibility: Your algorithm should be extensible if another algorithm designer or programmer wants to use it.

You will now see why an algorithm is so essential after understanding some of its components.

Qualities of a Good Algorithm

  • Efficiency: A good algorithm should perform its task quickly and use minimal resources.
  • Correctness: It must produce the correct and accurate output for all valid inputs.
  • Clarity: The algorithm should be easy to understand and comprehend, making it maintainable and modifiable.
  • Scalability: It should handle larger data sets and problem sizes without a significant decrease in performance.
  • Reliability: The algorithm should consistently deliver correct results under different conditions and environments.
  • Optimality: Striving for the most efficient solution within the given problem constraints.
  • Robustness: Capable of handling unexpected inputs or errors gracefully without crashing.
  • Adaptability: Ideally, it can be applied to a range of related problems with minimal adjustments.
  • Simplicity: Keeping the algorithm as simple as possible while meeting its requirements, avoiding unnecessary complexity.

The Complexity of an Algorithm

The algorithm's performance can be measured in two ways:

Time Complexity

The amount of time required to complete an algorithm's execution is called time complexity. The big O notation is used to represent an algorithm's time complexity. The asymptotic notation for describing time complexity, in this case, is big O notation. The time complexity is calculated primarily by counting the number of steps required to complete the execution. Let us look at an example of time complexity.

mul = 1;

// Suppose you have to calculate the multiplication of n numbers.  

for i=1 to n  

mul = mul *1;  

// when the loop ends, then mul holds the multiplication of the n numbers  

return mul;  

The time complexity of the loop statement in the preceding code is at least n, and as the value of n escalates, so does the time complexity. While the code's complexity, i.e., returns mul, will be constant because its value is not dependent on the importance of n and will provide the result in a single step. The worst-time complexity is generally considered because it is the maximum time required for any given input size.

Space Complexity

The amount of space an algorithm requires to solve a problem and produce an output is called its space complexity. Space complexity, like time complexity, is expressed in big O notation.

The space is required for an algorithm for the following reasons:

  • To store program instructions.
  • To store track of constant values.
  • To store track of variable values.
  • To store track of function calls, jumping statements, and so on.

Space Complexity = Auxiliary Space + Input Size

Finally after understanding what is an algorithm, its analysis and approches, you will look at different types of algorithms.

Advantage and Disadvantages of Algorithms

Advantages of algorithms:.

  • Efficiency: Algorithms streamline processes, leading to faster and more optimized solutions.
  • Reproducibility: They yield consistent results when provided with the same inputs.
  • Problem-solving: Algorithms offer systematic approaches to tackle complex problems effectively.
  • Scalability: Many algorithms can handle larger datasets and scale with increasing input sizes.
  • Automation: They enable automation of tasks, reducing the need for manual intervention.

Disadvantages of Algorithms:

  • Complexity: Developing sophisticated algorithms can be challenging and time-consuming.
  • Limitations: Some problems may not have efficient algorithms, leading to suboptimal solutions.
  • Resource Intensive: Certain algorithms may require significant computational resources.
  • Inaccuracy: Inappropriate algorithm design or implementation can result in incorrect outputs.
  • Maintenance: As technology evolves, algorithms may require updates to stay relevant and effective.

Choose The Right Software Development Program

This table compares various courses offered by Simplilearn, based on several key features and details. The table provides an overview of the courses' duration, skills you will learn, additional benefits, among other important factors, to help learners make an informed decision about which course best suits their needs.

Program Name Full Stack Java Developer Career Bootcamp Automation Testing Masters Program Post Graduate Program in Full Stack Web Development Geo IN All Non-US University Simplilearn Simplilearn Caltech Course Duration 11 Months 11 Months 9 Months Coding Experience Required Basic Knowledge Basic Knowledge Basic Knowledge Skills You Will Learn 15+ Skills Including Core Java, SQL, AWS, ReactJS, etc. Java, AWS, API Testing, TDD, etc. Java, DevOps, AWS, HTML5, CSS3, etc. Additional Benefits Interview Preparation Exclusive Job Portal 200+ Hiring Partners Structured Guidance Learn From Experts Hands-on Training Caltech CTME Circle Membership Learn 30+ Tools and Skills 25 CEUs from Caltech CTME Cost $$ $$ $$$ Explore Program Explore Program Explore Program

In this tutorial, you learned what an algorithm is and what its characteristics are. After that, you took a look at why you need algorithms, how to write them, and how important they are. After you learned about the approaches and factors of an algorithm, you learned about complexity and types of algorithms.

Suppose you're searching for a more extensive study that goes beyond Software Development and covers the most in-demand programming languages and abilities today. In that case, Simplilearn's Post Graduate Program In Full Stack Web Development  is the right choice for you. Explore this globally-recognized bootcamp program and be rest assured that completing this will  be the smartest move you can make to enter and grow in the software development profession.

Do you have any questions about this tutorial on what an algorithm is? If you do, please leave them in the comments section at the bottom of this page. Our specialists will respond to your questions as quickly as possible!

Find our Full Stack Java Developer Online Bootcamp in top cities:

NameDatePlace
Cohort starts on 16th Jul 2024,
Weekend batch
Your City
Cohort starts on 30th Jul 2024,
Weekend batch
Your City

About the Author

Soni Upadhyay

Soni Upadhyay is with Simplilearn's Research Analysis Team. She's a Computer Science and Engineering graduate. Programming languages are her area of expertise. She has a brilliant knowledge of C, C++, and Java Programming languages

Recommended Programs

Full Stack Java Developer

Full Stack Web Developer - MEAN Stack

Automation Testing Masters Program

*Lifetime access to high-quality, self-paced e-learning content.

Recommended Resources

What Is Dijkstra’s Algorithm and Implementing the Algorithm through a Complex Example

What Is Dijkstra’s Algorithm and Implementing the Algorithm through a Complex Example

Free eBook: Guide To Scrum Methodology

Free eBook: Guide To Scrum Methodology

A* Algorithm : An Introduction To The Powerful Search Algorithm

A* Algorithm : An Introduction To The Powerful Search Algorithm

Random Forest Algorithm

Random Forest Algorithm

The Complete Know-How on the MD5 Algorithm

The Complete Know-How on the MD5 Algorithm

Free eBook: Guide To The Top CISCO Certifications

Free eBook: Guide To The Top CISCO Certifications

  • PMP, PMI, PMBOK, CAPM, PgMP, PfMP, ACP, PBA, RMP, SP, and OPM3 are registered marks of the Project Management Institute, Inc.
  • Admiral “Amazing Grace” Hopper

Exploring the Intricacies of NP-Completeness in Computer Science

Understanding p vs np problems in computer science: a primer for beginners, understanding key theoretical frameworks in computer science: a beginner’s guide.

Learn Computer Science with Python

Learn Computer Science with Python

CS is a journey, not a destination

  • Foundations

Understanding Algorithms: The Key to Problem-Solving Mastery

set of problem solving operations in a computer

The world of computer science is a fascinating realm, where intricate concepts and technologies continuously shape the way we interact with machines. Among the vast array of ideas and principles, few are as fundamental and essential as algorithms. These powerful tools serve as the building blocks of computation, enabling computers to solve problems, make decisions, and process vast amounts of data efficiently.

An algorithm can be thought of as a step-by-step procedure or a set of instructions designed to solve a specific problem or accomplish a particular task. It represents a systematic approach to finding solutions and provides a structured way to tackle complex computational challenges. Algorithms are at the heart of various applications, from simple calculations to sophisticated machine learning models and complex data analysis.

Understanding algorithms and their inner workings is crucial for anyone interested in computer science. They serve as the backbone of software development, powering the creation of innovative applications across numerous domains. By comprehending the concept of algorithms, aspiring computer science enthusiasts gain a powerful toolset to approach problem-solving and gain insight into the efficiency and performance of different computational methods.

In this article, we aim to provide a clear and accessible introduction to algorithms, focusing on their importance in problem-solving and exploring common types such as searching, sorting, and recursion. By delving into these topics, readers will gain a solid foundation in algorithmic thinking and discover the underlying principles that drive the functioning of modern computing systems. Whether you’re a beginner in the world of computer science or seeking to deepen your understanding, this article will equip you with the knowledge to navigate the fascinating world of algorithms.

What are Algorithms?

At its core, an algorithm is a systematic, step-by-step procedure or set of rules designed to solve a problem or perform a specific task. It provides clear instructions that, when followed meticulously, lead to the desired outcome.

Consider an algorithm to be akin to a recipe for your favorite dish. When you decide to cook, the recipe is your go-to guide. It lists out the ingredients you need, their exact quantities, and a detailed, step-by-step explanation of the process, from how to prepare the ingredients to how to mix them, and finally, the cooking process. It even provides an order for adding the ingredients and specific times for cooking to ensure the dish turns out perfect.

In the same vein, an algorithm, within the realm of computer science, provides an explicit series of instructions to accomplish a goal. This could be a simple goal like sorting a list of numbers in ascending order, a more complex task such as searching for a specific data point in a massive dataset, or even a highly complicated task like determining the shortest path between two points on a map (think Google Maps). No matter the complexity of the problem at hand, there’s always an algorithm working tirelessly behind the scenes to solve it.

Furthermore, algorithms aren’t limited to specific programming languages. They are universal and can be implemented in any language. This is why understanding the fundamental concept of algorithms can empower you to solve problems across various programming languages.

The Importance of Algorithms

Algorithms are indisputably the backbone of all computational operations. They’re a fundamental part of the digital world that we interact with daily. When you search for something on the web, an algorithm is tirelessly working behind the scenes to sift through millions, possibly billions, of web pages to bring you the most relevant results. When you use a GPS to find the fastest route to a location, an algorithm is computing all possible paths, factoring in variables like traffic and road conditions, to provide you the optimal route.

Consider the world of social media, where algorithms curate personalized feeds based on our previous interactions, or in streaming platforms where they recommend shows and movies based on our viewing habits. Every click, every like, every search, and every interaction is processed by algorithms to serve you a seamless digital experience.

In the realm of computer science and beyond, everything revolves around problem-solving, and algorithms are our most reliable problem-solving tools. They provide a structured approach to problem-solving, breaking down complex problems into manageable steps and ensuring that every eventuality is accounted for.

Moreover, an algorithm’s efficiency is not just a matter of preference but a necessity. Given that computers have finite resources — time, memory, and computational power — the algorithms we use need to be optimized to make the best possible use of these resources. Efficient algorithms are the ones that can perform tasks more quickly, using less memory, and provide solutions to complex problems that might be infeasible with less efficient alternatives.

In the context of massive datasets (the likes of which are common in our data-driven world), the difference between a poorly designed algorithm and an efficient one could be the difference between a solution that takes years to compute and one that takes mere seconds. Therefore, understanding, designing, and implementing efficient algorithms is a critical skill for any computer scientist or software engineer.

Hence, as a computer science beginner, you are starting a journey where algorithms will be your best allies — universal keys capable of unlocking solutions to a myriad of problems, big or small.

Common Types of Algorithms: Searching and Sorting

Two of the most ubiquitous types of algorithms that beginners often encounter are searching and sorting algorithms.

Searching algorithms are designed to retrieve specific information from a data structure, like an array or a database. A simple example is the linear search, which works by checking each element in the array until it finds the one it’s looking for. Although easy to understand, this method isn’t efficient for large datasets, which is where more complex algorithms like binary search come in.

Binary search, on the other hand, is like looking up a word in the dictionary. Instead of checking each word from beginning to end, you open the dictionary in the middle and see if the word you’re looking for should be on the left or right side, thereby reducing the search space by half with each step.

Sorting algorithms, meanwhile, are designed to arrange elements in a particular order. A simple sorting algorithm is bubble sort, which works by repeatedly swapping adjacent elements if they’re in the wrong order. Again, while straightforward, it’s not efficient for larger datasets. More advanced sorting algorithms, such as quicksort or mergesort, have been designed to sort large data collections more efficiently.

Diving Deeper: Graph and Dynamic Programming Algorithms

Building upon our understanding of searching and sorting algorithms, let’s delve into two other families of algorithms often encountered in computer science: graph algorithms and dynamic programming algorithms.

A graph is a mathematical structure that models the relationship between pairs of objects. Graphs consist of vertices (or nodes) and edges (where each edge connects a pair of vertices). Graphs are commonly used to represent real-world systems such as social networks, web pages, biological networks, and more.

Graph algorithms are designed to solve problems centered around these structures. Some common graph algorithms include:

Dynamic programming is a powerful method used in optimization problems, where the main problem is broken down into simpler, overlapping subproblems. The solutions to these subproblems are stored and reused to build up the solution to the main problem, saving computational effort.

Here are two common dynamic programming problems:

Understanding these algorithm families — searching, sorting, graph, and dynamic programming algorithms — not only equips you with powerful tools to solve a variety of complex problems but also serves as a springboard to dive deeper into the rich ocean of algorithms and computer science.

Recursion: A Powerful Technique

While searching and sorting represent specific problem domains, recursion is a broad technique used in a wide range of algorithms. Recursion involves breaking down a problem into smaller, more manageable parts, and a function calling itself to solve these smaller parts.

To visualize recursion, consider the task of calculating factorial of a number. The factorial of a number n (denoted as n! ) is the product of all positive integers less than or equal to n . For instance, the factorial of 5 ( 5! ) is 5 x 4 x 3 x 2 x 1 = 120 . A recursive algorithm for finding factorial of n would involve multiplying n by the factorial of n-1 . The function keeps calling itself with a smaller value of n each time until it reaches a point where n is equal to 1, at which point it starts returning values back up the chain.

Algorithms are truly the heart of computer science, transforming raw data into valuable information and insight. Understanding their functionality and purpose is key to progressing in your computer science journey. As you continue your exploration, remember that each algorithm you encounter, no matter how complex it may seem, is simply a step-by-step procedure to solve a problem.

We’ve just scratched the surface of the fascinating world of algorithms. With time, patience, and practice, you will learn to create your own algorithms and start solving problems with confidence and efficiency.

Related Articles

set of problem solving operations in a computer

Three Elegant Algorithms Every Computer Science Beginner Should Know

  • Skip to content
  • Select language
  • Skip to search

The web browser you are using is out of date, please upgrade .

Please use a modern web browser with JavaScript enabled to visit OpenClassrooms.com

Think like a computer: the logic of programming

Free online content available in this course.

course.header.alt.is_video

course.header.alt.is_certifying

Last updated on 6/15/21

Discover how computers solve problems

Have you ever wondered how a computer solves a problem?  As humans, we learn problem-solving by watching others and through trial and error.  What makes a smart car smart? What is artificial intelligence and what makes it artificial?

Computers can’t actually think, but they can perform billions of logical operations per second. These logical operations are written by us and provide the computer with the instructions needed to perform the problem-solving.  This means you need to think like a computer and translate what you need it to do into program instructions it understands.

Solving a problem like a computer

Computers are basically toddlers. You have to explain everything to them. Take the simple task of watering flowers.  What tools do you need? What steps do you need?

Pick up a watering can by the handle.

Go to the faucet.

Put the opening of the watering can under the faucet.

Turn on the faucet.

Fill the watering can with water.

Turn off the faucet.

Go to your garden.

Tilt the spout of the watering can downwards.

Pour the water on your flowers.

This looks deceptively simple.  However, if you forget to tell your toddler...er...computer to pick up the watering can by the handle, it may try to pick it up by the spout.  If you don’t tell it to turn the faucet on, it will just sit there, staring at it. And if you don’t tell it to turn it off, it might just let the water run. 🚰 You can see where this is going.

Toddler watering flowers

Computers can’t make assumptions or guess what you want .  If you tell a computer to dust the furniture, it will actually put dust on your furniture, instead of removing it!  It can’t read context clues, so it will take all of your instructions literally. This is why it’s important to think through all the logical gaps in your instructions!

Try it out for yourself!

Write out the steps to making a cup of coffee or tea.  Write down everything that needs to be done. If you use milk or cream, don’t forget to say how to find it!  Once you’re done, test your instructions out on a friend. Tell them to follow the directions exactly.  Have you missed anything?

Computers can solve problems by performing billions of operations per second .

A programmer’s job is to find solutions . They do this by breaking down problems into easy-to-follow steps for a computer.

Programming languages allow people to communicate with computers.

Computers are literal and do exactly what you tell them to.

Example of certificate of achievement

Only Premium members can download videos from our courses. However, you can watch them online for free.

'Algorithms'

In this course, we'll be looking at a variety of algorithms. That's because algorithms are what people come up with, and then program them into computers - software is simply codified versions of algorithms..

What is an algorithm?

"A process or set of rules to be followed in calculations or other problem-solving operations, especially by a computer."

It is a series of STEPS that can be followed PRECISELY (very slowly by us humans, and VERY RAPIDLY by computers) - eventually this will lead us to what we want.

'Algorithms' [cont'd]

A recipe (eg. for making banana bread) is an informal example of an algorithm:

set of problem solving operations in a computer

  • has to be unambiguous, precise
  • needs to have have inputs, generate outputs

Why is this (needing to be precise, needing to terminate) imporant?

Let's get our feet wet - let's 'do' some algorithms!

Algorithm: 'hailstone' sequences

Here is an algorithm:

  • Pick any positive integer
  • If the number is even, halve it
  • If it is odd, multiply it by 3 and add 1
  • Repeat the above two steps until we reach a repeating sequence of numbers

Let's try it on a bunch of numbers..

Plotting the hailstone sequences that we get, produces nice results!

Algorithm: computing a (positive) number's square root

Have you thought about how to calculate, eg., `sqrt(5)`?

Here's an algorithm, for finding `sqrt(x)` [for any `x`]:

  • 1. start with an initial GUESS 'g' for `sqrt(x)` (what is a good guess?)
  • 2. if g is a square root, the "other" square root is going to be x/g
  • 3. are g and x/g "close" (eg. their difference is less than 0.001)?
  • 4. if yes, g is our square root, we're DONE
  • 5. if not, find a better approximation: average g and x/g, this is our new g
  • go back to step 2 above

Algorithm: directory listing

Can you see that the above is also an algorithm?

set of problem solving operations in a computer

Algorithm: finding the factorial of a number

Algorithm: listing all possible permutations of letters in a word.

The classic 'JUMBLE' game provides scrambled words, asks you for the unscrambled versions:

set of problem solving operations in a computer

So, how could we list all the possibilities? "Recurse" (!), by 'fixing' leftmost letters, while swapping letters of the right subwords. Eg. given ABC, we would enumerate the 6 permutations like so:

set of problem solving operations in a computer

Given DABC, we'd swap D with D,A,B,C and consider DABC, ADBC, BADC and CABD, and generate 6 combinations each for the subwords ABC, DBC, ADC and ABD [using the scheme shown above] - we'd have 24 words total (4x3x2x1=24, ie. 4!).

  • what an algorithm is
  • an algorithm to compute square roots and hailstone sequences
  • an algorithm to enumerate files and folders
  • an algorithm to compute the factorial of a number
  • an algorithm to enumerate word scrambles

Problems, Solutions, and Algorithms

Learning goals.

  • Be able to define the terms algorithm, pseudocode, and iteration
  • Be able to use pseudocode to describe the flow of an algorithm’s implementation
  • Be familiar with using iterative processes to design increasingly robust solutions
  • 10 - Warmup
  • 15 - Lecture
  • 15 - Lecture Cont.
  • 10 - Challenge 1
  • 15 - Challenge 2
  • 10 - Challenge 3
  • 5 - Closeout

Available here

Part 1 - Writing

First, spend 5 minutes writing an “algorithm” that explains how to tie your shoes. Try to be as explicit and specific as possible. Assume your reader is a human, but a very literal one.

Part 2 - Doing

Now, pair up with your neighbor. The person whose name is alphabetically first will read their algorithm step-by-step to the person whose name is alphabetically last. The person whose name is alphabetically last will attempt to tie their shoes according only to the instructions from their partner.

You can repeat instructions if needed, but don’t add any instructions beyond what you had originally written down.

Lecture - Big-Picture Strategy

  • What is an Algorithm a process or set of rules to be followed in calculations or other problem-solving operations, especially by a computer.
  • Incremental solutions (linear)
  • Iterative solutions (spirals)
  • Building a full “slice”
  • “Half a product not a half-assed product”

An Iterative Process

  • Identify the big picture goal: What do you want your program to do? How will you know when you’ve succeeded?
  • Identify the interface: How do you want to interact with your program? What are its inputs and outputs?
  • Identify a small picture goal: What is the simplest case of this problem? Is there a sub-problem of even that case?
  • Plan to solve that small goal: Sketch ideas out in a notebook.
  • Write a small goal test: Identify expected inputs and outputs. Decide on a method name.
  • Implement: Write pseudocode and turn that into code.
  • Repeat: Is the whole problem solved? If not, go back to step 3.

Exercise 1 – Common Words

With a pair, answer the questions from steps 1 through 4 for the following problem. When you get to steps 3 and 4, repeat them at least 3 times for increasing levels of complexity.

I have a text document and want to know “What are the three most common words in the text?”

Extension : Let’s exclude the following: I, you, he, she, it, we, they, they, a, an.

Software Processes / Techniques – why do we care

  • Programming – what makes it hard? (Translating ideas into code? Or coming up with ideas?)
  • Perception - A good programmer is someone who solves technical problems easily
  • Reality - A good programmer is someone equipped with the tools and processes to confront challenging problems and still emerge successful
  • Problem solving challenges: What to do vs. How to do it
  • “Dumping out the toolbox” - controlling nerves and pacing yourself
  • Software development techniques are designed to manage these difficulties
  • Agile Development

Remaining Exercises

Small groups - algorithm challenges.

We’ll then break into small groups to work through this process for a few different problems.

Odds & Evens

I have a file with 100 numbers. I want to create two new files: one with all the odds and one with all the evens.

Extension : Don’t allow duplicates in the output

Palindromes

A palindrome is a word or phrase that reads the same when you reverse all of the letters.

  • Never odd or even

A palindromic number is the same concept applied to numbers:

Create a program to find the largest palindromic number that you can create by multiplying two three digit numbers together.

Lats & Longs

I have a file with 100 latitude/longitude pairs. Find the point that’s closest to the north pole.

Extension : Find the one closest to the magnetic north pole.

  • What is an algorithm? What is algorithmic thinking? Why is it necessary when working with computers?
  • How does iterative problem solving work? Why is it beneficial to us as developers?
  • What is pseudocode? How does it make programming easier? Why should we do it even if we think we’ve got a pretty sweet plan?

Lesson Search Results

Showing top 10 results.

Introduction to Algorithms  #5 #5

Previous lesson.

Standard I/O

Next lesson

Recursion and Dynamic Programming

Setting Things Up

Introduction to C++

Type Modifiers and Pointers

Introduction to Algorithms

Recursion and Dynamic Programming  Draft

Data Structures  Draft

Introduction to Graph Theory  Draft

Implementations of Graph Theory  Draft

Applications of Graph Theory  Draft

Minimum Spanning Tree  Draft

Shortest Path  Draft

Travelling Salesman

Other Algorithms  Draft

Asymptotic Analysis

Developing algorithms.

n. a process or set of rules to be followed in calculations or other problem-solving operations

When we make a program, all we are doing is writing a set of instructions for computer to follow. These instructions, of course, must be perfect — they have to be simple enough for a computer to follow, since computers only know so much and can’t interpret a programmer’s intent.

With the introduction of modular programming, many oft-repeated calculations could be encapsulated into a function, and later these functions into libraries. Standard yet complicated procedures — like getting an integral input [ 1 ]  — could be implemented with a simple function call.

A simple program which takes two integral values and spits out its sum could be simplified to two variable decalarations, and two lines of code. It’s juat a simple algorithm .

Most algorithms, however, aren’t so simple. In Computer Science, algorithms are about somehow manipulating memory to solve computational problems in a timely manner — computers, after all, only know how to manipulate memory.

Time Complexity: Measuring an Algorithm

It certainly wouldn’t be a stretch to say that some algorithms are better than others. If, for example, you had the following problem:

Given a sorted (least-to-greatest) array of size n , find the index of a value m . If it does not exist, result -1 .

One way would be to iterate along the list, checking each and every element to see if it’s the desired value. This is called the linear search .

Another way, commonly called the binary search , leverages the fact that the array is sorted. If one starts from the middle, they can easily cut the problem to half its size, as the desired value is on one side or the other and figuring out which side it’s on relies on a simple comparison.

Visualization of binary and linear search

Clearly, both will work — both algorithms will eventually find the answer. But you can also make the observation that the binary search is better . It’s not because it’s more sophisticated, but rather that it’s faster. If you had a 1024-element array, you can expect the following number of iterations for each algorithm:

Linear Search Binary Search

Best Case

1 iteration (once in 1024)

1 iteration (once in 1024)

Average Case

512 iterations

9 iterations

Worst Case

1024 iterations (once in 1024)

10 iterations (once in 2)

So, is binary search fifty times faster than linear search? Well, not exactly.

First of all, binary search requires more time per iteration, as it does at least one addition comparison. Secondly, binary search is less efficient over the cache [ 2 ] .

But most importantly, binary search uses an entirely different approach from linear search, and it grows differently. If you double the size of your input, linear search will take twice as many iterations on average and in the worst case. Binary search, on the other hand, will take one more iteration.

They scale differently, and when it comes to writing good algorithms, that’s what matters.

Efficient scaling really matters.

The first line of input contains three integers K, N and M (1 ≤ K ≤ 200; 2 ≤ N ≤ 2000 ; 1 ≤ M ≤ 10000 ), each separated by one space. The next M lines each contain 4 integers a i b i t i h i (1 ≤ a i , b i ≤ N; 1 ≤ t i ≤ 10 5 ; 0 ≤ h i ≤ 200), each separated by one space. The i-th line in this set of M lines describes the i-th sea route (which runs from island a i to island b i , takes t i minutes and wears down the ship’s hull by h i centimetres). Notice that a i ≠ b i (that is, the ends of a sea route are distinct islands).

How do we score an algorithm quantitatively? Obviously, we don’t want to express the "time" an algorithm would take in comparison to other algorithms, because those numbers are useless.

Instead, we should try to show how it scales. To do that, we use a technique called asymptotic analysis . Formally, we do that by looking at what type of mathematical function best represents the running time of an algorithm.

Linear search takes linear time, so it scales linearly. If you were to express this as a mathematical function, where \(T\) is time, \(n\) is the input size, and \(c\) is some proportionality coefficient, you’d have \(T=cn\).

With binary search, you may notice that it scales logarithmically . For binary search, you’d express that with \(T=c\log{n}\).

There’s a few problems with this approach, though. That coefficient \(c\) varies from environment to environment, so it’s not a very useful measure. And the time isn’t always proportional to some function on the input size, as most algorithms for most problems can end earlier than the worst- or average case. We just need to focus on scaling .

To deal with this, we developed big-O notation .

A function \(f(x)\) is \(O(g(x))\), that is, \(f(x)=O(g(x))\text{ as }x\rightarrow\infty\) if and only if \(|f(x)|

Essentially, what this means is that \(g(x)\) is the upper bound of the growth \(f(x)\).

Using this notation, we can say that linear search is \(O(n)\) and binary search \(O(\log{n})\) for \(n\), the size of our input array.

This might seem rather alien and unusual. In the next section, while we discuss how we can develop algorithms, we’ll also do some more work with time complexity.

Now that you’re acquainted with terms and with notation, let’s discuss solving a common algorithm [ 3 ] .

Given an unsorted array \(n\) elements and an operator \(\lt\) which orders these elements, sort the array from least to greatest.

Our first sort is based on selecting elements, so we’ll call it selection sort .

For each of the \(n\) elements we have to add to construct the sorted array, we’re making up to \(n-1\) comparisons. To be precise, we make exactly \(\frac{1}{2}n(n+1)\) comparisons (and \(n-1\) swaps). As such, selection sort grows quadratically, and its time complexity is \(O(n^2)\).

Clearly, it’ll be pretty slow for large inputs. Is there a better way?

You may notice that one of the worst problems with selection sort is that it’s not adaptable : it does blind searches and nothing else. When the input array is already nearly sorted, it won’t get any faster. Instead of iteratively searching, we could try iteratively moving elements closer to where they should be.

This sort is based on bubbling elements up, one at a time, so we’ll call it bubble sort . It turns out, though, that it’s usually worse than selection sort [ 5 ] .

For every pass through the array, one more element is guaranteed to be sorted, so we need to make \(n\) passes through the array. And in every pass, we make \(n\) comparisons and \(O(n)\) swaps [ 6 ] . That makes for an overall time complexity of…​ \(O(n^2)\) [ 7 ] .

Let’s take a look at selection sort again. Selection sort’s main bottleneck is finding the answer to "where do we take the next element out?", which requires a search among all unordered elements. If we change that question to "where do we put the next element in ?", then we can leverage the fact that we’ll be inserting into a sorted list, and finding where it should go doesn’t require a search among all unordered elements. We can just insert the next element of the unsorted array.

Since we came up with this sort from the idea of inserting , we’ll call this insertion sort . This one really is faster than selection sort.

For each of the \(n\) elements we have to add to the sorted array, we make \(O(n)\) comparisons and swaps for an overall time complexity of, once again, \(O(n^2)\). But this time, it really is faster.

If we know the largest size an element can be away from its proper position, there’s another way to write the time complexity: for an input of size \(n\) where the maximal displacement is \(k\), for each \(n\) elements to add, we make \(O(k)\) comparisons and swaps for an overall time complexity of \(O(nk)\). Since \(k\leq n\), it’s sure to be faster than just \(O(n^2)\).

But our overall time complexity is still just \(O(n^2)\). Can we do better than this baseline?

Notice what slows down insertion sort: when elements are far away from their supposed position, they’re inserted slowly. But it’s fast for both small arrays and arrays with low displacement. Is it perhaps possible to first do some smaller sorts on the array to lower the average displacements first, before we run insertion sort on the entire thing?

If it’s too large for a 4-element gap first, then we can also do another similar pass before it, with a larger gap. And if \(n\) is still too large, we can just keep adding more passes with larger gaps before it.

This method of sorting was first published by Donald Shell in 1959, and so it is aptly named Shell sort . Its time complexity is a bit complicated [ 8 ] to calculate, and depends specifically on the gap sequences (the "let’s only do every \(g\) elements" thing). The best gap sequence runs in \(O(n\log^2n)\) [ 9 ] but is impractical. In practice, it runs in \(O(n^{\frac{4}{3}})\) [ 10 ] or \(\Theta(n^{\frac{3}{2}})\) [ 11 ] [ 12 ]

By analyzing insertion sort, we were able to come up with Shell sort — which has finally managed to improve our time complexity.

But can we do better?

So if we get two sorted arrays, we can merge them into a larger sorted array; then that means that if we get one unsorted array, we could split it in two, sort both sides, and then merge it back. We’ll call this merge sort since we’re exploiting merging behaviours.

How do we sort either side? Well, with merge sort!

But then when do we stop splitting the array? When it’s not possible: when there’s just one element left.

But doesn’t that leave unsorted lists? Well, not really: a single-element array is sorted.

A simple idea can come a long way. Merge sort has a time complexity of \(\Theta(n\log{n})\): at every level of recursion [ 14 ] , an entire pass is done with \(\Theta(n)\) comparisons, and recursive depth is \(\Theta(\log{n})\).

It turns out that according to classical mechanics [ 15 ] , \(\Theta(n\log{n})\) is the absolute fastest we can ever sort things [ 16 ] . But that doesn’t mean that we’re done with merge sort. You may have noticed, for example, that it isn’t adaptive [ 17 ] . You may also have noticed that it’s the first sort that uses extra memory: specifically, it uses \(O(n)\) extra memory. Can we write an adaptive, in-place sort that runs in \(O(n\log{n})\) time?

To do this, we can choose a pivot from the array; then, going from both ends, find anything out-of-place to swap.

Like with merge sort, for every recursive level there will be \(O(n)\) comparisons and swaps, and — if you choose the pivots well [ 18 ]  — there’ll be \(\Theta(\log{n})\) recursive depth. It’s in-place, adaptive, easy on the cache, and uses little overhead. It’s quick.

So, naturally, we call it quicksort .

There are only two hard problems in computer science: cache invalidation, naming things, and off-by-one errors.

Learn Python practically and Get Certified .

Popular Tutorials

Popular examples, reference materials, learn python interactively, dsa introduction.

  • What is an algorithm?
  • Data Structure and Types
  • Why learn DSA?
  • Asymptotic Notations
  • Master Theorem
  • Divide and Conquer Algorithm

Data Structures (I)

  • Types of Queue
  • Circular Queue
  • Priority Queue

Data Structures (II)

  • Linked List
  • Linked List Operations
  • Types of Linked List
  • Heap Data Structure
  • Fibonacci Heap
  • Decrease Key and Delete Node Operations on a Fibonacci Heap

Tree based DSA (I)

  • Tree Data Structure
  • Tree Traversal
  • Binary Tree
  • Full Binary Tree
  • Perfect Binary Tree
  • Complete Binary Tree
  • Balanced Binary Tree
  • Binary Search Tree

Tree based DSA (II)

  • Insertion in a B-tree
  • Deletion from a B-tree
  • Insertion on a B+ Tree
  • Deletion from a B+ Tree
  • Red-Black Tree
  • Red-Black Tree Insertion
  • Red-Black Tree Deletion

Graph based DSA

  • Graph Data Structure
  • Spanning Tree
  • Strongly Connected Components
  • Adjacency Matrix
  • Adjacency List
  • DFS Algorithm
  • Breadth-first Search

Bellman Ford's Algorithm

Sorting and Searching Algorithms

  • Bubble Sort
  • Selection Sort
  • Insertion Sort
  • Counting Sort
  • Bucket Sort
  • Linear Search
  • Binary Search

Greedy Algorithms

Greedy Algorithm

  • Ford-Fulkerson Algorithm
  • Dijkstra's Algorithm
  • Kruskal's Algorithm
  • Prim's Algorithm
  • Huffman Coding

Dynamic Programming

  • Floyd-Warshall Algorithm
  • Longest Common Sequence

Other Algorithms

  • Backtracking Algorithm
  • Rabin-Karp Algorithm

DSA Tutorials

Merge Sort Algorithm

  • Selection Sort Algorithm

What is an Algorithm?

In computer programming terms, an algorithm is a set of well-defined instructions to solve a particular problem. It takes a set of input(s) and produces the desired output. For example,

An algorithm to add two numbers:

Take two number inputs

Add numbers using the + operator

Display the result

Qualities of a Good Algorithm

  • Input and output should be defined precisely.
  • Each step in the algorithm should be clear and unambiguous.
  • Algorithms should be most effective among many different ways to solve a problem.
  • An algorithm shouldn't include computer code. Instead, the algorithm should be written in such a way that it can be used in different programming languages.

Algorithm Examples

Algorithm to add two numbers

Algorithm to find the largest among three numbers

Algorithm to find all the roots of the quadratic equation

Algorithm to find the factorial

Algorithm to check prime number

Algorithm of Fibonacci series

Algorithm 1: Add two numbers entered by the user

Algorithm 2: find the largest number among three numbers, algorithm 3: find roots of a quadratic equation ax 2 + bx + c = 0, algorithm 4: find the factorial of a number, algorithm 5: check whether a number is prime or not, algorithm 6: find the fibonacci series till the term less than 1000, table of contents.

  • Qualities of Good Algorithms
  • Add Two Numbers
  • Find Largest Number
  • Roots of Quatratic Equation
  • Find Factorial of a Number
  • Check Prime Number
  • Find Fibonacci Series

Sorry about that.

Related Tutorials

DS & Algorithms

Stack Exchange Network

Stack Exchange network consists of 183 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Computer Program vs. Algorithm

It's said that a program include algorithms, however if we refer to their definition, an algorithm is a sequence of instructions written to perform a specified task and a computer program is also a sequence of instructions to perform a (some) tasks with computer.

Then what makes a program different from an algorithm? is it a type of algorithm too?

In fact, I look for formal definitions for an algorithm and a computer program so I can distinguish them from each other or identify algorithms within a program.

Update :I have noticed in Wikipedia by an informal definition (at least syntactically) any program is an algorithm.

An informal definition could be "a set of rules that precisely defines a sequence of operations." which would include all computer programs , including programs that do not perform numeric calculations. Generally, a program is only an algorithm if it stops eventually .
  • terminology
  • programming-languages

Ahmad's user avatar

10 Answers 10

I'm going to give the same answer as I gave the previous time this question came up.

First, understand that there is no good formal definition of "algorithm" at the time of writing. The key word here is "formal".

However, there are smart people working on it.

What we know is that whatever an "algorithm" is, it sits somewhere between "mathematical function" and "computer program".

A mathematical function is formal notion of a mapping from inputs to outputs. So, for example, "sort" is a mapping between a sequence of orderable items and a sequence of orderable items of the same type, which maps each sequence to its ordered sequence. This function could be implemented using different algorithms (e.g. merge sort, heap sort). Each algorithm, in turn, could be implemented using different programs (even given the same programming language).

So the best handle that we have on what an "algorithm" is, is that it's some kind of equivalence class on programs, where two programs are equivalent if they do "essentially the same thing". Any two programs which implement the same algorithm must compute the same function, but the converse is not true.

Similarly, there is an equivalence class between algorithms, where two algorithms are equivalent if they compute the same mathematical function.

The hard part in all this is trying to capture what we mean by "essentially the same thing".

There are some obvious things that we should include. For example, two programs are essentially the same if they differ only by variable renamings. Most models of programming languages have native notions of "equivalence" (e.g. beta reduction and eta conversion in lambda calculus), so we should throw those in too.

Whatever equivalence relation we pick, this gives us some structure. Algorithms form a category by virtue of the fact that they are the quotient category of programs. Some interesting equivalence relations are known to give rise to interesting categorical structures; for example, the category of primitive recursive algorithms is a universal object in the category of categories. Whenever you see interesting structure like that, you know that this line of enquiry will probably be useful.

Pseudonym's user avatar

  • $\begingroup$ Thank you for your precise answer, just another question. If we consider any program, regardless what it does, they still get some inputs and follow some instructions, and give some results as they are executed. They even may don't solve any problem (as we call), but it is still a mapping. could they be known algorithm, I mean any program? $\endgroup$ –  Ahmad Commented Feb 16, 2015 at 5:55
  • 1 $\begingroup$ If I'm reading you correctly, you're asking if a formal definition of an "algorithm" should or should not carry the proviso that it must be "useful". I would say "no", if only because it's impossible to formalise that notion. $\endgroup$ –  Pseudonym ♦ Commented Feb 16, 2015 at 6:30
  • $\begingroup$ sorry! my English is not well, then you say "no" to what? you admit that it's impossible to formalise the usefulness of a program, and just by definition, any program is an algorithm? or you say it's necessary that we consider usefulness beside the algorithm? $\endgroup$ –  Ahmad Commented Feb 16, 2015 at 16:57
  • 1 $\begingroup$ I don't think that a formal definition of an "algorithm" should require it to be useful, because "useful" can't be formally defined. $\endgroup$ –  Pseudonym ♦ Commented Feb 16, 2015 at 22:20
  • $\begingroup$ Your answer is the most useful in this thread +1. I believe by "essentially the same thing", you mean "semantically equivalent". Also, I think all programs are essentially algorithms (as OP says), since all programs are implementations which map some input to some output, even if this mapping be implicit. As you stated, it all depends on the perspective. $\endgroup$ –  doubleOrt Commented Jun 20, 2018 at 12:56

Ultimately, the difference is one of perspective. A program is a program: a sequence of statements in some language, perhaps a programming language or machine-level instructions. Algorithms are usually described at a higher level than machine instructions or programming language statements but just how high a level is rather flexible. For example, in some circumstances, "Sort the array, then look at the $k$th element" is a perfectly good description of an algorithm for finding the $k$th largest object in an array; in other circumstances, you might want to specify much more detail about how the sorting takes place.

As you say, an algorithm is something like "a process or set of rules to be followed in calculations or other problem-solving operations, especially by a computer." So, literally speaking, every program is an algorithm. Usually, though, we speak of programs implementing algorithms. Usually, when describing an algorithm, we avoid the low-level detail of exactly how things are implemented, assuming that a competent programmer would be able to implement it in the langauge of their choosing.

David Richerby's user avatar

  • $\begingroup$ I think the precise of algorithm is related to mathematics concept, lambda-calculus or Turing machine, still don't know what is that abstraction language? mathematics or a natural language with many fuzzy statements $\endgroup$ –  Ahmad Commented Feb 15, 2015 at 15:51
  • 8 $\begingroup$ @Ahmad Algorithm is an informal concept. It has no formal definition. In a sense, it's like a mathematical proof, which is different from a formal proof in a formal proof system. We believe that informal proofs can be "fleshed out" to formal proofs in any chosen (strong enough) formal proof system, just as any algorithm can be fully implemented in any (Turing-complete) programming language. $\endgroup$ –  Yuval Filmus Commented Feb 15, 2015 at 19:46

Algorithms in the Turing-complete mindset are usually specified by input and output. Real programs do more; they

  • communicate with the user,
  • communicate with other machines,
  • react to the environment,
  • do not terminate and are still useful,

and more. These things are usually not considered in algorithms or theory of computation, but are essential for most programs.

Raphael's user avatar

  • $\begingroup$ This is a very good point. But do you mean something like "usually specified as a means to map input to output"? Just specifying the input and output isn't enough: e.g., mergesort and quicksort produce the same output from any input but aren't considered to be the same algorithm. $\endgroup$ –  David Richerby Commented Feb 16, 2015 at 8:47
  • $\begingroup$ @DavidRicherby I was thinking of specification in the PL sense; we don't specify anything else, so algorithms may not do anything else. Of course, we have to give more than the specification to describe a concrete algorithm. $\endgroup$ –  Raphael Commented Feb 16, 2015 at 8:59
  • $\begingroup$ Good points, but if we admit that in the end any program is an algorithm, I don't know how those matters you addressed are measured about an algorithm. Maybe an AI topic?! $\endgroup$ –  Ahmad Commented Feb 16, 2015 at 16:59
  • $\begingroup$ Who would admit that, and why? And what do you mean by measure here? (And I certainly don't see the AI angle here.) $\endgroup$ –  Raphael Commented Feb 16, 2015 at 21:21
  • $\begingroup$ @Raphael I may admit it (by looking at the syntax, all programs look similar, they are sequences of instructions, or mapping of input to output), I just don't know how other features of a program (those you addressed) can be extracted from that definition. for example the difference between quick-sort and MATLAB or Windows Media Player!! $\endgroup$ –  Ahmad Commented Feb 18, 2015 at 7:04

An algorithm is a concept or idea. It is a formal approach for solving a problem. Algorithms can be expressed, or implemented, in a variety of programming language (usually, almost any language can implement any algorithm). For some examples you should read through the Sorting Algorithms in Wikipedia.

A computer program is a specific sequence of instructions in a specific programming language. A program may contain the implementation of many algorithms. Excel is a program, but it's sorting capabilities are the manifestation of an algorithm.

Alex Fitzpatrick's user avatar

An algorithm is a systematic approach to solving a specific problem.

A program is a set of instructions for a computer to follow.

A program therefore does not even need to solve a problem. I'm sure we can all think of several programs that have caused more problems than they've solved. A program can be an implementation of many algorithms, or an algorithm can be implemented by patching together many programs. A program can even contain no algorithms. For example, the empty program which simply exits, or perhaps even a Hello World, could be considered a program with no algorithm.

Since an algorithm solves a specific problem, it is focused on a specific whole concept. An algorithm therefore provides abstract steps for processing one set of related information into a different set of derived information. A program does not require its constituents to be at all conceptually related. For example, a program can have an easter egg, but a thing properly called an algorithm should not. You can have a virus or trojan lurking in a program, but not in an algorithm. The closest an algorithm can get to this would be something like a backdoor in an encryption algorithm, where the planned flaw is part of the information relationship established by the algorithm.

And lastly, a program, as it is short for a computer program, tautologically requires a computer. An algorithm does not. If I systematically separate the shirts, pants, and socks from my laundry before putting them away, this is an algorithm. It deals with related inputs and outputs, can be described in a flow chart, and has calculable consequences in terms of efficiency (for example, the number of clothing pieces which must be compared to find matching socks).

Ryan Colyer's user avatar

Here is a couple of ways to draw the line between an algorithm and a program:

Meaningful Purpose

Programs are written with a purpose and represent an attempt to achieve a goal. Algorithms may be viewed as tools to achieve that goal.

E.g. a screwdriver is an algorithm to modify the state of a screw but the screwdriver itself does not hold a purpose to do that. The purpose is in the head of the screwdriver operator who holds the program like putting up shelves.

Business logic

This point strongly relates to the purpose of a program. Since programs have purposes they inevitably have bits of real world in them like specific dates, measurements, technologies, names etc.

Algorithms on the other hand contain neither business logic nor bits of real world and instead of operating on specific values operate on variables.

E.g. in this sense you can compare a mathematical function like f(x) = x^2 which is abstract and operates on variables to a cooking recipe which contains precise values (at least one for reference).

This point strongly relates to the business logic of a program. An agent (like a web browser user) consumes the result of a program not the result of an algorithm.

E.g. the consumer of a cooking recipe consumes the cake not the result of whipping cream or heating oven.

Robert Mugattarov's user avatar

  • $\begingroup$ Perhaps it would be better to say that the screwdriver doesn't have the intent to turn screws? In everyday English, we would certainly say that a screwdriver does have the purpose of turning screws: turning screws is the exact thing it was designed to do. $\endgroup$ –  David Richerby Commented Jan 11, 2017 at 14:26
  • $\begingroup$ Also, I'm not sure what you mean by "business logic" (many programs have nothing to do with business) or by saying that an algorithm "contains neither business logic nor bits of the real world". For example, I could perfectly well phrase a shortest-path algorithm in terms of towns and roads rather than vertices and edges. Doesn't the algorithm then "contain... bits of the real world"? $\endgroup$ –  David Richerby Commented Jan 11, 2017 at 14:28
  • $\begingroup$ @DavidRicherby, you are right, my phrasing is ambiguous. What I meant is a meaningful purpose. Turning screws to turn screws is pointless just as well as sorting an array which is never used. By business logic I mean all program logic except for utility logic and technology stack boilerplate i.e. all logic that actually implements the purpose of the program i.e. the business logic of baking a cake is mixing ingredients and baking and does not include learning to mix or bake (which is reused utility logic in this case). $\endgroup$ –  Robert Mugattarov Commented Jan 11, 2017 at 16:08
  • $\begingroup$ @DavidRicherby, as for bits of real world , I mean actualization i.e. a program unlike an algorithm has to communicate in some way with the physical world. An algorithm, on the other hand, can be a purely mathematical concept. $\endgroup$ –  Robert Mugattarov Commented Jan 11, 2017 at 16:22
An algorithm is a self-contained step-by-step set of operations to be performed to solve a specific problem or a class of problems. A computer program is a sequence of instructions that comply the rules of a specific programming language , written to perform a specified task with a computer.

Algorithms are general and have to be translated into a specific programming language (implemented).

Community's user avatar

  • 1 $\begingroup$ But the whole point of the question is that a program (either its source code or the compiled binary) is "a self-contained step-by-step set of operations to be performed to solve a specific problem or class of problems." $\endgroup$ –  David Richerby Commented Feb 15, 2015 at 16:24
  • $\begingroup$ But it isn't. A program is not those operations, but an implementation of them: something that executes them in a particular context. E.g. the Unix sort utility is not a sorting algorithm, it uses a sorting algorithm. $\endgroup$ –  reinierpost Commented Jan 11, 2017 at 20:52

An algorithm is expressing our idea or solution for specific problem in step by step approach.it is only problem solving and human understandable approach not for computer system

Program is step by step instructions which implemented for solving problem by computer system .it must be understandable by not only programmer also computer.

Pooja Thanekar's user avatar

  • $\begingroup$ Welcome to Computer Science Stack Exchange. Please read cs.stackexchange.com/tour.if you have not yet done so. $\endgroup$ –  babou Commented Jul 23, 2015 at 12:44

The other answers here, I think, miss an important point. The definition of 'algorithm' which I was taught included the requirement that the procedure halts on all inputs . Naturally that makes 'program' a broader class of procedures than 'algorithm', since some programs halt on all inputs and others do not.

PMar's user avatar

  • 2 $\begingroup$ This is not universal. The definition I was taught didn't include that requirement. $\endgroup$ –  reinierpost Commented Jan 11, 2017 at 20:47

I am pretty sure that other answers are good enough to take the lead but here's how I see the difference between an algorithm and program

An algorithm consists of simply the steps (machine independent) needed to be followed in some order to solve a problem.

A program is an instruction set for a specific type of machine to put an algorithm to practice .

For example.

Let's say you have an algorithm that has a step for reaching to a particular place before doing some other step.Now how this step of reaching will be carried out is not exactly defined.You may choose to walk or run or take a bus for doing it but that depends on how you choose to implement it (which is your program).

You can say that an algorithm is an abstraction of a program i.e. missing the exact details but lays out a plan to do something.

Romantic Electron's user avatar

  • $\begingroup$ A programme is not an instruction set but a structured set of instructions. “Instruction set” normally refers to the things that a (physical or virtual) processor can do, and can be considered as a programming language for that processor, but usually one with no structuring element other than conditional jumps. $\endgroup$ –  PJTraill Commented Jan 6, 2023 at 17:29

Not the answer you're looking for? Browse other questions tagged algorithms terminology programming-languages or ask your own question .

  • Featured on Meta
  • Upcoming initiatives on Stack Overflow and across the Stack Exchange network...
  • We spent a sprint addressing your requests — here’s how it went

Hot Network Questions

  • Why is there not a test for diagonalizability of a matrix
  • Any alternative to lockdown browser?
  • What makes Python better suited to quant finance than Matlab / Octave, Julia, R and others?
  • Directions of puff pastry folds
  • How do Union-Find Decoders deal with Measurement errors through multiple measurement rounds?
  • Why are responses to an attack in a cycling race immediate?
  • Plastic plugs used to fasten cover over radiator
  • Would it be moral for Danish resitance in WW2 to kill collaborators?
  • Equivalence of inverse transformations under distributional equivalence
  • Splitting Scalar into Holomorphic and Anti-Holomorphic Parts
  • Can the differential be unitless while the variable have an unit in integration?
  • Decorate equations with arrows using TikZ
  • Were there any stone vessels (including mortars) made in Paleolithic?
  • Mathematics & Logic (Boolean Algebra)
  • Star alliance lounge at Luxembourg?
  • Does closedness of the image of unit sphere imply the closed range of the operator
  • 11 trees in 6 rows with 4 trees in each row
  • Job talk Q&A: handling the room vs. being respectful
  • Using 50 Ω coax cable instead of passive probe
  • Can player build dungeons in D&D? I thought that was just a job for the DM
  • How to prepare stack pointer for bare metal Rust?
  • Dual citizenship with USA & South Africa and exited South Africa on wrong passport (USA). What passport do I use to reenter SA?
  • D compiler download / installation
  • How can I power both sides of breaker box with two 120 volt battery backups?

set of problem solving operations in a computer

  • An Introduction to Data Structures and Algorithms
  • Programming Fundamentals
  • Problem Solving
  • Math Essentials
  • Data Structures
  • DSA Fundamentals
  • ▼Arrays
  • Array Data Structure
  • Array Coding Problems
  • More to come !

Problem-Solving Strategies: Decomposition, Logical Thinking, and Pseudocode

  • Problem Decomposition:

A problem-solving technique called problem decomposition involves breaking down a complex problem into smaller, more manageable parts. By dividing a problem into smaller components, it becomes easier to understand, solve, and implement. Problem decomposition is a fundamental skill in programming and computer science, allowing developers to approach complex tasks systematically.

Key components:

  • Identifying Subproblems:
  • Recognizing distinct and manageable components within a larger problem.
  • For a task like building a website, subproblems might include designing the user interface, implementing server-side functionality, and handling database interactions.
  • Defining Interfaces:
  • Establishing clear interfaces or interactions between different subproblems.
  • If designing a system with multiple modules, define how they communicate and share information.
  • Organizing Task Flow:
  • Determine the logical flow or sequence in which subproblems will be addressed.
  • In a software development project, deciding the order in which different features or functionalities will be implemented.
  • Reusability of components:
  • Identifying opportunities for reusing solutions or components across different parts of the problem.
  • Developing a library or utility function that can be applied in multiple subproblems.
  • Understand the problem:
  • Gain a comprehensive understanding of the overall problem and its requirements.
  • Identify the subproblems:
  • Break down the problem into smaller, more manageable tasks or subproblems.
  • Define interfaces:
  • Establish clear interfaces between different subproblems, specifying how they will interact.
  • Organize Task Flow:
  • Plan the logical flow or sequence of addressing subproblems.
  • Solve the subproblems:
  • Address each subproblem individually, implementing solutions or components.
  • Integrated Solutions:
  • Combine individual solutions to form a comprehensive solution for the entire problem.
  • Simplifies Complexity:
  • Breaking a complex problem into smaller parts simplifies the overall problem-solving process.
  • Modularity:
  • Encourages modular design, making it easier to develop, test, and maintain individual components.
  • Parallel development:
  • Enables parallel development, where different team members can work on distinct subproblems simultaneously.
  • Reusability:
  • Promotes reusable components, reducing redundancy and improving efficiency.

Understanding:

  • Identifying Subproblems: Recognizing distinct components within a larger problem.
  • Defining Interfaces: Establishing clear interactions between different subproblems.
  • Organizing Task Flow: Planning the logical sequence of addressing subproblems.
  • Reusability of Components: Identifying reuse opportunities.

Creating a website can be decomposed (broken down) into subproblems such as designing the user interface, implementing server-side functionality, and interacting with databases.

Logical Thinking:

Logical thinking is the ability to reason, analyze, and solve problems in a systematic and rational manner. It involves developing a clear and structured thought process to arrive at well-reasoned conclusions and solutions. Programming and problem-solving require logical thinking to create step-by-step solutions that address complex challenges.

  • Analytical Reasoning:
  • Ability to break down information, identify patterns, and draw logical conclusions.
  • Analyzing data to identify trends or correlations.
  • Breaking down complex problems into smaller, more manageable parts.
  • Dividing a software development project into distinct modules and addressing each module individually.
  • Algorithmic Thinking:
  • Developing an algorithmic approach to problem-solving, involving a sequence of well-defined steps.
  • Designing an algorithm to search for an element in a sorted list using binary search.
  • Pattern Recognition:
  • Identifying recurring structures or sequences in data.
  • Recognizing that a set of numbers follows an arithmetic ogression.
  • Sequential reasoning:
  • Creating step-by-step solutions or processes to accomplish a task.
  • Writing a program that performs a series of operations in a specific sequence.
  • Gain a clear understanding of the problem statement and requirements.
  • Analyze Information:
  • Analyze available information, identifying relevant details and patterns.
  • Breaking Down the Problem:
  • Decompose the problem into smaller, more manageable subproblems.
  • Algorithmic Design:
  • Develop an algorithmic solution, defining a sequence of steps to achieve the desired outcome.
  • Consider Edge Cases:
  • Anticipate and address edge cases or exceptional scenarios that may arise.
  • Evaluate Solutions:
  • Evaluate the proposed solution for logical consistency and effectiveness.
  • Efficient Problem-Solving:
  • Logical thinking enables efficient and effective problem-solving, reducing errors.
  • Structured Approach:
  • A structured and logical approach ensures well-organized and easy-to-follow solutions.
  • Improved Decision Making:
  • Logical thinking improves decision-making by considering various factors and potential outcomes.
  • Analytical Reasoning: Breaking down information and drawing logical conclusions.
  • Problem Decomposition: Breaking down complex problems into manageable parts.
  • Algorithmic Thinking: Designing step-by-step solutions using algorithms.
  • Pattern Recognition: Identifying recurring structures or sequences.
  • Sequential Reasoning: Creating step-by-step processes.

Pseudocode:

From Wikipedia, In computer science, pseudocode is a description of the steps in an algorithm using a mix of conventions of programming languages (like assignment operator, conditional operator, loop) with informal, usually self-explanatory, notation of actions and conditions. Pseudocode shares features with regular programming languages, but it is intended for human reading rather than machine control. Pseudocode typically omits details essential for machine implementation of the algorithm. Programming languages are augmented with natural language description details, where convenient, or with compact mathematical notation. Pseudocode is easier to understand than conventional programming language code, and it is an efficient and environment-independent description of the key principles of an algorithm. It is commonly used in textbooks and scientific publications to document algorithms and in the planning of software and other algorithms.

  • Structural conventions:
  • Definition: Pseudocode follows specific structural conventions to represent various programming constructs without adhering to a particular programming language's syntax.
  • Descriptive language:
  • Pseudocode uses plain language to describe operations, making it easy for both technical and non-technical individuals to understand.
  • Variables and Operations:
  • Pseudocode includes variable names and basic operations to convey the logic of the algorithm.
  • Control structures:
  • Pseudocode represents control structures such as loops and conditionals using familiar language constructs.
  • Problem Understanding:
  • Algorithm Design:
  • Develop the algorithmic steps necessary to solve the problem.
  • Pseudocode Writing:
  • Express the algorithm in pseudocode using plain language and recognized conventions.
  • Review and refine:
  • Review the pseudocode for clarity, correctness, and potential improvements.
  • Transition to Code:
  • Use the pseudocode as a guide to implement the algorithm in a specific programming language.
  • Clarity and Communication:
  • Pseudocode provides a clear and concise way to communicate algorithmic logic to team members or collaborators.
  • Language-Agnostic:
  • Pseudocode is not tied to the syntax of a specific programming language, making it accessible to individuals with various programming backgrounds.
  • Planning and visualization:
  • Writing pseudocode helps in planning the structure of the solution and visualizing the flow of the algorithm before actual coding.
  • Structural Conventions: Follow recognized structures for representing programming constructs.
  • Descriptive Language: Uses plain language to describe operations and logic.
  • Variables and Operations: Includes variable names and basic operations.
  • Control Structures: Represents control structures using familiar language constructs.

Follow us on Facebook and Twitter for latest update.

  • Weekly Trends and Language Statistics
  • School Guide
  • Class 8 Syllabus
  • Maths Notes Class 8
  • Science Notes Class 8
  • History Notes Class 8
  • Geography Notes Class 8
  • Civics Notes Class 8
  • NCERT Soln. Class 8 Maths
  • RD Sharma Soln. Class 8
  • Math Formulas Class 8

How to Use Algorithms to Solve Problems?

An algorithm is a process or set of rules which must be followed to complete a particular task. This is basically the step-by-step procedure to complete any task. All the tasks are followed a particular algorithm, from making a cup of tea to make high scalable software. This is the way to divide a task into several parts. If we draw an algorithm to complete a task then the task will be easier to complete.

The algorithm is used for,

  • To develop a framework for instructing computers.
  • Introduced notation of basic functions to perform basic tasks.
  • For defining and describing a big problem in small parts, so that it is very easy to execute.

Characteristics of Algorithm

  • An algorithm should be defined clearly.
  • An algorithm should produce at least one output.
  • An algorithm should have zero or more inputs.
  • An algorithm should be executed and finished in finite number of steps.
  • An algorithm should be basic and easy to perform.
  • Each step started with a specific indentation like, “Step-1”,
  • There must be “Start” as the first step and “End” as the last step of the algorithm.

Let’s take an example to make a cup of tea,

Step 1: Start

Step 2: Take some water in a bowl.

Step 3: Put the water on a gas burner .

Step 4: Turn on the gas burner 

Step 5: Wait for some time until the water is boiled.  

Step 6: Add some tea leaves to the water according to the requirement.

Step 7: Then again wait for some time until the water is getting colorful as tea.

Step 8: Then add some sugar according to taste.

Step 9: Again wait for some time until the sugar is melted.

Step 10: Turn off the gas burner and serve the tea in cups with biscuits.

Step 11: End

Here is an algorithm for making a cup of tea. This is the same for computer science problems.

There are some basics steps to make an algorithm:

  • Start – Start the algorithm
  • Input – Take the input for values in which the algorithm will execute.
  • Conditions – Perform some conditions on the inputs to get the desired output.
  • Output – Printing the outputs.
  • End – End the execution.

Let’s take some examples of algorithms for computer science problems.

Example 1. Swap two numbers with a third variable  

Step 1: Start Step 2: Take 2 numbers as input. Step 3: Declare another variable as “temp”. Step 4: Store the first variable to “temp”. Step 5: Store the second variable to the First variable. Step 6: Store the “temp” variable to the 2nd variable. Step 7: Print the First and second variables. Step 8: End

Example 2. Find the area of a rectangle

Step 1: Start Step 2: Take the Height and Width of the rectangle as input. Step 3: Declare a variable as “area” Step 4: Multiply Height and Width Step 5: Store the multiplication to “Area”, (its look like area = Height x Width) Step 6: Print “area”; Step 7: End

Example 3. Find the greatest between 3 numbers.

Step 1: Start Step 2: Take 3 numbers as input, say A, B, and C. Step 3: Check if(A>B and A>C) Step 4: Then A is greater Step 5: Print A Step 6 : Else Step 7: Check if(B>A and B>C) Step 8: Then B is greater Step 9: Print B Step 10: Else C is greater Step 11 : Print C Step 12: End

Advantages of Algorithm

  • An algorithm uses a definite procedure.
  • It is easy to understand because it is a step-by-step definition.
  • The algorithm is easy to debug if there is any error happens.
  • It is not dependent on any programming language
  • It is easier for a programmer to convert it into an actual program because the algorithm divides a problem into smaller parts.

Disadvantages of Algorithms

  • An algorithm is Time-consuming, there is specific time complexity for different algorithms.
  • Large tasks are difficult to solve in Algorithms because the time complexity may be higher, so programmers have to find a good efficient way to solve that task.
  • Looping and branching are difficult to define in algorithms.

Please Login to comment...

Similar reads.

  • School Learning
  • School Programming

Improve your Coding Skills with Practice

 alt=

What kind of Experience do you want to share?

 alt=

  • Undergraduate
  • Postdoctoral Programs
  • Future Engineers
  • Professional Education
  • Open Access
  • Global Experiences
  • Student Activities
  • Leadership Development
  • Graduate Student Fellowships
  • Aeronautics and Astronautics
  • Biological Engineering
  • Chemical Engineering
  • Civil and Environmental Engineering
  • Electrical Engineering and Computer Science
  • Institute for Medical Engineering and Science
  • Materials Science and Engineering
  • Mechanical Engineering
  • Nuclear Science and Engineering
  • Industry Collaborations
  • Engineering in Action
  • In The News
  • Video Features
  • Newsletter: The Infinite
  • Ask an Engineer
  • Facts and Figures
  • Diversity, Equity & Inclusion
  • Staff Spotlights
  • Commencement 2024

Ask An Engineer

How do computers perform complex mathematical operations?

Related Questions

  • Can a computer generate a truly random number?
  • Is chaos an actual state, or just a name for rules we haven’t discovered yet?
  • Can we use artificial intelligence to generate new ideas?
  • Why is speed at sea measured in knots?
  • When will AI be smart enough to outsmart people?
  • How did people in the olden days create software without any programming software?
  • Does the outside edge of a ceiling fan blade move faster than the inside edge?
  • Is computer software always a step ahead of hardware?
  • How can I tell if a certain tree is big enough to support a 30-foot zip line?
  • How were we able to navigate from the Earth to the Moon with such precision?

How do computers perform complex mathematical operations?

One small step at a time (but very, very quickly)…

Computers perform dazzlingly complex tasks, but the microprocessor chips inside them are only capable of performing very basic mathematical operations, such as adding and comparing binary numbers. Utilizing this limited toolset to perform calculus and other advanced mathematical operations was a signal achievement of the early days of electronic computing. Institute professor and former dean of engineering Joel Moses was part of that revolutionary effort, and explains that the solution lay in breaking down large and complex problems into smaller and simpler ones.

Complex math requires the handling of two types of operations:  numerical  ones that involve specific numerical values, and  symbolic ones, such as those in algebra and calculus, that involve symbols like “x” and “y.”

Moses notes that numerical operations can be broken into addition, subtraction, multiplication, and division, which are bread-and-butter tasks for a microprocessor. To accommodate a wider range of numerical values without overwhelming memory and processing resources, computers use the floating-point system, replacing common numbers (say, 1,300,000) with floating-point values (say, 1.3 x 106). This approach usually produces only an approximation of the result, but with some care it renders values extremely close to the “correct” answer. (One notable exception: some Intel Pentium chips in the early 1990s had a floating-point bug that in rare cases caused incorrect calculations.)

Symbolic operations are a bigger challenge. “The first problem,” explains Moses, “is how to represent symbols using only the 0s and 1s available in a binary computer. This is done with coding, where ‘x’ is represented by one number and ‘y’ by another.” The computer hardware and software understands these as codes, rather than numerical values. More complex expressions can be represented via a decomposition of expressions into simpler parts, which are connected by pointers in the computer’s memory. This allows representation and processing of expressions such as “x + 2y.”

For example, a differentiation can be reduced into steps that differentiate simpler expressions. The results of such differentiated expressions can be represented as sums, products, constants, and variables. The ultimate result is a procedure that incorporates a complete differentiation algorithm but uses only computer-friendly numbers and functions. Other operations, such as symbolic integration, can be even more complex, but the basic concept is usually the same: reduce the complex problem into simpler ones, and compute.

While these procedures can be lengthy and sometimes time-consuming, today’s microprocessors are so powerful that they make short work of them by performing billions operations per second.

More information on this topic is available in the textbook  Structure and Interpretation of Computer Programs,  available online from MIT Press.

Posted: November 16, 2010

 alt=

Purdue Mitchell E. Daniels, Jr. School of Business logo

Effective Problem-Solving Techniques in Business

Problem solving is an increasingly important soft skill for those in business. The Future of Jobs Survey by the World Economic Forum drives this point home. According to this report, complex problem solving is identified as one of the top 15 skills that will be sought by employers in 2025, along with other soft skills such as analytical thinking, creativity and leadership.

Dr. Amy David , clinical associate professor of management for supply chain and operations management, spoke about business problem-solving methods and how the Purdue University Online MBA program prepares students to be business decision-makers.

Why Are Problem-Solving Skills Essential in Leadership Roles?

Every business will face challenges at some point. Those that are successful will have people in place who can identify and solve problems before the damage is done.

“The business world is constantly changing, and companies need to be able to adapt well in order to produce good results and meet the needs of their customers,” David says. “They also need to keep in mind the triple bottom line of ‘people, profit and planet.’ And these priorities are constantly evolving.”

To that end, David says people in management or leadership need to be able to handle new situations, something that may be outside the scope of their everyday work.

“The name of the game these days is change—and the speed of change—and that means solving new problems on a daily basis,” she says.

The pace of information and technology has also empowered the customer in a new way that provides challenges—or opportunities—for businesses to respond.

“Our customers have a lot more information and a lot more power,” she says. “If you think about somebody having an unhappy experience and tweeting about it, that’s very different from maybe 15 years ago. Back then, if you had a bad experience with a product, you might grumble about it to one or two people.”

David says that this reality changes how quickly organizations need to react and respond to their customers. And taking prompt and decisive action requires solid problem-solving skills.

What Are Some of the Most Effective Problem-Solving Methods?

David says there are a few things to consider when encountering a challenge in business.

“When faced with a problem, are we talking about something that is broad and affects a lot of people? Or is it something that affects a select few? Depending on the issue and situation, you’ll need to use different types of problem-solving strategies,” she says.

Using Techniques

There are a number of techniques that businesses use to problem solve. These can include:

  • Five Whys : This approach is helpful when the problem at hand is clear but the underlying causes are less so. By asking “Why?” five times, the final answer should get at the potential root of the problem and perhaps yield a solution.
  • Gap Analysis : Companies use gap analyses to compare current performance with expected or desired performance, which will help a company determine how to use its resources differently or adjust expectations.
  • Gemba Walk : The name, which is derived from a Japanese word meaning “the real place,” refers to a commonly used technique that allows managers to see what works (and what doesn’t) from the ground up. This is an opportunity for managers to focus on the fundamental elements of the process, identify where the value stream is and determine areas that could use improvement.
  • Porter’s Five Forces : Developed by Harvard Business School professor Michael E. Porter, applying the Five Forces is a way for companies to identify competitors for their business or services, and determine how the organization can adjust to stay ahead of the game.
  • Six Thinking Hats : In his book of the same name, Dr. Edward de Bono details this method that encourages parallel thinking and attempting to solve a problem by trying on different “thinking hats.” Each color hat signifies a different approach that can be utilized in the problem-solving process, ranging from logic to feelings to creativity and beyond. This method allows organizations to view problems from different angles and perspectives.
  • SWOT Analysis : This common strategic planning and management tool helps businesses identify strengths, weaknesses, opportunities and threats (SWOT).

“We have a lot of these different tools,” David says. “Which one to use when is going to be dependent on the problem itself, the level of the stakeholders, the number of different stakeholder groups and so on.”

Each of the techniques outlined above uses the same core steps of problem solving:

  • Identify and define the problem
  • Consider possible solutions
  • Evaluate options
  • Choose the best solution
  • Implement the solution
  • Evaluate the outcome

Data drives a lot of daily decisions in business and beyond. Analytics have also been deployed to problem solve.

“We have specific classes around storytelling with data and how you convince your audience to understand what the data is,” David says. “Your audience has to trust the data, and only then can you use it for real decision-making.”

Data can be a powerful tool for identifying larger trends and making informed decisions when it’s clearly understood and communicated. It’s also vital for performance monitoring and optimization.

How Is Problem Solving Prioritized in Purdue’s Online MBA?

The courses in the Purdue Online MBA program teach problem-solving methods to students, keeping them up to date with the latest techniques and allowing them to apply their knowledge to business-related scenarios.

“I can give you a model or a tool, but most of the time, a real-world situation is going to be a lot messier and more valuable than what we’ve seen in a textbook,” David says. “Asking students to take what they know and apply it to a case where there’s not one single correct answer is a big part of the learning experience.”

Make Your Own Decision to Further Your Career

An online MBA from Purdue University can help advance your career by teaching you problem-solving skills, decision-making strategies and more. Reach out today to learn more about earning an online MBA with Purdue University .

If you would like to receive more information about pursuing a business master’s at the Mitchell E. Daniels, Jr. School of Business, please fill out the form and a program specialist will be in touch!

Connect With Us

Javatpoint Logo

  • Data Structure
  • Design Pattern

DS Tutorial

Ds linked list, ds searching, differences.

JavaTpoint

An algorithm is a process or a set of rules required to perform calculations or some other problem-solving operations especially by a computer. The formal definition of an algorithm is that it contains the finite set of instructions which are being carried in a specific order to perform the specific task. It is not the complete program or code; it is just a solution (logic) of a problem, which can be represented either as an informal description using a Flowchart or Pseudocode.

An algorithm has some input values. We can pass 0 or some input value to an algorithm. We will get 1 or more output at the end of an algorithm. An algorithm should be unambiguous which means that the instructions in an algorithm should be clear and simple. An algorithm should have finiteness. Here, finiteness means that the algorithm should contain a limited number of instructions, i.e., the instructions should be countable. An algorithm should be effective as each instruction in an algorithm affects the overall process. An algorithm must be language-independent so that the instructions in an algorithm can be implemented in any of the languages with the same output. A problem can be a real-world problem or any instance from the real-world problem for which we need to create a program or the set of instructions. The set of instructions is known as an algorithm. An algorithm will be designed for a problem which is a step by step procedure. After designing an algorithm, the required and the desired inputs are provided to the algorithm. The input will be given to the processing unit, and the processing unit will produce the desired output. The output is the outcome or the result of the program.

It helps us to understand the scalability. When we have a big real-world problem, we need to scale it down into small-small steps to easily analyze the problem. The real-world is not easily broken down into smaller steps. If the problem can be easily broken into smaller steps means that the problem is feasible.

Let's understand the algorithm through a real-world example. Suppose we want to make a lemon juice, so following are the steps required to make a lemon juice:

Step 1: First, we will cut the lemon into half.

Step 2: Squeeze the lemon as much you can and take out its juice in a container.

Step 3: Add two tablespoon sugar in it.

Step 4: Stir the container until the sugar gets dissolved.

Step 5: When sugar gets dissolved, add some water and ice in it.

Step 6: Store the juice in a fridge for 5 to minutes.

Step 7: Now, it's ready to drink.

The above real-world can be directly compared to the definition of the algorithm. We cannot perform the step 3 before the step 2, we need to follow the specific order to make lemon juice. An algorithm also says that each and every instruction should be followed in a specific order to perform a specific task.

Now we will look an example of an algorithm in programming.

We will write an algorithm to add two numbers entered by the user.

Step 1: Start

Step 2: Declare three variables a, b, and sum.

Step 3: Enter the values of a and b.

Step 4: Add the values of a and b and store the result in the sum variable, i.e., sum=a+b.

Step 5: Print sum

Step 6: Stop

If any problem is given and we can break that problem into small-small modules or small-small steps, which is a basic definition of an algorithm, it means that this feature has been perfectly designed for the algorithm. The correctness of an algorithm is defined as when the given inputs produce the desired output, which means that the algorithm has been designed algorithm. The analysis of an algorithm has been done correctly. Here, maintainability means that the algorithm should be designed in a very simple structured way so that when we redefine the algorithm, no major change will be done in the algorithm. It considers various logical steps to solve the real-world problem. Robustness means that how an algorithm can clearly define our problem. If the algorithm is not user-friendly, then the designer will not be able to explain it to the programmer. If the algorithm is simple then it is easy to understand. If any other algorithm designer or programmer wants to use your algorithm then it should be extensible. When any real-world problem is given to us and we break the problem into small-small modules. To break down the problem, we should know all the theoretical aspects. As we know that theory cannot be completed without the practical implementation. So, the importance of algorithm can be considered as both theoretical and practical.

As we know that an algorithm is a step-by-step procedure so we must follow some steps to design an algorithm.

The general logic structure is applied to design an algorithm. It is also known as an exhaustive search algorithm that searches all the possibilities to provide the required solution. Such algorithms are of two types: Finding all the solutions of a problem and then take out the best solution or if the value of the best solution is known then it will terminate if the best solution is known. As soon as the best solution is found, then it will stop. It is a very implementation of an algorithm. It allows you to design an algorithm in a step-by-step variation. It breaks down the algorithm to solve the problem in different methods. It allows you to break down the problem into different methods, and valid output is produced for the valid input. This valid output is passed to some other function. It is an algorithm paradigm that makes an optimal choice on each iteration with the hope of getting the best solution. It is easy to implement and has a faster execution time. But, there are very rare cases in which it provides the optimal solution. It makes the algorithm more efficient by storing the intermediate results. It follows five different steps to find the optimal solution for the problem: The branch and bound algorithm can be applied to only integer programming problems. This approach divides all the sets of feasible solutions into smaller subsets. These subsets are further evaluated to find the best solution. As we have seen in a regular algorithm, we have predefined input and required output. Those algorithms that have some defined set of inputs and required output, and follow some described steps are known as deterministic algorithms. What happens that when the random variable is introduced in the randomized algorithm?. In a randomized algorithm, some random bits are introduced by the algorithm and added in the input to produce the output, which is random in nature. Randomized algorithms are simpler and efficient than the deterministic algorithm. Backtracking is an algorithmic technique that solves the problem recursively and removes the solution if it does not satisfy the constraints of a problem.

The major categories of algorithms are given below:

Algorithm developed for sorting the items in a certain order. Algorithm developed for searching the items inside a data structure. Algorithm developed for deleting the existing element from the data structure. Algorithm developed for inserting an item inside a data structure. Algorithm developed for updating the existing element inside a data structure.

The algorithm can be analyzed in two levels, i.e., first is before creating the algorithm, and second is after creating the algorithm. The following are the two analysis of an algorithm:

The performance of the algorithm can be measured in two factors:

The time complexity of an algorithm is the amount of time required to complete the execution. The time complexity of an algorithm is denoted by the big O notation. Here, big O notation is the asymptotic notation to represent the time complexity. The time complexity is mainly calculated by counting the number of steps to finish the execution. Let's understand the time complexity through an example.

In the above code, the time complexity of the loop statement will be atleast n, and if the value of n increases, then the time complexity also increases. While the complexity of the code, i.e., return sum will be constant as its value is not dependent on the value of n and will provide the result in one step only. We generally consider the worst-time complexity as it is the maximum time taken for any given input size.

An algorithm's space complexity is the amount of space required to solve a problem and produce an output. Similar to the time complexity, space complexity is also expressed in big O notation.

For an algorithm, the space is required for the following purposes:

Auxiliary space: The extra space required by the algorithm, excluding the input size, is known as an auxiliary space. The space complexity considers both the spaces, i.e., auxiliary space, and space used by the input.

So,

On each day, we search for something in our day to day life. Similarly, with the case of computer, huge data is stored in a computer that whenever the user asks for any data then the computer searches for that data in the memory and provides that data to the user. There are mainly two techniques available to search the data in an array:

Linear search is a very simple algorithm that starts searching for an element or a value from the beginning of an array until the required element is not found. It compares the element to be searched with all the elements in an array, if the match is found, then it returns the index of the element else it returns -1. This algorithm can be implemented on the unsorted list.

A Binary algorithm is the simplest algorithm that searches the element very quickly. It is used to search the element from the sorted list. The elements must be stored in sequential order or the sorted manner to implement the binary algorithm. Binary search cannot be implemented if the elements are stored in a random manner. It is used to find the middle element of the list.

Sorting algorithms are used to rearrange the elements in an array or a given data structure either in an ascending or descending order. The comparison operator decides the new order of the elements.





Youtube

  • Send your Feedback to [email protected]

Help Others, Please Share

facebook

Learn Latest Tutorials

Splunk tutorial

Transact-SQL

Tumblr tutorial

Reinforcement Learning

R Programming tutorial

R Programming

RxJS tutorial

React Native

Python Design Patterns

Python Design Patterns

Python Pillow tutorial

Python Pillow

Python Turtle tutorial

Python Turtle

Keras tutorial

Preparation

Aptitude

Verbal Ability

Interview Questions

Interview Questions

Company Interview Questions

Company Questions

Trending Technologies

Artificial Intelligence

Artificial Intelligence

AWS Tutorial

Cloud Computing

Hadoop tutorial

Data Science

Angular 7 Tutorial

Machine Learning

DevOps Tutorial

B.Tech / MCA

DBMS tutorial

Data Structures

DAA tutorial

Operating System

Computer Network tutorial

Computer Network

Compiler Design tutorial

Compiler Design

Computer Organization and Architecture

Computer Organization

Discrete Mathematics Tutorial

Discrete Mathematics

Ethical Hacking

Ethical Hacking

Computer Graphics Tutorial

Computer Graphics

Software Engineering

Software Engineering

html tutorial

Web Technology

Cyber Security tutorial

Cyber Security

Automata Tutorial

C Programming

C++ tutorial

Control System

Data Mining Tutorial

Data Mining

Data Warehouse Tutorial

Data Warehouse

RSS Feed

IMAGES

  1. Computer Problem Solving from C.Itoi

    set of problem solving operations in a computer

  2. UNIT 1: How to Think Like an Engineer.

    set of problem solving operations in a computer

  3. 6 Ways to Improve Your Programming Problem Solving

    set of problem solving operations in a computer

  4. Problem Solving

    set of problem solving operations in a computer

  5. Introduction To Problem Solving In Computer Science Ppt

    set of problem solving operations in a computer

  6. Problem Solving Process in Computers

    set of problem solving operations in a computer

VIDEO

  1. F.Y.B.Sc.(C.S.)|Sem-I |CS-111: Problem Solving using Computer and C Programming

  2. Set Operations Solved Examples

  3. Basic Operations of Computer, Class: 9th, Computer Science, Chapter: 1 by Leaders Knowledge Hub

  4. Replacement Problem Solving

  5. Computer Basics: A Beginner's Guide to Operating a Computer

  6. OPERATING SYSTEM (Lecture 3)

COMMENTS

  1. A set of problem-solving operations in a computer

    Please find below the answer for A set of problem-solving operations in a computer. CodyCross is one of the most popular games which is available for both iOS and Android. This crossword clue belongs to CodyCross Rainforest Group 1212 Puzzle 3. The answer we have below for A set of problem-solving operations in a computer has a total of 9 letters.

  2. What Is an Algorithm?

    An algorithm is a sequence of instructions that a computer must perform to solve a well-defined problem. It essentially defines what the computer needs to do and how to do it. Algorithms can instruct a computer how to perform a calculation, process data, or make a decision. The best way to understand an algorithm is to think of it as a recipe ...

  3. 4. Problem Solving and Algorithms

    The development of an algorithm (a plan) is a key step in solving a problem. Once we have an algorithm, we can translate it into a computer program in some programming language. Our algorithm development process consists of five major steps. Step 1: Obtain a description of the problem. Step 2: Analyze the problem.

  4. What is an Algorithm? Algorithm Definition for Computer Science Beginners

    An algorithm is a set of steps for solving a known problem. Most algorithms are implemented to run following the four steps below: Some steps of the algorithm may run repeatedly, but in the end, termination is what ends an algorithm. For example, the algorithm below sort numbers in descending order.

  5. What Is An Algorithm? [Everything to know]

    An algorithm is a set of commands that must be followed for a computer to perform calculations or other problem-solving operations.According to its formal definition, an algorithm is a finite set of instructions carried out in a specific order to perform a particular task. It is not the entire program or code; it is simple logic to a problem ...

  6. Understanding Algorithms: The Key to Problem-Solving Mastery

    At its core, an algorithm is a systematic, step-by-step procedure or set of rules designed to solve a problem or perform a specific task. It provides clear instructions that, when followed meticulously, lead to the desired outcome. Consider an algorithm to be akin to a recipe for your favorite dish.

  7. Discover how computers solve problems

    Computers can't actually think, but they can perform billions of logical operations per second. These logical operations are written by us and provide the computer with the instructions needed to perform the problem-solving. This means you need to think like a computer and translate what you need it to do into program instructions it understands.

  8. Algorithms

    "A process or set of rules to be followed in calculations or other problem-solving operations, especially by a computer." It is a series of STEPS that can be followed PRECISELY (very slowly by us humans, and VERY RAPIDLY by computers) - eventually this will lead us to what we want.

  9. Problems, Solutions, and Algorithms

    What is an Algorithm a process or set of rules to be followed in calculations or other problem-solving operations, especially by a computer. Incremental solutions (linear) Iterative solutions (spirals) Building a full "slice" "Half a product not a half-assed product" An Iterative Process

  10. The Role of Algorithms in Computing

    1.Data processing: Algorithms are used to process and analyze large amounts of data, such as sorting and searching algorithms. 2.Problem solving: Algorithms are used to solve computational problems, such as mathematical problems, optimization problems, and decision-making problems. 3.Computer graphics: Algorithms are used to create and process ...

  11. Introduction to Algorithms

    algorithm. n. a process or set of rules to be followed in calculations or other problem-solving operations. When we make a program, all we are doing is writing a set of instructions for computer to follow. These instructions, of course, must be perfect — they have to be simple enough for a computer to follow, since computers only know so much ...

  12. What is an Algorithm?

    In computer programming terms, an algorithm is a set of well-defined instructions to solve a particular problem. It takes a set of input (s) and produces the desired output. For example, An algorithm to add two numbers: Take two number inputs. Add numbers using the + operator. Display the result.

  13. PDF Introduction to Problem Solving

    Key steps required for solving a problem using a computer are shown in Figure 4.1 and are discussed in following subsections. ... Figure 4.1: Steps for problem solving Algorithm A set of exact steps which when followed, solve the problem or accomplish the required task. Ch 4.indd 62 08-Apr-19 12:34:19 PM

  14. 21 principles for systematically solving problems in computer ...

    Redefine the problem. 4. Relax one assumption at a time from the problem statement (to make the problem easier) Many problems are too hard to solve on their own. However, by solving a easier ...

  15. Computer Program vs. Algorithm

    An algorithm is a self-contained step-by-step set of operations to be performed to solve a specific problem or a class of problems. A computer program is a sequence of instructions that comply the rules of a specific programming language , written to perform a specified task with a computer. Algorithms are general and have to be translated into ...

  16. DSA

    A problem-solving technique called problem decomposition involves breaking down a complex problem into smaller, more manageable parts. By dividing a problem into smaller components, it becomes easier to understand, solve, and implement. Problem decomposition is a fundamental skill in programming and computer science, allowing developers to ...

  17. How to Use Algorithms to Solve Problems?

    End - End the execution. Let's take some examples of algorithms for computer science problems. Example 1. Swap two numbers with a third variable. Step 1: Start. Step 2: Take 2 numbers as input. Step 3: Declare another variable as "temp". Step 4: Store the first variable to "temp". Step 5: Store the second variable to the First variable.

  18. Algorithms cheat-sheet

    Algorithm is a process or a set of rules to be followed in calculations or other problem solving operations, especially by a computer. Rather than just consulting to the solution of any real world problem, algorithm is also concerned with efficiency of the solution regarding time, resource (memory) and efforts (operations).

  19. PDF Intro to Python and Computer Science

    Syllabus. Week 1: Intro to CS, Setting up IDE, print hello world, and data types. Week 2:More Data Types and Standard Python library. Week 3: Logic: Booleans, Control Flow. Week 4: Lists and Dictionaries. Week 5: User input and Loops. Week 6: Nested data and nested loops. Week 7: Functions, Importing and Modular Code. Week 8: File Input/Output.

  20. PDF CSC 171

    Computer Programming Lecture #5 - Algorithms and Program Development What is an Algorithm? •Process or a set of rules to be followed in calculations or other problem-solving operations more informally a recipe for solving a problem. 2 Example : Square Root Algorithm 1. Guess the square root of the number

  21. Computational Thinking: How computers think, decide and learn ...

    In one dictionary's definition, an algorithm is a "process or set of rules to be followed in calculations or other problem-solving operations, especially by a computer."

  22. MIT School of Engineering

    Complex math requires the handling of two types of operations: numerical ones that involve specific numerical values, and symbolic ones, such as those in algebra and calculus, that involve symbols like "x" and "y.". Moses notes that numerical operations can be broken into addition, subtraction, multiplication, and division, which are ...

  23. Effective Problem-Solving Techniques in Business

    Problem solving is an increasingly important soft skill for those in business. The Future of Jobs Survey by the World Economic Forum drives this point home. According to this report, complex problem solving is identified as one of the top 15 skills that will be sought by employers in 2025, along with other soft skills such as analytical thinking, creativity and leadership.

  24. Algorithm (Data Structures)

    An algorithm is a process or a set of rules required to perform calculations or some other problem-solving operations especially by a computer. The formal definition of an algorithm is that it contains the finite set of instructions which are being carried in a specific order to perform the specific task.