7 Basic Algorithms Every Newbie Coder Should Know: Part 1

Manvendra Bhadauria
CodeX
Published in
5 min readJul 31, 2021
Gaming Keyboard with RGB , 7 Algorithms Every Newbie Coder Should Know.

Welcome Everyone, to this small series of 7 Algorithms Every Newbie Coder Should Know. This series will consist of three articles in order to make these algorithms easy to digest and make sure none of my newbie coding enthusiasts (me being one myself) get choked with all the data crunching.

We all are aware that change is continuous and this statement stands true for the field of programming too & with time we all have seen a huge wave of various new algorithms for a variety of use cases but not everything has changed some of the algorithms survived this change and these are the one’s which we will cover in this series.

Here’s the set of articles in this series:

This guide is meant to be a quick & concise reference for beginners, covering the most basic yet widely used algorithms.

So, here is the first part Introduction To Algorithms of this article series we’ll go over the definitions of various terminology like algorithms, flowcharts, and pseudo code et cetera, as well as their importance and several other little facts that will aid you along your coding adventure and in understanding this series of articles in a better way.

ALGORITHMS

While we’ve all heard of the term algorithm, many of us have never read a formal explanation of it, and all we know in layman terms is that it’s a procedure. So, let’s look at the meaning of the term algorithm and see if we can have a better understanding of it.

Definition : In mathematics and computer science, an algorithm is a finite sequence of well-defined, computer-implementable instructions, typically to solve a class of specific problems or to perform a computation. Algorithms are always unambiguous and are used as specifications for performing calculations, data processing, automated reasoning, and other tasks.

So, let’s put the preceding description into context by comparing it to a real-life situation. Let’s say we want to make tea, and we’ll use a recipe that includes several steps that must be completed in a specific order to produce a creamy rich tea. Let’s apply this to programming and say that the Making Tea was the Problem Statement, the Recipe was the Procedure, and the Ingredients were the Input, while the final product Tea was the Output.
So an algorithm is just a simple process that is followed to solve a particular problem or perform some calculation or various other use cases for example Linear Regression Algorithm that is used to predict real numeric values from linear data.

Keep in mind that an algorithm does not necessarily have to be written in code; it might begin as plain English and then be converted to a flowchart and then to pseudocode or we can just directly code it in any programming language as there is no hard and fast rule for this. Next, we will be talking about Flowcharts & Pseudocodes.

FLOWCHARTS

Whatever the case may be, we have all seen flowcharts at some point in our lives, and they are really valuable, as we will discuss later in this article. Let’s take a look at the formal definition of a flowchart and then split it down just like we did with the definition of algorithm.

Definition : A flowchart is a type of diagram that represents a workflow or process. A flowchart can also be defined as a diagrammatic representation of an algorithm, a step-by-step approach to solving a task.

Flowchart , code on number is even or odd.
Flowchart: Number is even or odd

On the left, you can see an example of a simple flowchart that outlines an algorithm for determining if a number is even or odd. Take a look at the diagram and try to comprehend it; you’ll notice how simple it is to comprehend the stages that the algorithm employs. A flowchart has several different types of boxes, each with its own meaning. In this article, we’ll look at the most fundamental ones :

  • Oval or Pill Shape — Represents the start or end
  • Rectangle Shape — Represents a process
  • Diamond Shape — Represents a decision/condition
  • Parallelogram — Represents input/output

So this flowchart simplifies the technique in a compact figure that clearly shows that if the number is divisible by 2, it is even, and if it is not, it is odd. As a result, it’s evident that flowcharts help us remember information for longer by making the phases of an algorithm more plain and straightforward to follow. A separate article on flowcharts will be made later on so stay tuned for that.

PSEUDOCODE

Pseudocode will be the last topic we’ll cover in this article. I hope that while reading articles on websites like GFG and W3Schools, everybody and everyone saw something written in simple English before the actual code. That is what is called pseudocode.

Definition : In computer science, pseudocode is a plain language description of the steps in an algorithm or another system. Pseudocode often uses structural conventions of a normal programming language, but is intended for human reading rather than machine reading. It typically omits details that are essential for machine understanding of the algorithm, such as variable declarations and language-specific code.

The diagram on left provides an example of pseudocode for the identical flowchart that was utilized, and as you can see, we just transformed the flowchart to plain English. The primary benefit of pseudo code over flowcharts is that it is more concise and easier to comprehend.

Conclusion

The ideal pipeline for designing/implementing an algorithm is to first think about the steps that will be employed, then translate that notion into a flowchart, and then finally convert the flowchart into pseudocode before actually executing/implementing the algorithm. Though it is a good practice to do so, it is not necessary to follow this pipeline for all algorithms because this procedure takes time and so we can use it when we are new to programming or the algorithm is particularly difficult to develop/implement.

Part 2 & Part 3 of this series will be published very soon in which we will be talking about the 7 Basic Algorithms Every Newbie Coder Should Know.

Editors Note : This is my first article so take me as a novice and please give your feedback in the comments.

--

--

Manvendra Bhadauria
CodeX
Writer for

Philomath | Data Science Enthusiast ❤ | Learning and Sharing