Algorithms, flowcharts, and pseudocode. ¶

Overview, objectives, and key terms ¶.

In this lesson, we’ll dive right into the basic logic needed to plan one’s program, significantly extending the process identified in Lesson 2 . We’ll examine algorithms for several applications and illustrate solutions using flowcharts and pseudocode . Along the way, we’ll see for the first time the three principal structures in programming logic: sequence , selection , and iteration . Throughout, specialized syntax (Python or otherwise) is avoided (with the exception of the handy slicing syntax introduced in Lesson 3 ), but variables and simple operators are used.

Objectives ¶

By the end of this lesson, you should be able to

  • define what an algorithm is
  • decompose problems into a sequence of simple steps
  • illustrate those steps graphically using flowcharts
  • describe those steps in words using pseudocode

Key Terms ¶

  • counter variable
  • index variable
  • conditional statement

Algorithms ¶

An algorithm is procedure by which a problem (computational or otherwise) is solved following a certain set of rules. In many computer science departments, entire courses are dedicated to the study of algorithms important for solving a wide variety of problems. Some of the most important algorithms (including a few that we’ll be studying in part throughout the semester) are

  • Gaussian elimination (for solving \(\mathbf{Ax}=\mathbf{b}\) )
  • Bubble sort (for sorting an array of values)
  • Quicksort (a better way to sort those same values)
  • Sieve of Eratosthenes (for finding prime numbers)
  • Babylonian method (for finding square roots)
  • Linear search (for finding a value in an array)
  • Binary search (a better way for finding that value)
  • Dijkstra’s algorithm (for finding, e.g., the shortest path between two cities)
  • RSA algorithm (for encrypting and decrypting messages)

Many more such algorithms are listed elsewhere .

It turns out, however, that we apply algorithms all the time in every-day life, often without realizing it. Such occasions might be as boring as choosing one’s outfit for the day based on planned activities, the weather, the general status of laundry (and how many times you think you can wear that pair of jeans), etc. Other occasions of somewhat more importance might include choosing a baby’s name (which might mean making a list, whittling it down, and then convincing your wife that Linus is the one not just because that’s the name of the Finnish-born inventor of Linux). The list goes on and on: life presents problems, and we apply logic to solve those problems.

Sequence by Example: Computing Grades ¶

Let’s consider something with which you are all familiar: a course grading scheme. As a concrete example, suppose the course in question has graded tasks in four categories, each with its own weight:

  • homework - 20%
  • laboratories - 10%
  • quizzes - 10%
  • examinations - 60%

Such a scheme is probably familiar, and you’ve probably used your intuition, knowledge of your grades, and knowledge of this sort of weighting scheme to compute a final percentage. Here, we’ll formalize that process using flowcharts and pseudocode.

To simplify matters somewhat (for now), assume that there are a fixed number of tasks in each category, and each task within a category is worth the same amount. For example, the course might have 5 homework assignments, and each of these assignments might be assessed out of ten points. Take those scores to be 10, 7, 9, 10, and 10.

You might immediately see how the computation of a homework percentage can be broken into several independent steps. For instance, we can first compute the homework score. How? Think carefully. If you were using a calculator, what would you enter? On mine, I can enter 10 followed by a + and then 7 and then another + . After every addition + , it prints out the running total. In other words, it’s automatically storing the running total.

We can be more explicit, though. Before we add any of the scores at all, we can set the total score to zero, and thereafter, we can add each of the homework scores to that total in sequence . When that’s done, we need to compute the total possible score, which is the number of tasks multiplied by the point value per task. Finally, we need to compute the percentage earned on these homework assignments, which is equal to the total homework score divided by the total number of points possible (and then multiplied by 100).

This entire process can be described using pseudocode , which is any informal, high-level (few details) language used to describe a program, algorithm, procedure, or anything else with well-defined steps. There is no official syntax for pseudocode, but usually it is much closer to regular English than computer programming languages like Python. Here is one possible pseudocode representation of the procedure just outlined for computing the homework score:

Of course, this might seem long-winded, but it is explicit . As long as the input and output processes are specified (e.g., providing a printout of grades and asking for a final value to be written on that printout), this procedure could be given to most reasonable people and executed without difficulty. For reference, the total homework score (in percent) that one should get from the individual scores above is 92.

Exercise : For each line of the pseudocode above, write the value of total_score , total_possible , and hw_percent . If a variable does not have a value at a particular line, then say it is undefined .

A flowchart of the same procedure is provided below.

Flowchart for Computing Homework Percentage

Flowchart for Computing Homework Percentage

Now, revisit the bolded word above: sequence . This particular process for computing the homework percentage is a sequence , which is the simplest of the logical structures used in programming. A sequence is nothing more than a set of instructions executed one after another. The number of these instructions and the order in which they are executed is known from the start, just like our example here (and the example seen in Lesson 2 ).

Selection ¶

The same sort of procedure can be used for all of the grading categories, and hence, let us assume now that we have available the final percentages for homework, laboratories, quizzes, and homeworks. The question now is how to assign a final letter grade based, for example, on the traditional 90/80/70/60 scheme for A/B/C/D. For this grading scheme, anything 90% or higher earns an A, anything less than 90% but greater than or equal to 80% earns a B, and so forth.

Of course, this requires that we first compute the final grade, for which the final percentages and the corresponding category weights are required. In pseudocode, that process can be done via

What we need next is to define the grade, and that’s where selection enters the game. Selection refers to a structure that allows certain statements to be executed preferentially based on some condition . Hence, selection is often implemented using conditional statements . In English, a basic conditional statement takes the form If some condition is satisfied, then do something . More complicated statements can be formed, but all conditional statements can be rewritten using one or more of these simple statements.

A basic conditional statement can be represented graphically as shown below.

Flowchart fragment for a simple conditional statement

Flowchart fragment for a simple conditional statement

Armed with conditional statements for selection, we can tackle the final grade. Given the final percentage, we check whether that value is greater than 90. If so, the grade assigned is an A. If not, we can further check whether that percentage is greater than or equal to 80 and less than 90. If so, a B. If not, we check against 70 and then 60 for a C and D, respectively. If the percentage has not earned a D by the time we’ve checked, our poor student’s grade, of course, is an F.

This procedure, much like those described previously, can be described compactly in pseudocode:

As a flowchart, this same procedure is shown below.

Flowchart for computing the final grade

Flowchart for computing the final grade

Iteration ¶

Suppose that the homework grades analyzed above are subjected to a slight policy change: the lowest score is dropped. Such a policy is pretty common. How do we tackle this problem? It requires that we make a decision when adding a particular homework score to the total. In particularly, we skip adding the lowest score.

Exercise : Think back to the scores (i.e., 10, 7, 9, 10, and 10). Now, pick out the lowest score and, importantly , write down how you came to that conclusion. Seriously—think about what you needed to do to choose the lowest number and get it down in words.

When I first glance at the numbers, I see that there are some 10’s and other numbers, and scanning left to right, I pick out 7 as being the lowest of them. Then, keeping track of 7 (subconsciously, in this case), I scan the list and confirm that 7 is, in fact, the lowest score. I’ll bet you do something similar, but computers don’t have eyes (or a subconscience), and we therefore need to define this a bit more carefully.

The Basic Idea ¶

To start, let’s assume that the individual homework grades are stored in an array (e.g., a NumPy ndarray ) rather than as separate values. Call this array hw_scores so that we use, e.g., hw_scores[0] and hw_scores[1] instead of hw_1_score and hw_2_score . From this array, we need to pick out which element represents the score to be dropped. Therefore, we need language to describe the process of iterating through the array elements, i.e., iteration . In English, we might say something like “for each score in the array, do something.” More generically, iteration consists of doing that something until some condition is no longer satisfied, as illustrated in the flowchart fragment below:

Flowchart fragment for a simple loop

Flowchart fragment for a simple loop

Notice that this flowchart bears a striking similarity to the one shown above for the conditional statement. The difference, however, is that the flow of the program is redirected to before the condition block. In other words, a repeating loop is produced that is broken only if the condition is no longer because of changes made inside the “do something” block. The pseudocode fragment for this same loop is

Let’s apply this to a simple but illustrative problem before moving on to our homework application. Suppose we want to print every value in an array a of length n . A canonical approach to this sort of problem starts by defining an index or counter variable (often named i ) that is used to access the i th element of the array during the i th time through the loop. After the i th element has been used, the counter is increased by one, and the loop begins again. Once the counter is equal to the number of elements in the array, the loop is terminated. Here’s the complete algorithm in pseudocode

and as a flowchart

Flowchart for printing the elements of an array

Flowchart for printing the elements of an array

Back to Homework ¶

For our homework example, the condition is “have all the scores been considered?”, while the “something” to be done is checking whether or not a given score is lower than the others. The counter-based approach to iteration developed above can be used to go through each element of the homework score array, thereby ensuring that all the elements are considered. We could compare the i th grade to every other grade (implying an iteration within an iteration), but there is a simpler way. First, we can set the lowest score equal to the first grade (i.e., hw_grades[0] ). Then, we can go through all the other scores and compare each to the lowest score. If a score is lower than the current value of lowest score, that score becomes the lowest score. Along the way, we can also keep track of the index (location) of the lowest score within the array. Here’s the idea in pseudocode:

Here it is also as a flow chart:

Flowchart for finding the lowest grade

Flowchart for finding the lowest grade

Putting It All Together ¶

By now, we have all the pieces needed to compute the total homework percentage when the lowest score is dropped. Here it is, all together, in pseudocode:

Practice Problems ¶

Planning out the logic needed to solve problems can be tricky, and most students require lots of practice. Each of the topics discussed above will be the focus of the next several lessons as we dive into their implementation in Python. However, now is the time to start applying the sequence, selection, and iteration constructs, and listed below are several great practice problems to help get you started.

Develop an algorithm for each of the following tasks using both pseudocode and a flowchart . Note, many of these tasks represent great practice problems for Python programs, too. Of course, if you plan out the logic first using the tools employed in this lesson, the implementation of your solution in Python later on should be much easier!

  • Prepare a pot of coffee.
  • Prepare a cup of coffee for your friend. (Cream or sugar?)
  • String a guitar.
  • Choose your outfit (making sure to account for the day of the week and the weather).
  • Determine the largest number in an array.
  • Determine the second largest number in an array.
  • Determine whether an integer is even.
  • Determine whether an integer is prime .
  • Determine whether a given year is a leap year .
  • Determine the next leap year after a given year.
  • Divide one number by another number using long division
  • Determine the sum of an array of numbers.
  • Determine the sum of the elements of an array of numbers that are divisible by 3 and 5.
  • Given any two integers n and d , determine whether the quotient n/d leads to a finite decimal number (e.g., \(5/4 = 1.25\) ) or an infinite decimal number (e.g., \(1/3 = 0.3333\ldots = 0.\bar{3}\) ).
  • Extend the homework grade algorithm to drop the two lowest scores.
  • Determine a final grade in ME 400 following the course grading policies (including drops).

Further Reading ¶

Here is a nice example of flow chart construction for the game of hangman.

