 Hello everyone. Welcome to the lecture on Introduction to Computer Algorithm. At the end of this session, students will be able to define, list and represent an algorithm, differentiate between algorithm, pseudocode and program, describe time and space complexity of an algorithm. In this introductory session, we will get ourselves familiarized with algorithm. We will learn what an algorithm is, what it does, why is it needed, notion of algorithm, properties of algorithm and finally understand how to analyze an algorithm. We will start with an overview of algorithm through an example and then discuss its properties and detail. Algorithm is nothing fancy. It's just a method of doing something. For instance, let's say, as the visual on the screen, Pikachu has to visit his friend tonight. He can do this in many ways. What matters is which method he chooses. As seen in the given diagram here, there are three possible options to Pikachu. Route A, Route B, Route C. The method he picks would determine the time taken for him to reach his friend. We deal with such scenarios on daily basis. Algorithms are everywhere, literally everywhere. What I mean is there is no escape from algorithm. What are algorithms and why you should care for them? The word algorithm is derived from the name of Muhammad in Musa al-Qarizmi, a Muslim mathematician whose works are introduced in the algebraic concepts in 825 AD. Basically, an algorithm is a finite set of instruction that accomplishes a particular task, a step-by-step procedure for solving a computational problem. Then what is the program? It is also a step-by-step procedure for solving computational problem. Then what is the difference between a program and an algorithm? So by comparing an algorithm and program, we will understand and then differentiate between an algorithm or program. Consider for a software development cycle. Developing a software project, there are two important phases, design phase and implementation phase. So at the design phase, what we do is write a program in simple English on a piece of paper or even if you are using a machine, you will write it on Word. That is, an algorithm is basically written at design time whereas the same thing, if you are writing to implement, then it is a program. A program is written at implementation time. When you write an algorithm, the person writing an algorithm should have the domain language, domain knowledge of any language and that can be a vernacular language like English, Hindi, Marathi. So he should be able to just convey what the requirements are. Consider that you want to develop a system for hospital management. So that person who is writing an algorithm must be able to know the domain knowledge about the working of hospital. When that is to be taken on in the implementation phase, the person doing it must be a programmer and should be knowing and must be proficient in any programming language for that matter C, C++, Java, PHP, Python. Now, algorithm is finite. Program need not be finite. Algorithm is written using natural language or logarithmic language. As I said some time back, it can be any vernacular language whereas a program are written using specific syntax of that particular programming language. They are not written in vernacular language. They are either written as per the standard coding convention. One important thing, the algorithm is independent of the hardware and the software whereas the program is dependent on the hardware or the software. For running a particular program in C, you require its software that is Turbo CC++. And finally, the most important thing is that we analyze an algorithm. We test a program. So it is very important for us to analyze the algorithm. Now, what is a computer algorithm? A computer algorithm is a detailed step-by-step method for solving a problem using computer. As you can see in the diagram over here, you have input, you have output and you see that the problem being solved through a computer. Now, this is all about the computer algorithm. All the algorithms, maybe a computer algorithm, maybe a general algorithm must satisfy some criteria. So the criterias are nothing but the characteristics. So the characteristics of algorithm include input, output, definiteness, finiteness, effectiveness. So input means zero or more quantities are externally supplied. Output is at least one output must be produced. Finiteness is each instruction is clear and unambiguous. Finiteness means algorithm must terminate after a finite number of steps. Example, web server keeps on running. So it should not be in a loop. It should much terminate after some finite number of steps or time. Effectiveness is each instruction is basic enough to be carried out. When we say no ambiguity, which means no ambiguity in any instruction, no ambiguity which instruction is executed next. That is the programmer must not be in the confusion. Like what, which is the instruction that I am expected to execute next and also the execution must halt and produce a result. Now representation of an algorithm, one of the very important criteria. We say that algorithm is written or represented in n number of ways. So the possible options for representing an algorithm is the natural language, the graphic representation that is called as the flow charts and also one of the important conventions is the pseudo code conventions that resemble the C++ or Java or Pascal program. So an algorithm can be represented in any of these one way. It is the natural language, the graphic representation that is the flow chart and the pseudo code convention. Now here we show an example where the algorithm to find maximum of three numbers is given. Here it is used in simple English language. You can see over here. It is basically a sequence of steps that provides a solution for the given problem that is finding the maximum of three numbers. There are six steps and simply written in English language. Now then what is the difference between the pseudo code? Now pseudo code is one of the method that can be used to represent an algorithm. Pseudo code is written in a format that is similar to the structure of high level programming language. Now you can see over here, here the code pseudo code is to find the maximum of three numbers and the three numbers are written in a higher level programming language that is read A, read B, read C. If the conditional statements have been used for whereas here the sentences were used, here the conditional operators and if else and then loops are used to write the same program that is for finding the maximum of the three numbers. Now further the program. The program on the other hand allows us to write a code in a particular programming language like C or C++. Now this is the same program for finding the maximum of three numbers. Here this program is written in a programming language and the programming languages syntaxes are mentioned here like variable declaration, the header files including the specific format. Therefore you can see in this diagram the algorithm here is written in English language, pseudo code in high level programming language whereas the C program basically uses the syntax declaration loop statements to perform the same task. Now aspect of algorithm design is basically in creating an efficient algorithm to solve a problem in an efficient way and that too using efficient that is minimum time and space. So how this can be done? So we need to do analysis, we need to do an analysis of the algorithm that is at two different stages. One is before implementation and the after implementation. The analysis that is done before implementation is called as a prior analysis and the implementation analysis that is done after implementation is called as the posterior analysis. So a prior analysis is done on the algorithm and posterior analysis is done on the program. A prior analysis is independent of the language and the hardware whereas posterior testing is language and hardware dependent. It means we do analysis of space and time of an algorithm here we it means we do analysis of an algorithm only after running it on the system through a specific code. So it directly depends on the system and changes from system to system that is the watch time whereas here we determine time and space complexity just by seeing the algorithm rather than running it on a particular system. Now complexity of an algorithm that is basically analyzed in two perspectives the time complexity and the space complexity. So time complexity it's a function describing the amount of time required to run an algorithm in the terms of size of input whereas it depends on the function of size of the input okay that is rate of growth of running time. Now space complexity it's a function describing the amount of time an algorithm takes in terms of size of input to the algorithm pause the video for some time and answer the question which of the following is incorrect algorithm can be represented as ABC correct answer is as syntax. When an algorithm is written in the form of a programming language it becomes a flowchart program pseudo code syntax program. These are the any algorithm is a program true or false? False. These are the references. Thank you.