Table Of Contents

  • Sequence by Example: Computing Grades
  • The Basic Idea
  • Back to Homework
  • Putting It All Together
  • Practice Problems
  • Further Reading

Related Topics

  • Previous: More on NumPy Arrays: Slicing and np.linalg
  • Next: Lecture 6 - Conditional Statements and the Structure of Python Code
  • Show Source

Quick search

Library homepage

  • school Campus Bookshelves
  • menu_book Bookshelves
  • perm_media Learning Objects
  • login Login
  • how_to_reg Request Instructor Account
  • hub Instructor Commons
  • Download Page (PDF)
  • Download Full Book (PDF)
  • Periodic Table
  • Physics Constants
  • Scientific Calculator
  • Reference & Cite
  • Tools expand_more
  • Readability

selected template will load here

This action is not available.

Engineering LibreTexts

1: Algorithmic Problem Solving

  • Last updated
  • Save as PDF
  • Page ID 46789

  • Harrison Njoroge
  • African Virtual University

Unit Objectives

Upon completion of this unit the learner should be able to:

  • describe an algorithm
  • explain the relationship between data and algorithm
  • outline the characteristics of algorithms
  • apply pseudo codes and flowcharts to represent algorithms

Unit Introduction

This unit introduces learners to data structures and algorithm course. The unit is on the different data structures and their algorithms that can help implement the different data structures in the computer. The application of the different data structures is presented by using examples of algorithms and which are not confined to a particular computer programming language.

  • Data: the structural representation of logical relationships between elements of data
  • Algorithm: finite sequence of steps for accomplishing some computational task
  • Pseudo code: an informal high-level description of the operating principle of a computer program or other algorithm
  • Flow chart: diagrammatic representation illustrates a solution model to a given problem.

Learning Activities

  • 1.1: Activity 1 - Introduction to Algorithms and Problem Solving In this learning activity section, the learner will be introduced to algorithms and how to write algorithms to solve tasks faced by learners or everyday problems. Examples of the algorithm are also provided with a specific application to everyday problems that the learner is familiar with. The learners will particularly learn what is an algorithm, the process of developing a solution for a given task, and finally examples of application of the algorithms are given.
  • 1.2: Activity 2 - The characteristics of an algorithm This section introduces the learners to the characteristics of algorithms. These characteristics make the learner become aware of what to ensure is basic, present and mandatory for any algorithm to qualify to be one. It also exposes the learner to what to expect from an algorithm to achieve or indicate. Key expectations are: the fact that an algorithm must be exact, terminate, effective, general among others.
  • 1.3: Activity 3 - Using pseudo-codes and flowcharts to represent algorithms The student will learn how to design an algorithm using either a pseudo code or flowchart. Pseudo code is a mixture of English like statements, some mathematical notations and selected keywords from a programming language. It is one of the tools used to design and develop the solution to a task or problem. Pseudo codes have different ways of representing the same thing and emphasis is on the clarity and not style.
  • 1.4: Unit Summary In this unit, you have seen what an algorithm is. Based on this knowledge, you should now be able to characterize an algorithm by stating its properties. We have explored the different ways of representing an algorithm such as using human language, pseudo codes and flow chart. You should now be able to present solutions to problems in form of an algorithm.

Flowcharts and Pseudocode

Lesson objective ​.

In this lesson we will be learning about flowcharts and pseudocode in detail by drawing and writing them for some example problems. As you already know, both of these are techniques to represent algorithms and programming logic. They are important because they help us to explain our programming logic better and in a clear way to someone else and also it enables us to debug any error in our logic.

Flowcharts ​

You are already aware that flowcharts are diagrammatic representations of algorithms. You know which symbols are used to draw flowcharts and the basic guidelines to draw them. You also know about their importance and usage.

Guidelines for developing flowcharts ​

Flowchart should have only one start and one stop symbol

General flow of processes is top to bottom or left to right

Arrows should not cross each other

A step by step guide how to create and use flowcharts and different symbols used in them:

Follow-up question

Q. ___ is a diagrammatic representation of ordered sequences of steps to carry out an operation.

A. Algorithm

B. Flowchart

C. Computer program

D. None of the above

Ans: B) Flowchart

Tools to draw flowcharts ​

Now, let’s discover some tools you can use to draw flowcharts.

1. Diagrams.net

You can go to website and download the diagram drawing tool to draw flowcharts. It is easy to use and involves simple drag and drop to draw the symbols in the flowchart.

This is a fun way to draw flowcharts as opposed to the conventional pen and paper drawing.

2. Flowgorithm

A more amazing tool is Flowgorithm. Flowgorithm is a free beginner's programming language that is based on simple graphical flowcharts. It is closer to how you actually code to implement your logic in a programming language. In fact, it allows you to convert the flowcharts you create directly into the code of any programming language of your choice. You can convert your flowcharts into pseudo code as well. You can also run your programs directly in Flowgorithm.

For beginners, many programming languages can be frustratingly difficult. Many of them require you to write lines of confusing code just to display the text "Hello, world!". By using flowcharts, you can concentrate on programming concepts rather than all the nuances of a typical programming language.

But, if you don’t have experience with any programming language, it’s better to use diagrams.net for now and just focus on the problem solving aspect. When you’re more familiar with programming languages, Flowgorithm can be a great tool to use.

For windows user the flowgorithm software is directly accessible on website , however for the Mac users please follow the instructions given in the video below:

You can learn the basics of how to make a flowchart using Flowgorithm from this tutorial:

Tuturial Link

Here is a video tutorial as well.

Well!! We are all set to draw a flowchart. Now go out and try a flowchart for the sample problem statement given.

Guidelines to submit your Flowchart
Choose your method of drawing the flowchart.
Once you are done, export it as an image file and save to your local files.
Upload the image to the link attached next to the Problem statement.

problem solving techniques algorithm flowchart pseudocode

Problem Statement: You have to add two numbers entered by the user.

Step 1: Marking the start of the algorithm (with an oval shaped symbol)

Step 2: Declaring variables n1,n2 and sum to be used (in a rectangular box that is used for processing and writing instructions)

📌 Note: Declaring variables is a stylistic choice and variables can be used directly as well. You will see in future lessons that some programming languages require variable declaration before use and some do not.

Step 3: Taking input of n1 and n2 from the user (in parallelogram shaped box)

Step 4: Performing sum operation for n1 and n2 (in rectangular shaped box)

Step 5: Giving sum as output (in parallelogram shaped box)

Step 6: Marking the end of the algorithm (with an oval shaped symbol)

Submit your Flowchart!

Now, you can check your answer with the solution.

Check the Flowchart!

Pseudocode ​

Pseudocode is defined as a method of describing a process or writing programming code and algorithms using a natural language such as English. It is not the code itself, but rather a description of what the code should do. In other words, it is used as a detailed yet understandable step-by-step plan or blueprint from which a program can be written. It is like a rough draft of a program or an algorithm before it is implemented in a programming language. It can also be referred to as 'false code' or 'representation of code'.

Guidelines for writing pseudocode ​

You are already aware of the main constructs used in pseudocode. Now, you will learn about the general guidelines to follow while writing pseudo code.

When writing pseudocode, everyone often has their own style of presenting things out since it’s read by humans and not by a computer; its rules are less rigorous than that of a programming language. However, there are some simple rules that help make pseudocode more universally understood.

Always capitalise the initial word (often one of the main 6 constructs).

Maintain the habit of keeping only one statement per line.

Indent to show hierarchy, improve readability, and show nested constructs.

Always end multi line sections using any of the END keywords (ENDIF, ENDWHILE, etc.).

Keep your statements programming language independent.

Use the naming domain of the problem, not that of the implementation. E.g., "Append the last name to the first name" instead of "name = first or last."

Keep it simple, concise, and readable.

Following these rules help you generate readable pseudocode and give you the ability to recognize an ill-written code.

Tool to write Pseudocode ​

You can use any text editor for writing pseudocode because it is only written for representation of algorithms and program logic. But, if you want to be able to run the logic you write, even though that might reduce some flexibility of how you write the algorithm, you can do so with an awesome online tool called pseudoeditor.com .

Guidelines to submit your Pseudocode
Choose your method of editor.
Once you are done, save it as a .txt file on your local file.
Upload the txt file to the link attached next to the Problem statement.

Let's try a sample problem now.

Submit your Pseudocode!

Check the solution below, once you are done.

NUMBER n1, n2, sum

INPUT n1, n2

SUM = n1 + n2

Let's try more such Flowchart and pseudocode based problems.

Remember, this is the first step to problem solving!!

Problem Statement: Find the largest among three different numbers entered by the user.

(You can skip to check these steps and try on your own)

Step 1: Mark the start of the algorithm

Step 2: Declare a,b,c the three numbers

Step 3: Take a,b,c as input

Step 4: Write a condition to check if a>b or not (inside a diamond shaped decision box); if above condition is true goto step 5 else goto step 6

Step 5: We come to this step if a>b and now we check if a>c or not. If this condition is true then we will output "a" else we will output "c" according to our logic.

Step 6: We come to this step if a is lesser than b and now we check whether b is greater than c or not. If this condition is true we output "b" else we output "c".

Step 7: We mark the end of algorithm

INPUT a, b, c

IF a > b

Problem Statement: Find the sum of series 1+2+3+…..+N.

Step 2: Declare i and sum with values 1 and 0 respectively.

Step 3: Take N as input

Step 4: Write a condition to check if i <= N or not (inside a diamond shaped decision box); if the condition is true goto step 5 else goto step 6.

Step 5: We come to this step if i is still less than or equal to N. Now, increase the value of sum to sum+i. Then, increment i by 1. Then go to step 4 (this is a loop)

Step 6: We come to this step when i is greater than N. Now, print the value of sum.

sum = 0, i = 1

WHILE i <= n

sum = sum + i

Now, it's time to think steps on your own. 🔥

Problem Statement: Find the roots of a quadratic equation aX^2 + bX + c = 0

INPUT a,b,c

d = b b - 4 a*c

IF (d equals 0)

r1 = r2 = (-b) / 2*a

ELSE IF (d > 0)

r1 = ((-b)+sqrt(d) / 2*a

r2 = ((-b)-sqrt(d) / 2*a

PRINT r1, r2

Problem Statement: Find The LCM (Lowest Common Multiple) of two numbers taken from the user as input.

📌 Note: LCM is the smallest positive integer that is perfectly divisible by both numbers

IF n1 > n2

rem1 = lcm % n1

rem2 = lcm % n2

WHILE (rem1 > 0 OR rem2 > 0)

📌 Note: As you may already know, the remainder is being calculated by the modulus operator(%) which gives us the remainder that is left on dividing the first operand by the second operand.

Problem Statement: Print the Fibonacci Series upto n terms. A series of numbers in which each number is the sum of the two preceding or previous numbers is called Fibonacci Series. The first few terms are as follows: 0, 1, 1, 2, 3, 5, 8, 13, 21, … , n.

📌 Note: The first two terms are by default 0 and 1. And their sum forms the third term and similarly the series propagates.

PRINT a, b on separate lines

sum = a + b

PRINT sum on next line

Useful resources for you: ​

Flowchart examples: https://visme.co/blog/flowchart-examples/

  • Lesson Objective
  • Guidelines for developing flowcharts
  • Tools to draw flowcharts
  • Guidelines for writing pseudocode
  • Tool to write Pseudocode
  • Useful resources for you:

Pseudocode and Flowcharts – Streamlining Algorithm Design

Introduction.

Pseudocode and flowcharts are two essential tools used in algorithm design to streamline the process and create efficient solutions to problems. In this blog post, we will explore the definition and purpose of pseudocode and flowcharts, as well as discuss the importance of streamlining algorithm design.

problem solving techniques algorithm flowchart pseudocode

Pseudocode: Simplifying Algorithm Design

What is pseudocode? Pseudocode is a high-level description of an algorithm that uses human-readable language to represent the steps involved. It is not tied to any specific programming language and focuses on the logic and structure of the algorithm.

Using pseudocode has numerous benefits. Firstly, it enhances clarity and readability by allowing algorithm designers to communicate their ideas without getting bogged down in syntactical details. This makes it easier for others to understand and review the algorithm, promoting collaboration and effective problem-solving.

Pseudocode also offers flexibility and expressiveness. By using a combination of plain language and intuitive constructs, algorithm designers can freely express their ideas and make adjustments as needed without worrying about the constraints of a particular programming language.

Common constructs and conventions in pseudocode include variables and data types, conditional statements such as if-else and switch, and loop structures such as for and while. These constructs allow algorithm designers to represent various logical operations and control flow in a concise and understandable manner.

Writing effective pseudocode involves incorporating best practices such as the use of comments and indentation. Comments help explain complex sections of code or provide context to aid understanding, while indentation assists in organizing the code for readability.

Furthermore, breaking down complex problems into smaller steps is key to writing effective pseudocode. By breaking the problem down into manageable pieces, algorithm designers can tackle each step individually, making the overall process less daunting and more approachable.

Flowcharts: Visualizing Algorithm Design

Flowcharts are graphical representations of algorithms, using symbols and arrows to demonstrate the flow of control within a program. They provide a visual representation of the logical steps involved, making it easier to understand and communicate complex processes.

A flowchart typically begins with a start symbol and ends with an end symbol, indicating where the algorithm begins and finishes. Process symbols represent actions or operations, while decision symbols are used to represent conditional branches in the algorithm.

Using flowcharts offers several advantages. Firstly, they provide a visual representation of algorithms, enabling algorithm designers to get a holistic view of the process. This visual aid helps identify potential issues or areas for improvement, ultimately leading to more efficient algorithms.

Flowcharts also facilitate easy understanding and communication. They offer a visual language that can be easily comprehended by both technical and non-technical individuals, allowing for effective collaboration and knowledge sharing.

Creating clear and effective flowcharts involves using appropriate symbols and connectors. Each symbol should accurately depict the action or decision being made, making it easier for others to interpret and follow the flowchart.

Another aspect of creating effective flowcharts is organizing the layout in a logical manner. The flowchart should flow from top to bottom or left to right, following the sequence of steps in the algorithm. This ensures that the flowchart is easy to follow and understand.

Combining Pseudocode and Flowcharts for Efficient Algorithm Design

Pseudocode and flowcharts are two complementary tools that can be used together to enhance algorithm design. Pseudocode allows algorithm designers to structure their algorithms using high-level language constructs, while flowcharts provide a visual representation of the algorithmic flow.

By using pseudocode to structure algorithms and flowcharts for visualization, algorithm designers can ensure that their algorithms are well-designed and easily comprehensible. Pseudocode helps in creating a logical structure, while flowcharts help in visualizing the flow of control and identifying any potential issues or inefficiencies.

An iterative design process that combines the use of pseudocode and flowcharts can be employed for efficient algorithm development. The algorithm can be initially outlined using pseudocode, allowing for a clear understanding of the logical steps involved. Once the pseudocode is in place, a flowchart can be created to visualize the algorithm, facilitating further analysis and refinement.

While combining pseudocode and flowcharts offers numerous benefits, there are also challenges to consider. One challenge is ensuring consistency between the pseudocode and flowchart representations, as any discrepancies could lead to confusion or errors. Additionally, ensuring that both the pseudocode and flowchart accurately represent the algorithm requires attention to detail and careful consideration.

Pseudocode and flowcharts are invaluable tools for algorithm design, providing a streamlined approach to problem-solving. Pseudocode simplifies the algorithm design process by using plain language and logical constructs, allowing for clear and adaptable descriptions. Flowcharts, on the other hand, offer visual representations that enhance understanding, communication, and analysis of algorithms.

By using both pseudocode and flowcharts, algorithm designers can ensure efficient algorithm development. The combination of high-level descriptions and visual representations facilitates a comprehensive understanding of algorithms and promotes collaboration among team members. Embracing pseudocode and flowcharts as part of the algorithm design process helps optimize algorithm development and enhance problem-solving skills.

In conclusion, harnessing the power of pseudocode and flowcharts is crucial for algorithm designers striving to create efficient and effective solutions. These tools help streamline the design process, resulting in algorithms that are easier to understand, maintain, and improve over time.

Related posts:

  • Demystifying Pseudocode – A Beginner’s Guide to Understanding and Implementing Pseudocode
  • Mastering Pseudocode – A Comprehensive Guide with Java Examples
  • A Step-by-Step Guide – Creating a Flowchart for Loop Execution
  • Mastering the For Loop Flowchart – A Step-by-Step Guide for Beginner Programmers
  • Unlocking Efficiency – The Strategic Applications of Flowcharts
  • DSA Tutorial
  • Data Structures
  • Linked List
  • Dynamic Programming
  • Binary Tree
  • Binary Search Tree
  • Divide & Conquer
  • Mathematical
  • Backtracking
  • Branch and Bound
  • Pattern Searching
  • BCA 1st Semester Syllabus (2023)

Fundamentals of IT & Computers

  • Basics of Computer and its Operations
  • Characteristics of Computer System
  • Types of Computers
  • Number System and Base Conversions
  • What is Algorithm | Introduction to Algorithms
  • What is a Flowchart and its Types?
  • What is an Operating System?
  • DOS Full Form
  • Types of Operating Systems
  • Commonly Used Operating System
  • Difference between Word Processor and Text Editor
  • Introduction to Microsoft Word
  • Introduction to MS Excel
  • Introduction to Microsoft PowerPoint

C Programming

  • C Programming Language Tutorial
  • Operators in C
  • Control Structures in Programming Languages
  • C if else if ladder
  • Nested switch case
  • Introduction to Divide and Conquer Algorithm - Data Structure and Algorithm Tutorials
  • Understanding Time Complexity with Simple Examples

What is PseudoCode: A Complete Tutorial

  • Arithmetic Operators in C
  • C Functions
  • Parameter Passing Techniques in C
  • Difference Between Call by Value and Call by Reference in C
  • Scope rules in C

Basic Mathematics

  • Determinant of a Matrix
  • Mathematics | Limits, Continuity and Differentiability
  • Advanced Differentiation
  • Chain Rule Derivative - Theorem, Proof, Examples
  • Taylor Series
  • Relative Minima and Maxima
  • Beta Function
  • Gamma Function
  • Reduction Formula
  • Vector Algebra

Business Communication

  • What is Communication?
  • Communication and its Types
  • BCA 2nd Semester Syllabus (2023)
  • BCA 3rd Semester Syllabus (2023)
  • BCA 4th Semester Syllabus (2023)
  • BCA 5th Semester Syllabus (2023)
  • BCA 6th Semester Subjects and Syllabus (2023)
  • BCA Full Form
  • Bachelor of Computer Applications: Curriculum and Career Opportunity
A Pseudocode is defined as a step-by-step description of an algorithm. Pseudocode does not use any programming language in its representation instead it uses the simple English language text as it is intended for human understanding rather than machine reading. Pseudocode is the intermediate state between an idea and its implementation(code) in a high-level language.

What is PseudoCode: A Complete Tutorial

What is the need for Pseudocode

Pseudocode is an important part of designing an algorithm, it helps the programmer in planning the solution to the problem as well as the reader in understanding the approach to the problem. Pseudocode is an intermediate state between algorithm and program that plays supports the transition of the algorithm into the program.

Pseudocode is an intermediate state between algorithm and program

Pseudocode is an intermediate state between algorithm and program

How to write Pseudocode?

Before writing the pseudocode of any algorithm the following points must be kept in mind. 

  • Organize the sequence of tasks and write the pseudocode accordingly.
This program will print first N numbers of Fibonacci series.
IF “1”    print response        “I AM CASE 1” IF “2”    print response        “I AM CASE 2”
  • Use appropriate naming conventions. The human tendency follows the approach of following what we see. If a programmer goes through a pseudo code, his approach will be the same as per that, so the naming must be simple and distinct.

Example: if you are writing IF…ELSE statements then make sure IF and ELSE be in capital letters.

  • Check whether all the sections of a pseudo code are complete, finite, and clear to understand and comprehend. Also, explain everything that is going to happen in the actual code.
  • Don’t write the pseudocode in a programming language. It is necessary that the pseudocode is simple and easy to understand even for a layman or client, minimizing the use of technical terms.

Good vs Bad ways of writing Pseudocode:

Good Vs Bad way of writing Pseudocode

Good Vs Bad way of writing Pseudocode

Pseudocode Examples:

1. b inary search pseudocode :.

Binary search is a searching algorithm that works only for sorted search space. It repeatedly divides the search space into half by using the fact that the search space is sorted and checking if the desired search result will be found in the left or right half.

Example: Given a sorted array Arr[] and a value X , The task is to find the index at which X is present in Arr[] .

Below is the pseudocode for Binary search.

BinarySearch(ARR, X, LOW, HIGH)        repeat till LOW = HIGH               MID = (LOW + HIGH)/2               if (X == ARR[mid])                   return MID                        else if (x > ARR[MID])                    LOW = MID + 1                        else                                     HIGH = MID – 1

2. Quick sort Pseudocode:

QuickSort is a Divide and Conquer algorithm . It picks an element as a pivot and partitions the given array around the picked pivot. Say last element of array is picked as pivot then all elements smaller than pivot element are shifted on the left side of pivot and elements greater than pivot are shifted towards the right of pivot by swapping, the same algorithm is repeatedly followed for the left and right side of pivot until the whole array is sorted.

Below is the pseudocode for Quick sort

QUICKSORT(Arr[], LOW, HIGH) {    if (LOW < HIGH) {        PIVOT = PARTITION(Arr, LOW, HIGH);        QUICKSORT(ARR, LOW, PIVOT – 1);          QUICKSORT(ARR, PIVOT + 1, HIGH);     } }

Here, LOW is the starting index and HIGH is the ending index.

Difference between Algorithm and Pseudocode

Difference between flowchart and pseudocode, 1. infosys pseudocode questions:.

What will be the output of the following pseudocode? Question 1) for i=0 to 4 step 1 do                            If  i==i++ + –i then do                                   display i                            end-if                      end-for Answer: 0 Question 2)  Set Character c = ‘7’                                     switch(c)                                     case ‘1’: display “One”                                     case ‘7’: display “Seven”                                     case ‘2’: display “Two”                                     default: display “Hello”                                     break                            end-switch  Answer: SevenTwoHello Question 3) Integer a, p                    Set a = 5                    a = a + 1                    a = a * 2                    a = a / 2                    p = a / 5 + 6                    print p  Answer: 7 Question 4) Integer a, b, c                     Set b = 40, a = 20, c = 20                     a = a + c                     c = c + a                     a = a + c                     c = c + a                     Print a + b + c  Answer: 300 Question 5) Integer a, b, c                     Set a = 4, b = 3, c = 1                     if (a >> (c – 1) && b << (c + 1))                            a = a + c                     Else                           b = a <<< C                     End if                     Print a – b + c            Answer: 3                                                               

2. Accenture Pseudocode Questions:

What will be the output of the following pseudocode? Questions 1) What will be the output of the following pseudocode for a = 5, b = 1?                       Integer funn(Integer a, Integer b)                       if(b + a || a – b) && (b > a) && 1)                           a = a+b+b-2                           return 3-a                       Else                           return a-b+1                       End if                       return a + b                       End function fun() Answer: 5 Questions 2) What will be the output of the following pseudocode for a = 5, b = 1?                        Integer funn(Integer a, Integer b)                        if((b mod a && a mod b) || (a ^ b > a))                                 a=a ^ b                        Else                                 return a-b                        End if                        return a + b                        End function funn() Answer: 5 Questions 3) What will be the output of the following pseudocode?                       Integer a, b, c                       Set a = 4, b = 4, c = 4                       if (a & (b ^ b) & c)                                a = a >> 1                       End if                       Print a + b + c Answer: 12 Questions 4) What will be the output of the following pseudocode for a = 10, b = 11?                      Integer funn(Integer a, Integer b)                      if(0)                           return a – b – funn(-7, -1)                      End if                           a = a + a + a + a                      return a                      End function funn() Answer: 40 Questions 5) What will be the output of the following pseudocode for a = 5, b = 1?                       Integer funn(Integer a, Integer b)                       if(b + a || a – b) && (b > a) && 1)                            a = a + b + b – 2                            return 3 – a                       Else                            return a – b + 1                       End if                       return a + b                       End function fun() Answer: 5

3. Capgemini Pseudocode Questions

What will be the output of the following pseudocode? Question 1) What will be the output of the following pseudocode for a=8, b=1? Integer funn(Integer a, Integer b) If(a > b && a > 0)      Return a + b + funn (b-1, a-1) End if Return a + b Answer: 16 Question 2) What will be the output of the following pseudocode for p=7, q=2? Integer funn(Integer p, Integer q)            if(p + q < 10)                  Return 1 + funn(p + 1, q + 1)               Else                  Return 2            End if Answer: 3 Question 3) What will be the output of the following pseudocode for a=2, b=7, c=7?       Integer funn(Integer a, Integer b, Integer c)       if ((b + a) < (a – b))             a = a + c             b = (10 + 10) + c       End if       Return a + b + c Answer: 16 Question 4) What will be the output of the following pseudocode?  String str1 = “err”, str2 = “krr” Print (count consonant(upper(reverse(str2) + reverse(str1)))) Answer: 5 Question 5) What will be the output of the following pseudo code? Integer a, b, c Set a = 2, b = 11, c = 5 if ((4 + 5) < (6 + b))       b = c & a End if Print a + b + c Answer: 7

PseudoCode Frequently Asked Questions ( FAQ )

1) what are the 5 rules of pseudocode.

Five important rules for writing pseudocode are:

  • Write one statement per line.
  • Initial keywords should be represented in capital case (READ, WRITE, IF, WHILE, UNTIL).
  • Indentation of pseudocode should be similar to the actual program to show hierarchy.
  • Ending the multiline structure is necessary.
  • Keep statements in simple language(English).

2) How do I start pseudocode?

At first, the purpose of the process should be written to make the aim clear.

3) Is pseudocode easy to learn?

Pseudocode uses plain text mostly written in English language which makes it easy to understand and present.

4) Why do we use pseudocode?

Pseudocode provides easier understanding to people as compared to the conventional programming language code that it is an efficient and platform-independent description of the important principles of an algorithm.

5) Is pseudocode an algorithm?

Pseudocode is used to represent an algorithm but the structure of a pseudocode may not follow the same flow as an algorithm is a well-defined sequence of steps that provides a solution for a given problem.

6) What is the difference between pseudocode and flowchart?

A flowchart is a diagrammatic representation that illustrates a solution model and solution flow to a given problem whereas Pseudocode is an informal high-level description of the operating principle of an algorithm.

7) What is the difference between pseudocode and code?

Pseudocode is just a way to represent the algorithm of the program, it is how the code would look like when if it is actually programmed. Source code is the actual code that can be compiled by the compiler and then be executed by the machine.

8) Which is easier to use algorithm or pseudocode?

Pseudocode is written in English language thus it is easy to understand, construct and simpler to debug on the other hand algorithm is quite complex to construct as it sometimes involves code snippets in it and hence it is a bit difficult when it comes to debugging algorithm.

9) How do you declare a variable in pseudocode?

In pseudocode Assigning a value to a variable is indicated using an arrow symbol (←). The arrow points from the value being assigned towards the variable it is being assigned to.  Example: String ← “GeeksforGeeks”, would be a valid assignment.

10) What is end if in pseudocode?

To terminate a multiple line if command the endif command is used. The command can either be specified as two separate words, ‘end if’ or as a single word, ‘endif’.

Conclusion:

In the above discussion, we understood the importance of pseudocode in understanding an algorithm. Pseudocode is a lot simpler to construct and debug as compared to an algorithm. 

Please Login to comment...

Similar reads.

  • DSA Tutorials

advertisewithusBannerImg

Improve your Coding Skills with Practice

 alt=

What kind of Experience do you want to share?

Dot Net Tutorials

Algorithm, Pseudocode, Programs, and Flowcharts

Back to: C#.NET Tutorials For Beginners and Professionals

In this article, I am going to discuss Algorithms, Pseudocode, Programs, and Flowcharts in detail. Please read our previous article where we discussed Programming Methodologies . At the end of this article, you will understand mostly What are Algorithms, what is Pseudocode, What are Programs, and what are Flowcharts.

Algorithm: An algorithm is a step-by-step procedure for solving a computational problem. It is a process or set of rules to be followed in calculations or other problem-solving operations.

Program: A program is a step-by-step machine instruction used for solving any problem or computational task.

Algorithm, Pseudocode, Programs, and Flowcharts

Difference between Algorithm and Program

Programs have been written recently but Algorithms have appeared for centuries. As a common practice, mathematicians or scientists have been devising procedures for solving computational problems. Those working on problems were giving solutions in form of step-by-step procedures known as algorithms. Now we want that same procedure must be followed by machines so we are writing programs.

An algorithm basically means how to solve a problem. First, we need to learn a few analytical or problem-solving skills to write an algorithm.

  • Let’s consider a chef who knows how to prepare a dish then he/she can easily prepare the recipe of that dish.
  • Let’s consider a chemist who is well versed with different chemical reactions then he/she can easily prepare a chemical formula applying those reactions.

Once an algorithm is prepared, we need to convert it into a Program so that the computer can execute it and perform the computational task. Any programming language can be used to write a program but it must strictly follow the syntax of that programming language.

What is Pseudocode?

Pseudocode is an artificial and informal language that helps programmers in developing algorithms. It is basically a “text-based” detail (algorithmic) design tool. 

Algorithm and Program Example:

So here I have an example algorithm as well as a C++ program that is not a complete program is just a function.

Algorithm and Program Example

Let us Understand the Algorithm.

The Algorithm is for finding the average of the list of elements. That is, we have a collection of elements and we want to find out the average. First, we assign 0 to Sum. Then for each element x in the list, we begin sum assigned sum+ x i.e. adding each value of x into the sum variable. Then after that, the average is assigned sum by the number of elements, and then, return the average. So, if you read the above algorithm, you can understand how to find the average of a list of elements. Add all of them and divide by the number of elements. That’s it. This is how we write our algorithm using pseudocode.

Let us Understand the Program.

Now the same thing for finding the average list of elements, we have written the program using C++ language. It’s a function, it’s not a complete program, just a function inside a program. If we don’t use a semicolon to end the statement, it’s an error, and instead of assignment if we write less than or a hyphen symbol, then also it is an error. So, if you want to store the value then you must use an equal symbol and that is called an assignment.

So, it means you should follow the proper syntax of a language. Because this is not for you. You are writing the program for the compiler to understand and convert it into machine code. You will write a C++ program and that gets converted into machine code or machine language. So, you are actually talking to the compiler. You should talk in such a way that you can easily understand.

If the compiler is not understanding your program, then the compiler cannot convert your program into machine code. So, you should follow the syntax perfectly. That is the reason you have to put some little extra effort into learning programming.

What is a Flowchart?

A flowchart is used for showing the flow of control in a program and the sequence of steps involved in a hierarchical manner. It is basically a diagrammatic representation of an algorithm, workflow, or process.

So, if a program is very big then it is very difficult to figure out how the flow of the program is, Flow charts are useful for understanding the program, instead of one is reading the program and understanding it, he can see the flow chart and understand how the program is working.

It is just like if you talk about electrical wiring in a home. Then from where the wires or the cables are moving through the walls. If you have a plan then you can know where exactly they are flowing and where the important points are, everything you can know. Otherwise, if there is any problem with the wiring, then you have to dig the whole wall to find out the problem. If there is a proper plan then you can understand. So before laying the wire or pulling the wires we will make a plan. In the same way, before writing the program we make a flowchart. So based on the flow chart we will write the program. This will help us to understand the program.

Use of Flowchart

Flowcharts were highly used at the times of Monolithic Programming. Then later on when the concept of Procedural Programming came into practice, the usage of flowcharts was a little reduced.

Steps in the flowchart:

Usually, when we are using a flow chart for the program, it consists of three steps:

We will call it like this. First, it takes some input. Then it will process. Then it will give the output. So, any procedure you take will have similar steps. For example, preparing a dish. Input is the ingredients. That process is the process of making a dish and the output is the dish ready. If you take a chemistry experiment that is done usually in laboratories will have input means chemicals and the vessels or instruments whatever you need. Then the process of what you will do with that and then it gets done successfully. So, every procedure will have these 3 things and the program is also used to look like this.

Elements of Flowchart:

Now let us look at the elements of the flow chart. The following image shows the different elements of a flowchart.

Terminal : The oval symbol indicates Start, Stop and Halt in a program’s logic flow. A pause/halt is generally used in programming logic under some error conditions. The terminal is the first and last symbol in the flowchart.

Input/Output : A parallelogram denotes any function of input/output type. Program instructions that take input from input devices and display output on output devices are indicated with a parallelogram in a flowchart.

Processing : A box represents arithmetic instructions. All arithmetic processes such as addition, subtraction, multiplication, and division are indicated by the action/process symbol.

Decision: Diamond-shaped symbol represents a decision point. Decision-based operations such as Yes/No, question, or True/False are indicated by diamond shape in the flowchart.

Flow lines : Flow lines indicate the exact sequence in which instructions are executed. Arrows represent the direction of flow of control and the relationship among different symbols of the flowchart.

Now let us draw a few flow charts and try to understand idea of how flowcharts are used and how they are useful for writing the programs.

Flowchart for adding two numbers

Step 1 : Start.

Step 2 : Declare variables Number1 and Number2.

Step 3 : Read values Number1 and Number2.

Step 4 : Add Number1 and Number2 and store the result in Sum. (Sum = Number1 + Number2).

Step 5 : Display Sum.

Step 6 : Stop.

In the next article, I am going to discuss Introduction to .NET Framework . Here, in this article, I try to explain the Algorithm, Pseudocode, Programs, and Flowcharts in detail and I hope you enjoy this Algorithm, Pseudocode, Programs, and Flowcharts article.

About the Author: Pranaya Rout

Pranaya Rout has published more than 3,000 articles in his 11-year career. Pranaya Rout has very good experience with Microsoft Technologies, Including C#, VB, ASP.NET MVC, ASP.NET Web API, EF, EF Core, ADO.NET, LINQ, SQL Server, MYSQL, Oracle, ASP.NET Core, Cloud Computing, Microservices, Design Patterns and still learning new technologies.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Flowchart and Pseudocode Introduction.

Before writing the code for an application pre-planning the code is important and we can do this with the help of Flowcharts and Pseudocode . It helps us in writing good and efficient programs.  

What is a Flowchart?

A Flowchart is a diagrammatic representation of an algorithm, workflow, or process. It represents a step-by-step approach to solving a problem. The lines and arrows in it show the sequence of steps and the relationship among them. 

It uses different shapes and arrows to depict the sequence of actions and decision points in a program. Each shape in a flowchart represents a specific action, and arrows indicate the flow of control from one step to another.

Below are the Flowchart symbols commonly used:

  • Oval : Represents the start or end of the program.
  • Rectangle : Represents a process or action to be performed.
  • Diamond : Represents a decision point where a condition is evaluated.
  • Parallelogram : Represents input or output operations.
  • Arrows : Indicate the direction of flow between different steps.

Shapes Use in Flowchart

What is Pseudocode?

Example of flowchart with pseudocode. .

flowchart to sum two number

So, this basic understanding of flowcharts and pseudocode with two real-life examples. Hope you found this blog post helpful. You can use the comment section below to ask your questions related to the topic. (alert-success)  

⚡ Please share your valuable feedback and suggestion in the comment section below or you can send us an email on our offical email id ✉ [email protected] . You can also support our work by buying a cup of coffee ☕ for us.

  • Programming

Similar Posts

No comments:

Post a comment.

Weekly Must-Reads View All

Ai and healthcare equity: bridging gaps.

AI and Healthcare Equity: Bridging Gaps In today's fast-paced world,

The Boundaries of AI: Legal and Ethical Perspectives

Artificial Intelligence (AI) has become an integral part of our lives, from

Hyperparameter Optimization Techniques

Hyperparameter Optimization: Finding the Perfect Balance for Your Machine

GRU vs LSTM: Comparing Neural Network Architectures

Are you fascinated by the world of artificial intelligence and its applications?

Algorithmic Mind

Trending Now View All

The Boundaries of AI: Legal and Ethical Perspectives

Pseudocode vs. Flowchart: Visualizing Algorithms

The Difference Between Pseudocode and Flowcharts: Which Is the Better Tool for Visualizing Algorithms?

Have you ever been faced with the challenge of understanding a complex algorithm? You may have come across two popular tools used in computer science to visualize algorithms: pseudocode and flowcharts. These tools play a crucial role in breaking down intricate processes into more understandable components, making it easier for both programmers and non-programmers to grasp the logic behind them.

But what exactly are pseudocode and flowcharts, and how do they differ from each other? In this article, we will explore the differences, similarities, and use cases of pseudocode and flowcharts, aiming to help you choose the most suitable visualization tool for your algorithmic needs. Let's dive in!

Understanding Pseudocode

Pseudocode is an informal way of representing algorithms using a combination of natural language descriptions and programming code-like structures. It serves as a bridge between human-readable language and the actual programming language. Pseudocode focuses on conveying the logic and steps involved in solving a problem rather than adhering to strict syntax rules.

Writing pseudocode is akin to sketching a rough outline of a program's logic on paper or a whiteboard. It allows programmers to plan and design their algorithms before translating them into actual code. Pseudocode is often used as a starting point for developing software, as it provides a high-level overview of the solution without getting bogged down in the details of a specific programming language.

The Power of Flowcharts

Flowcharts, on the other hand, are graphical representations of algorithms or processes. They use a set of symbols and shapes connected by arrows to depict the flow and sequence of steps in a system. Flowcharts are particularly useful when it comes to visualizing complex decision-making processes or logic flow in a program.

Flowcharts provide a visual roadmap of how an algorithm progresses, making it easier to track the sequence of operations and identify potential bottlenecks or areas for improvement. They can be used as a means of communication between different stakeholders, including programmers, designers, and business analysts, as they offer a clear and concise overview of the problem-solving approach.

Key Differences: Pseudocode vs. Flowcharts

While both pseudocode and flowcharts serve the purpose of visualizing algorithms, they differ significantly in their representation and level of detail. Here are some key differences between the two:

1. Expressiveness and Detail

Pseudocode allows for greater expressiveness and detail compared to flowcharts. With pseudocode, programmers can use natural language descriptions and specific programming constructs to convey the logic of their algorithm. The level of detail can be as high or as low as desired, making it easier to capture complex operations, conditional statements, and looping constructs.

On the other hand, flowcharts rely on a limited set of symbols and shapes, which can sometimes result in a loss of expressiveness and detail. While flowcharts excel at demonstrating the overall flow of an algorithm, they may struggle to capture intricate programming concepts or complex decision-making processes.

2. Readability and Understanding

Pseudocode is generally more readable and easier to understand for programmers, as it closely resembles actual programming code. It allows for the use of familiar programming constructs and syntax, making it easier to translate the pseudocode into a specific programming language.

Flowcharts, on the other hand, are more accessible to non-programmers or stakeholders who may not be familiar with programming syntax. The graphical nature of flowcharts allows for a quick understanding of the algorithm's flow, regardless of the audience's technical background.

3. Flexibility and Adaptability

Pseudocode provides greater flexibility and adaptability compared to flowcharts. Since it is not tied to a specific programming language, pseudocode can be easily modified or adapted to different programming paradigms or languages. This makes it a valuable tool for brainstorming and experimenting with different algorithmic approaches before committing to a particular implementation.

Flowcharts, on the other hand, may require significant rework if the algorithm needs to be implemented in a different programming paradigm or language. The graphical nature of flowcharts makes them less adaptable to changes in the underlying logic, and translating them into code can sometimes be a labor-intensive task.

Use Cases: When to Choose Pseudocode or Flowcharts

The choice between pseudocode and flowcharts depends on various factors, including the complexity of the algorithm, the target audience, and the desired level of detail. Here are some scenarios where one visualization tool may be more suitable than the other:

1. Prototyping and Design

When prototyping or designing an algorithm, pseudocode can be a valuable tool for quickly capturing and experimenting with different ideas. Its expressive nature allows programmers to focus on the logic, without worrying about the specifics of a particular programming language. Pseudocode can be easily modified and refined until the desired solution is achieved.

2. Communication and Collaboration

Flowcharts are excellent tools for facilitating communication and collaboration among different stakeholders who may not have a programming background. They provide a visual representation of the algorithm's flow, making it easier for non-programmers to follow along and provide feedback. Flowcharts can be used in meetings, presentations, or documentation to ensure everyone is on the same page.

3. Documentation and Training

When it comes to documenting or explaining an algorithm to others, both pseudocode and flowcharts can be used effectively. Pseudocode allows for a more detailed and code-like representation, making it a suitable choice for technical documentation or training materials aimed at programmers. Flowcharts, on the other hand, provide a more visual and intuitive representation, making them ideal for introductory materials or non-technical audiences.

4. Complexity and Scalability

For complex algorithms with intricate logic or large-scale systems, flowcharts can be a better choice due to their ability to represent the overall flow and decision-making processes. Flowcharts excel at capturing complex branching or looping constructs, making them suitable for algorithms with numerous conditional statements or nested loops.

5. Personal Preference and Familiarity

Ultimately, the choice between pseudocode and flowcharts can also come down to personal preference or familiarity. Some programmers may find pseudocode more comfortable to work with, as it closely resembles the programming languages they are already familiar with. Others may prefer the visual nature of flowcharts and find them easier to understand at a glance.

In conclusion, both pseudocode and flowcharts are powerful visualization tools that serve different purposes in the realm of algorithmic design and understanding. Pseudocode allows programmers to express complex logic using a combination of natural language descriptions and programming constructs, while flowcharts provide a graphical representation of an algorithm's flow and decision-making processes.

The choice between these tools ultimately depends on the specific requirements of the task at hand. Pseudocode shines in prototyping and design phases, offering flexibility and adaptability, while flowcharts excel in communication, collaboration, and documenting complex algorithms.

Whether you prefer to sketch out your ideas in pseudocode or create visual flowcharts, the goal remains the same: to enhance your understanding and communication of algorithms. So, choose the tool that best suits your needs, and let the power of visualization guide you on your algorithmic journey.

References:

  • Pseudocode – Wikipedia
  • Flowchart – Wikipedia

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Save my name, email, and website in this browser for the next time I comment.

  • Applications

Ember JS vs Angular: JavaScript Frameworks

Ember JS vs Angular: Which JavaScript Framework Is Right for You?

ML for Customer Churn Prediction

As businesses strive to thrive in today’s competitive landscape, one of

You May Also Like

Elastic search vs. algolia: search solutions.

What’s the Difference Between Elastic Search and Algolia?

Algorithm vs Program: Computer Science Concepts

Algorithm vs Program: Exploring the Differences The World of Computer Science In

Elastic Search vs Splunk: Exploring Data Analysis Tools

Which is Better for Data Analysis: Elastic Search or Splunk?

Flowchart vs. Pseudocode: Algorithm Design

Flowchart vs. Pseudocode: Algorithm Design

Are you someone who gets easily overwhelmed by complex algorithms and their

lab 2 problem solving techniques algorithm pseudo code and flowchart

LAB 2 : PROBLEM SOLVING TECHNIQUES, ALGORITHM: PSEUDO CODE AND FLOWCHART

Jul 27, 2014

190 likes | 368 Views

LAB 2 : PROBLEM SOLVING TECHNIQUES, ALGORITHM: PSEUDO CODE AND FLOWCHART. LAB INTRODUCTION. The printf function. Formatted Output with “printf”. #include &lt; stdio.h &gt; int main (void) { int iMonth ; float fExpense , fIncome ; iMonth = 12; fExpense = 111.1; fIncome = 1000.0;

Share Presentation

  • cik noor syazana
  • point format
  • cm3 end prepared
  • distance value
  • basic symbols

kassia

Presentation Transcript

LAB 2 : PROBLEM SOLVING TECHNIQUES, ALGORITHM: PSEUDO CODE AND FLOWCHART LAB INTRODUCTION Prepared by: Cik Noor Syazana bt Arshad

The printf function Prepared by: Cik Noor Syazana bt Arshad

Formatted Output with “printf” #include <stdio.h> int main (void) { intiMonth; float fExpense, fIncome; iMonth = 12; fExpense = 111.1; fIncome = 1000.0; printf (“The Month is %4d and the Expense is RM%9.2f\n”,iMonth, fExpense); } Declaring variable (iMonth) to be integer Declaring variables (fExpense and fIncome) to be real Assignment statements store numerical values in the memory cells for the declared variables ‘,’ separates string literal from variable names Correspondence between variable names and %...in string literal Prepared by: Cik Noor Syazana bt Arshad

Formatted Output with printf-cont • printf (“The Month is %4d and the Expense=RM %9.2f \n” ,iMonth, fExpense); • %4d refer to variableiMonth value (decimal number format) • %9.2f refer to variablefExpense value. (floating point format) • The output of printf function will be displayed as Prepared by: Cik Noor Syazana bt Arshad

The scanf function Prepared by: Cik Noor Syazana bt Arshad

Formatted Output with “printf & scanf” #include <stdio.h> int main (void) { intiMonth; float fExpense, fIncome; printf(“Please enter month”); scanf (“%d”,&iMonth); printf(“Please enter the expense and income”); scanf (“%f%f”,&fExpense,&fIncome); printf (“The Month is %4d and the Expense is RM%9.2f\n”, iMonth, fExpense); } Declaring variable (iMonth) to be integer Function scanf reads value typed on keyboard Function scanf reads the first value as fExpense and the second value as fIncome Prepared by: Cik Noor Syazana bt Arshad

Formatted input with scanf-cont Prepared by: Cik Noor Syazana bt Arshad

Data types Prepared by: Cik Noor Syazana bt Arshad

Escape sequence Prepared by: Cik Noor Syazana bt Arshad

How to print a line? • Command • printf(“Welcome to UNIMAP”); • printf(“----------------------------”); • Display Welcome to UNIMAP ---------------------------- Prepared by: Cik Noor Syazana bt Arshad

Algorithm-Basic symbols in a flowchart Flow direction Start/End Process Connector Input/Output Decision Prepared by: Cik Noor Syazana bt Arshad

Q: Write a program to convert distance in meter(m) to centimeter(cm)...‏ Start Get input or distance value in m perform conversion from m to cm using formula: cm=100*m print output or distance value in centimeter (cm) End Prepared by: Cik Noor Syazana bt Arshad

Pseudo code Begin Get distance value in meter (m) Perform conversion from m to cm using formula: cm=100* m Print distance value in centimeter (cm) End Prepared by: Cik Noor Syazana bt Arshad

Program Coding #include <stdio.h> int main () { // variables declaration float fcm,fm; // to display message printf(“\nProgram to convert distance from meter to centimeter”); Prepared by: Cik Noor Syazana bt Arshad

Program Coding (Continued) printf (“\n\nPlease enter the value of distance in meter: ”); scanf(“%f”, &fm); fcm = 100*fm; printf(“\nThe value of distance in centimeter is %5.2f cm\n,fcm); return 0; } //end of main Prepared by: Cik Noor Syazana bt Arshad

Q: Write a program to calculate the volume of a cylinder Start Get radius and height values in inches Calculate volume of a cylinder perform conversion from inches to cm using formula: 1 inches=2.54cm print output or cylinder volumein centimeter cubed (cm3) End Prepared by: Cik Noor Syazana bt Arshad

Pseudo code Begin Get radius and height values in inches Calculate volume of cylinder using formula volume=pi*radius2*height Perform conversion from inches to cm using formula: 1inch=2.54cm Print volume of cylinder in cm3 End Prepared by: Cik Noor Syazana bt Arshad

Program Coding #include <stdio.h> int main () { // variables declaration const double PI=3.141594; double dVolume; float fR,fH; // to display message printf(“\nProgramto calculate the volume of a Cylinder\n”); Prepared by: Cik Noor Syazana bt Arshad

Program Coding (Continued) printf (“\nPleaseenter the value of radius and height in inches:\n ”); scanf(“%f%f”, &fR,&fH); dVolume= PI*fR*2.54*fR*2.54*fH*2.54; printf(“\nThevolume of a cylinder in centimeter cubed is %7.2f cm\n”,dVolume); return 0; } //end of main Prepared by: Cik Noor Syazana bt Arshad

  • More by User

Flowchart and Pseudocode

Flowchart and Pseudocode

Flowchart and Pseudocode. DesignTools Part2. Topics. Input Process Output (IPO) Chart Hierarchy/Structured Chart Flow Chart Pseudo Code Source Code. Design Steps and Tools. IPO Chart. Hierarchy or Structured Chart. Flow Chart. Pseudo Code. Source Code. FlowChart.

782 views • 11 slides

Pertemuan 01 Algorithm

Pertemuan 01 Algorithm

Pertemuan 01 Algorithm. Matakuliah : D0524 / Algoritma dan Pemrograman Komputer Tahun : 2005 Versi :. Learning Outcomes. Pada akhir pertemuan ini, diharapkan mahasiswa akan mampu : Menerapkan prinsip – prinsip dasar algoritma menggunakan pseudo code dan flowchart. Outline Materi.

310 views • 12 slides

Genetic Algorithm

Genetic Algorithm

Genetic Algorithm. By Ben Shedlofsky. Agenda. History of Genetic Algorithm Methodology of Genetic Algorithm Process of Genetic Algorithm Pros And Cons of Genetic Algorithm About Genetic Algorithm Going over an example and pseudo-code of the algorithm. History.

958 views • 28 slides

Algorithms

2.2. Algorithms. Overview. In this presentation we will discuss: What is an algorithm? 5 steps in developing an algorithm A Jeroo example. An algorithm is. A plan for solving a problem 5 steps in algorithm development Describe the problem clearly Analyze the problem

527 views • 18 slides

Program Design

Program Design

Program Design. ENGR 1181 MATLAB 11. MATLAB Program Design in Real Life.

389 views • 14 slides

LECTURE 1: Introduction to algorithmic problem solving

LECTURE 1: Introduction to algorithmic problem solving

LECTURE 1: Introduction to algorithmic problem solving. Outline. Problem solving What is an algorithm ? What properties an algorithm should have ? Algorithms description What types of data will be used ? Which are the basic operations ?. Problem solving. Example:

733 views • 57 slides

Recursion

Recursion. Snarf the code for today’s class. Where We Are: Tools and Techniques. Data Structures, like Lists and Maps Techniques, like Big O analysis Classes and Inheritance The essential process of taking a problem and solving it with code.

189 views • 7 slides

Problem Solving

Problem Solving

Materials Prepared by Dhimas Ruswanto , BMm. Problem Solving. Skill Area 305.1. Lecture Overview. Problem Solving Algorithm Dry Run. PROBLEM SOLVING. Problem-Solving methodology: Define the problem Outline the solution Develop an algorithm Test the algorithm. DEFINE THE PROBLEM.

449 views • 22 slides

Structured Problem Solving

Structured Problem Solving

Structured Problem Solving. Week 5: Steps in Problem Solving Stewart Blakeway FML 213 [email protected]. What we have done already. Seen what an algorithm is a set of instructions that, if carried out, will lead to a successful conclusion Learned how to represent algorithms in

914 views • 62 slides

CS1010: Programming Methodology comp.nus.sg/~cs1010/

CS1010: Programming Methodology comp.nus.sg/~cs1010/

CS1010: Programming Methodology http://www.comp.nus.edu.sg/~cs1010/. Week 1: Problem-Solving and Algorithm. Computing Fundamentals Problem-Solving Algorithm Control Structures Tasks: Writing Algorithms in Pseudo-code. This symbol indicates the focus of today’s lesson.

610 views • 47 slides

LECTURE 1: Introduction to algorithmic problem solving

LECTURE 1: Introduction to algorithmic problem solving. Outline. Problem solving What is an algorithm ? What properties an algorithm should have ? Algorithms description What types of data will be used ? Which are the basic operations ?. Problem solving.

758 views • 57 slides

Chapter 6

Chapter 6. Problem Solving and Algorithm Design. Chapter Goals. Determine whether a problem is suitable for a computer solution Describe the computer problem-solving process and relate it to Polya’s How to Solve It list Distinguish between following an algorithm and developing one

532 views • 43 slides

CS 312: Algorithm Analysis

CS 312: Algorithm Analysis

This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License. CS 312: Algorithm Analysis. Lecture # 39: Problem Solving. Credit: Eric Ringger. A Rough-Draft Set of Questions for Problem Solving. Problem-Solving. Problem Formulation Algorithm Design

166 views • 6 slides

Lecture 1

Lecture 1. CMSC 201. Overview. Goal: Problem solving and a lgorithm development. Learn to program in Python. Algorithm - a set of unambiguous and ordered steps to accomplish a task Algorithm Representation - Pseudocode or flowchart. Program Development.

302 views • 15 slides

Computer -- Hardware

Computer -- Hardware

Computer -- Hardware. Algorithm: Step by step procedure of solving a particular problem. Pseudo code: Artificial informal language used to develop algorithms. Flow chart: Graphical representation of an algorithm. Algorithm to find whether a number even or odd: Step1: Begin Step1: START

423 views • 24 slides

Section 1.3 Problem Solving

Section 1.3 Problem Solving

Section 1.3 Problem Solving. What You Will Learn. Problem-solving techniques. Polya’s Procedure. George Polya (1887-1985), a mathematician who was educated in Europe and taught at Stanford, developed a general procedure for solving problems. Guidelines for Problem Solving.

494 views • 33 slides

05 – Problem Solving &amp; Data Types

05 – Problem Solving &amp; Data Types

05 – Problem Solving &amp; Data Types. Question: Pseudo-code. Write VBScript code that does the following: when btnDown is clicked read txtNum subtract 1 put in txtNum. function btnDown_onClick(){ txtNum.value = txtNum.value – 1; }. Can't touch this.

503 views • 41 slides

Week 1 – Introduction to Computer and Algorithm (Part 2) ‏

Week 1 – Introduction to Computer and Algorithm (Part 2) ‏

Week 1 – Introduction to Computer and Algorithm (Part 2) ‏. Outline. Pseudo code &amp; flowchart Sample programming question Sample C program Identifiers and reserved words Program comments Pre-processor directives Data types and type declarations Operators Formatted input and output

451 views • 38 slides

Algorithm Analysis

Algorithm Analysis

Algorithm Analysis. Problem Solving Space Complexity Time Complexity Classifying Functions by Their Asymptotic Growth. Problem Solving: Main Steps. Problem definition Algorithm design / Algorithm specification Algorithm analysis Implementation Testing Maintenance. 1. Problem Definition.

822 views • 44 slides

Introduction to Problem Solving

Introduction to Problem Solving

Introduction to Problem Solving. Programming in C. Problem Solving. How to get the computer solve a problem?. Describe the steps that the computer should take in order to solve the problem. Algorithm. Steps of Problem Solving. 1 . Understand the problem to be solved. Analysis.

1.25k views • 81 slides

Problem Solving

Problem Solving. Generic Problem Solving Process. Define the problem Brainstorm solutions Evaluate solutions Pick one Try (implement) it Evaluate results Express the solution as an algorithm, then convert it into a computer program. What’s an Algorithm?.

246 views • 13 slides

LinkPay India No.1 Trusted Link Shortener

  • History of systems
  • Data Representation
  • QR Codes Customizable & trackable QR codes
  • Bio Pages Convert your social media followers
  • Help Center Find answers to your questions
  • Developer API Guide on how to use our API

Problem Solving (Pseudocode, Algorithm & Techniques)

problem solving techniques algorithm flowchart pseudocode

Pseudocode is an informal language that helps programmers describe the steps of a program's solution without using any programming language syntax.

previous post Introduction to Problem-Solving

EXAMPLE 2 Draw a flowchart to add two numbers and an algorithm in simple English.

Step 1. Start

  • Step 2. Get two numbers N1 and N2
  • Step 3. SN1+ N2
  • Step 4. Print the result S
  • Step 5. Stop

Problem Solving (Pseudocode, Algorithm & Techniques)

EXAMPLE 3 Draw a Flowchart to find the Area and Perimeter of the Rectangle, along with the algorithm in simple English.

L: Length of Rectangle, B: Breadth Rectangle AREA Area of Rectangle, PERIMETER: Perimeter of Rectangle

  • Step 2. Input Side-Length & input value, say L, B
  • Step 3. AREA <-- L x B
  • Step 4. PERIMETER <-- 2x (L + B)
  • Step 5. Print AREA, PERIMETER
  • Step 6. Stop

Problem Solving (Pseudocode, Algorithm & Techniques)

EXAMPLE 4 Draw a flowchart to determine the larger of two numbers, along with an algorithm in simple English.

Step 2: Get two numbers a and b

Step 3 If a>b, then print an else print b

Step 4 Stop

Problem Solving (Pseudocode, Algorithm & Techniques)

Pseudocode is a "text-based" detail (algorithmic) design tool. Pseudocode creates an outline or a rough draft of a program that gives the idea of how the algorithm works and how the control flows from one step to another. For example, consider the following pseudocode:

If the student's marks is greater than or equal to 50     display "passed" else     display "failed"

Pseudocode is an informal way of describing the steps of a program's solution without using any strict programming language syntax or underlying technology considerations.

The above pseudocode gives you an idea of how a program determines whether a student has passed or failed to compare the marks of the student.

Consider the algorithm we discussed in example 4 (determine if the first number is greater than the second number or not). The pseudocode of this algorithm can be like :

Input first number in variable firstnum. Input second number in variable secondnum if the firstnum is > the secondnum display ' the first number is greater than second number '. else display ' the first number IS greater than second number '.

In pseudocode, usually, the instructions are written in upper case, variables in lowercase, and messages in sentence case.

Please note there are no standard rules to writing pseudocode as it is totally informal way of representing an algorithm.

Advantages and Disadvantages of Pseudocode

The pseudocode is a very useful and helpful tool in algorithm development. It offers many advantages and it has some disadvantages too.

Pseudo-code Advantages

  • It uses a language similar to everyday English, thus is easy to understand.
  • It highlights the sequence of instructions.
  • The structure of an algorithm is clearly visible through pseudocode, e.g., selection and repetition blocks.
  • Pseudocode can be easily modified without worrying about any dependencies.

Pseudo-code Disadvantages

  • It is not a visual tool like flowcharts.
  • Since there is no accepted standard for pseudocode, so it varies from programmer to programmer.
  • It can only be tried on paper, there is no program available to try it.
  • It is an informal representation of an algorithm.

Verifying an Algorithm

Verification of an algorithm means ensuring that the algorithm is working as intended. For example, if you have written a program to add two numbers but the algorithm is giving you the product of the two input numbers. In this case, the algorithm is not working as intended.

What is an algorithm?

An Algorithm refers to a sequence of instructions, a finite set of commands, or a method of working. It can be represented as a sequence of instructions to be carried out until an endpoint is reached as per the rules, conditions, or sequence by which the computer or people tackle a problem or situation.

Discuss two common tools for developing an algorithm.

Two common tools for developing an algorithm are flowchart and pseudocode. A flowchart is a diagrammatic or pictorial/graphical representation that illustrates the sequence of operations to be performed for the solution of a problem. Pseudocode is an idiomatic high-level description of a computer program or algorithm. It is written in symbolic code in English which must be translated into a proper code using a specific programming language.

The word 'algorithm' comes from the ninth-century Arab mathematician, Al-Khwarizmi, who performed on 'written processes to achieve some purpose.' The term 'algebra' also comes from the term 'al-jabr,' which he presented.

Then how do you verify an algorithm?

Ohh, yeah you're right - we should test it with a sample input for which we know the output; if the expected output matched with the output produced by the algorithm, the algorithm is verified.  This is really useful, but for larger algorithms, we may want to verify the medium results too of various steps of the algorithm. And for such conditions, a useful tool for verifying algorithms called Dry-Run is used.

A dry run is the process of a programmer manually working via their code to trace the importance of variables. There is no software involved in this method.

Traditionally, a dry run would involve a printout of the code. The programmer would sit down with a pen and paper and manually follow the importance of a variable to check that it was used and updated as expected.

If a programmer discovered that the value is not what it should be, they are able to identify the area of code that resulted in the error.

Characteristics of a dry run are:

  • It is carried out during design, implementation, testing, or maintenance.
  • It is used to identify the logic errors in a code.
  • It cannot find the execution errors in a code.

Trace Tables

Dry running an algorithm is carried out using trace tables where the impact of each line of the code is seen on the values of variables of the algorithm. As per the line of the code, the processing that takes place is applied to the variables' values.

For example, we want to calculate the double of the numbers in sequences 1, 2, and 3 and print the value as 1 added to the double value:

1. FOR number 1 TO 3 2. Val number * 2 3. PRINT Val + 1

The trace table for the above code will record the code movement and its impact on the variables, line by line :

Problem Solving (Pseudocode, Algorithm & Techniques)

trace table

So the given code's trace table will be as shown above when the code is dry-run. The above-given trace table has documented the impact of each line of the code separately.

However, you can skip this style and simply show the impact of code on variables too, e.g., shown below:

Problem Solving (Pseudocode, Algorithm & Techniques)

the impact of code on variables

You can choose to skip line numbers too if you want as we have done in the example below.

EXAMPLE 12 Dry-run the code given below and show its trace table.

num ← USER INPUT

WHILE num < 500 THEN

num ← num * 2

count ← count + 1

PRINT count

problem solving techniques algorithm flowchart pseudocode

Comparing Algorithms

To solve a problem, many a time, in fact, mostly multiple solutions are available. In other words, you may have multiple algorithms which work correctly and produce the correct, desired results. In such a case, which algorithms should you choose for coding?

In order to decide which algorithm to choose over another, their efficiency will be the deciding factor.

Major factors that govern the efficiency of an algorithm are:

  • the time it bears to find the solution and
  • the resources which are consumed in the method.

For instance, while buying a car, how do you choose a car from the available choices? Yup, you are absolutely right; you might consider both the speed and the fuel consumption. The factor that matters the most to you, will win

Similarly, for algorithms, the two deciding factors are :

Space-wise efficiency.

How much amount of (memory) space the algorithm will take up before it terminates? For this, we consider the amount of data the algorithm uses while running.

Time-wise efficiency.

How much time accomplishes the algorithm take to finish? This factor is dependent on so many issues like RAM available, the programming language is chosen, the hardware platform, and many others.

When you have a hardware platform fixed with a specific RAM size, then space efficiency becomes the deciding factor and the algorithms that take less space are chosen. With this, we have come to the end of this article. Let us quickly revise what we have learned so far in this chapter.

Keep reading

More posts from our blog

Digital Number System (Data Representation)

Chapter: Computer Programming

Algorithm, pseudocode and flowchart.

·         Set of step-by-step instructions that perform a specific task or operation

·           ―Natural‖ language NOT programming language

·         Set of instructions that mimic programming language instructions

·         Visual program design tool

·         ―Semantic‖ symbols describe operations to be performed

Definitions:

A flowchart is a schematic representation of an algorithm or a stepwise process, showing the steps as boxes of various kinds, and their order by connecting these with arrows. Flowcharts are used in designing or documenting a process or program.

A flow chart, or flow diagram, is a graphical representation of a process or system that details the sequencing of steps required to create output.

A flowchart is a picture of the separate steps of a process in sequential order.

High-Level Flowchart

A high-level (also called first-level or top-down) flowchart shows the major steps in a process. It illustrates a "birds-eye view" of a process, such as the example in the figure entitled High-Level Flowchart of Prenatal Care. It can also include the intermediate outputs of each step (the product or service produced), and the sub-steps involved. Such a flowchart offers a basic picture of the process and identifies the changes taking place within the process. It is significantly useful for identifying appropriate team members (those who are involved in the process) and for developing indicators for monitoring the process because of its focus on intermediate outputs.

Most processes can be adequately portrayed in four or five boxes that represent the major steps or activities of the process. In fact, it is a good idea to use only a few boxes, because doing so forces one to consider the most important steps. Other steps are usually sub-steps of the more important ones.

Detailed Flowchart

The detailed flowchart provides a detailed picture of a process by mapping all of the steps and activities that occur in the process. This type of flowchart indicates the steps or activities of a process and includes such things as decision points, waiting periods, tasks that frequently must be redone (rework), and feedback loops. This type of flowchart is useful for examining areas of the process in detail and for looking for problems or areas of inefficiency. For example, the Detailed Flowchart of Patient Registration reveals the delays that result when the record clerk and clinical officer are not available to assist clients.

Deployment or Matrix Flowchart

A deployment flowchart maps out the process in terms of who is doing the steps. It is in the form of a matrix, showing the various participants and the flow of steps among these participants. It is chiefly useful in identifying who is providing inputs or services to whom, as well as areas where different people may be needlessly doing the same task. See the Deployment of Matrix Flowchart.

ADVANTAGES OF USING FLOWCHARTS

The benefits of flowcharts are as follows:

1.      Communication : Flowcharts are better way of communicating the logic of a system to all concerned.

2.    Effective analysis : With the help of flowchart, problem can be analysed in more effective way.

Proper documentation : Program flowcharts serve as a good program documentation, which is needed for various purposes.

4.     Efficient Coding : The flowcharts act as a guide or blueprint during the systems analysis and program development phase.

5.    Proper Debugging : The flowchart helps in debugging process.

6.     Efficient Program Maintenance : The maintenance of operating program becomes easy with the help of flowchart. It helps the programmer to put efforts more efficiently on that part

Advantages:

·         Logic Flowcharts are easy to understand.They provide a graphical representation of actions to be taken.

·         Logic Flowcharts are well suited for representing logic where there is intermingling among many actions.

Disadvantages :

·         Logic Flowcharts may encourage the use of GoTo statements leadingsoftware design that is unstructured with logic that is difficult to decipher.

·         Without an automated tool, it is time-consuming to maintain Logic Flowcharts.

·         Logic Flowcharts may be used during detailed logic design to specify a module.

·         However, the presence of decision boxes may encourage the use of GoTo statements, resulting in software that is not structured. For this reason, Logic Flowcharts may be better used during Structural Design

LIMITATIONS OF USING FLOWCHARTS

1.      Complex logic : Sometimes, the program logic is quite complicated. In that case, flowchart becomes complex and clumsy.

2.       Alterations and Modifications : If alterations are required the flowchart may require re-drawing completely.

3.    Reproduction : As the flowchart symbols cannot be typed, reproduction of flowchart becomes a problem.

4.    The essentials of what is done can easily be lost in the technical details of how it is done.

GUIDELINES FOR DRAWING A FLOWCHART

Flowcharts are usually drawn using some standard symbols; however, some special symbols can also be developed when required. Some standard symbols, which are frequently required for  flowcharting many computer programs.

problem solving techniques algorithm flowchart pseudocode

The following are some guidelines in flowcharting:

(a)                           In drawing a proper flowchart, all necessary requirements should be listed out in logical order.

(b)                          The flowchart should be clear, neat and easy to follow. There should not be any room for ambiguity in understanding the flowchart.

(c)                           The usual direction of the flow of a procedure or system is from left to right or top to bottom.

(d)                          Only one flow line should come out from a process symbol.

problem solving techniques algorithm flowchart pseudocode

(e)                           Only one flow line should enter a decision symbol, but two or three flow lines, one for each possible answer, should leave the decision symbol.

problem solving techniques algorithm flowchart pseudocode

(f)                            Only one flow line is used in conjunction with terminal symbol.

problem solving techniques algorithm flowchart pseudocode

(g)                           Write within standard symbols briefly. As necessary, you can use the annotation symbol to describe data or computational steps more clearly.

problem solving techniques algorithm flowchart pseudocode

(h)                          If the flowchart becomes complex, it is better to use connector symbols to reduce the number of flow lines. Avoid the intersection of flow lines if you want to make it more effective and better way of communication.

(i)                               Ensure that the flowchart has a logical start and finish.

(j)                               It is useful to test the validity of the flowchart by passing through it with a simple test  data.

   

Sample flowchart

A flowchart for computing factorial N (N!) Where N! = 1 * 2 * 3 *...* N. This flowchart represents a "loop and a half" — a situation discussed in introductory programming textbooks that requires either a duplication of a component (to be both inside and outside the loop) or the component to be put inside a branch in the loop

Sample Pseudocode

ALGORITHM Sample

WHILE There Is Data

DO Math Operation

END ALGORITHM

problem solving techniques algorithm flowchart pseudocode

Related Topics

Privacy Policy , Terms and Conditions , DMCA Policy and Compliant

Copyright © 2018-2024 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.

COMMENTS

  1. Pseudocode and Flowcharts

    With pseudocode in hand, the algorithm can be programmed in any language. Here it is in Python: # 1. Input the `password` that we plan to validate. password = "c0decademy". # 2. To keep track of the password length, establish a `pass_length` variable and initially set it to `0`. pass_length = 0.

  2. 1.3: Activity 3

    Explain the role of each. 1.3: Activity 3 - Using pseudo-codes and flowcharts to represent algorithms is shared under a CC BY-SA license and was authored, remixed, and/or curated by LibreTexts. The student will learn how to design an algorithm using either a pseudo code or flowchart. Pseudo code is a mixture of English like statements, some ...

  3. Pseudo-Code and Flowcharts for Problem Solving

    Psuedo-Code. The problem is programming code isn't easy for humans, the ones writing the code, to understand. That's where pseudo code comes in. Pseudo-code is meant for humans to read. It doesn't need to be parsed by an interpreter and so the need for strict syntactical precision fades away. The human mind is far more powerful and ...

  4. PDF Algorithms, Flowcharts and Pseudocodes

    to solve a problem, except: Steps in algorithm may be less detailed, a pseudocode describe those steps. Steps in an algorithm look more like an English (natural) language instructions, whereas, steps in a pseudocode may look more like a code. • For example: A step in algorithm may be written like this: Convert feet into inches.

  5. Algorithms, flowcharts, and pseudocode.

    Overview, Objectives, and Key Terms¶. In this lesson, we'll dive right into the basic logic needed to plan one's program, significantly extending the process identified in Lesson 2.We'll examine algorithms for several applications and illustrate solutions using flowcharts and pseudocode.Along the way, we'll see for the first time the three principal structures in programming logic ...

  6. 1: Algorithmic Problem Solving

    1.1: Activity 1 - Introduction to Algorithms and Problem Solving. In this learning activity section, the learner will be introduced to algorithms and how to write algorithms to solve tasks faced by learners or everyday problems. Examples of the algorithm are also provided with a specific application to everyday problems that the learner is ...

  7. Flowcharts and Pseudocode

    Let's try more such Flowchart and pseudocode based problems. Remember, this is the first step to problem solving!! Problem Statement: Find the largest among three different numbers entered by the user. (You can skip to check these steps and try on your own) Step 1: Mark the start of the algorithm. Step 2: Declare a,b,c the three numbers

  8. Pseudocode and Flowcharts

    Embracing pseudocode and flowcharts as part of the algorithm design process helps optimize algorithm development and enhance problem-solving skills. In conclusion, harnessing the power of pseudocode and flowcharts is crucial for algorithm designers striving to create efficient and effective solutions.

  9. Flowchart vs. Pseudocode: Algorithm Design

    In algorithm design, both flowcharts and pseudocode play crucial roles in breaking down complex problems into bite-sized steps. While flowcharts offer a visual representation of an algorithm's flow, pseudocode provides a human-readable and programming language-agnostic description of the logic. By leveraging the strengths of both methods ...

  10. Flowchart vs. Pseudocode: Algorithm Representation

    4. Balancing Simplicity and Detail. Flowcharts often provide a high-level overview of an algorithm, making it easier to understand the overall flow. However, when you need to communicate intricate details or specific steps of a process, pseudocode can offer a more concise and detailed representation. Pseudocode allows you to describe each step ...

  11. Flowchart vs. Pseudo Code: Visualizing Algorithms and Logic

    While flowcharts are graphical representations, pseudo code is a textual representation of an algorithm or logic. It uses natural language mixed with simple programming constructs to describe the steps involved in solving a problem. Pseudo code is not tied to any programming language syntax, allowing for flexibility and readability.

  12. What is PseudoCode: A Complete Tutorial

    Pseudocode Examples: 1. Binary search Pseudocode:. Binary search is a searching algorithm that works only for sorted search space. It repeatedly divides the search space into half by using the fact that the search space is sorted and checking if the desired search result will be found in the left or right half.. Example: Given a sorted array Arr[] and a value X, The task is to find the index ...

  13. Algorithm Pseudocode Programs and Flowcharts

    At the end of this article, you will understand mostly What are Algorithms, what is Pseudocode, What are Programs, and what are Flowcharts. Algorithm, Pseudocode, Programs, and Flowcharts. Algorithm: An algorithm is a step-by-step procedure for solving a computational problem. It is a process or set of rules to be followed in calculations or ...

  14. Flowchart and Pseudocode Introduction.

    A Flowchart is a diagrammatic representation of an algorithm, workflow, or process. It represents a step-by-step approach to solving a problem. The lines and arrows in it show the sequence of steps and the relationship among them. It uses different shapes and arrows to depict the sequence of actions and decision points in a program.

  15. Flowcharts and Pseudocode: Building Blocks for Effective Problem

    Now, let's delve into Pseudocode, the unsung hero of data science problem-solving. Pseudocode is a high-level description of an algorithm that combines elements of natural language and simple ...

  16. The basics of working with pseudocode

    Writing pseudocode is a great way to practice problem-solving skills, a crucial aspect in programming. It helps developers conceptualize and communicate their ideas. Transforming an idea into a functional program involves a series of structured steps. Before the code is written and the program is tested, there's a critical phase where the logic ...

  17. Algorithm and Flowchart PART -2

    This video describes algorithm, flowchart and Pseudocode in very easy way with examples. #Algorithm_and_Flowcharts #Pseudocode#magnustrainingacademyalgorith...

  18. Pseudocode vs. Flowchart: Visualizing Algorithms

    They can be used as a means of communication between different stakeholders, including programmers, designers, and business analysts, as they offer a clear and concise overview of the problem-solving approach. Key Differences: Pseudocode vs. Flowcharts. While both pseudocode and flowcharts serve the purpose of visualizing algorithms, they ...

  19. Lab 2 : Problem Solving Techniques, Algorithm: Pseudo Code and Flowchart

    LAB 2 : PROBLEM SOLVING TECHNIQUES, ALGORITHM: PSEUDO CODE AND FLOWCHART LAB INTRODUCTION Prepared by: Cik Noor Syazana bt Arshad. The printf function Prepared by: Cik Noor Syazana bt Arshad. Formatted Output with "printf" #include <stdio.h> int main (void) { intiMonth; float fExpense, fIncome; iMonth = 12; fExpense = 111.1; fIncome = 1000.0; printf ("The Month is %4d and the Expense is ...

  20. Title: Understanding Flowcharts and Pseudocode in Java: A ...

    Flowcharts and pseudocode are invaluable tools for any Java programmer. By mastering these techniques, you can streamline your development process, write more efficient code, and tackle complex ...

  21. Problem Solving (Pseudocode, Algorithm & Techniques)

    Two common tools for developing an algorithm are flowchart and pseudocode. A flowchart is a diagrammatic or pictorial/graphical representation that illustrates the sequence of operations to be performed for the solution of a problem. Pseudocode is an idiomatic high-level description of a computer program or algorithm.

  22. Example Programming Algorithm, Pseudocode, Flowchart

    ILLUSTRATIVE PROBLEM . 1. Guess an integer in a range . Algorithm: Step1: Start. Step 2: Declare hidden, guess. Step 3: Compute hidden= Choose a random value in a range. Step 4: Read guess. Step 5: If guess=hidden, then. Print Guess is hit. Else. Print Guess not hit. Print hidden. Step 6: Stop . Pseudocode: BEGIN. COMPUTE hidden=random value in ...

  23. Algorithm, Pseudocode and Flowchart

    Flowcharts are used in designing or documenting a process or program. ALGORITHM. Algorithm. · Set of step-by-step instructions that perform a specific task or operation. · ―Natural‖ language NOT programming language. Pseudocode. · Set of instructions that mimic programming language instructions. Flowchart.