Transcript for:
Introduction to Algorithm Design Concepts

We're going to discuss about algorithm design. First, let us define algorithm. Algorithm is a step-by-step procedure in solving a problem and it is a list of sequence procedures in carrying out a particular task. So in this case, we perform a particular task. It's either sequentially or we can actually include a decision making or a repetition. It does not follow any grammatical rules. That means there's no syntax for doing the algorithm and it represents a high level of solution to a problem. There are two types of the representation of an algorithm. One is the pseudocode which is an English format or an English-like instructions format and another type of a representation of an algorithm is the flowcharting. We call this as the graphical representation or the grammatic representation of a sequence of events usually drawn with conventional symbols. so later on we will see that symbols representing different types events and their interconnections flow charts or pictorial representation and a pseudocode and english-like representations written in instructions are used by programmers to plan the logical steps for solving a programming problem Some professional programmers prefer writing as pseudocode to drawing flowcharts because using pseudocode is much more similar in writing final statements in different programming languages such as C++, Python, Visual Studio. In flowchart, there are two types of flowchart. We call it system flowchart. It represents the total picture. without worrying about taking care of every detail and the other one is a program flow chart and it depicts a main segment of a complete computer program so in our case we're going to focus on program flow charts these are the following examples of a flow charting symbol number one we call this as the terminal symbol okay The terminal symbol denotes the start and the end of the flowcharting. So we can include or insert text from this particular symbol and denote it as the start or the word end. The next symbol is the initialization or the preparation symbol. If in case you have a constant at the first part of your flowcharting, you can include this initialization or preparation symbol and put the variable that we need of constant value. Next symbol is the input and output symbol or output box. So here we're going to include our input values and we're going to display or output the variables within this particular symbol. And we have another symbol we call it as a decision box. A decision box handles conditions. Another type of flow charting symbols are the process box. So we include arithmetic operations within this particular symbol. Let's say, for example, if you want to get the sum of all numbers, you need to use this type of symbol. This type of symbol is used to process arithmetic operations. This symbol is actually a connection or we call it a flow line to connect each symbols within the flow chart. then we have another symbols the on page and the off page connector so on page connector is used if for example you are on the same page but you do not have any more much space on the first column and you need to use the second column so you need to connect it with an on-page connector to connect it from the first column to the second column for the off-page connector we use this if for example our first page has been already used up with the flow charting and you need to use another paper to complete and to continue your flow chart you need to use the off page connector and denote those page connectors with either label of letters or label of numbers. The following are the general logic in doing flowchart and in pseudocode. Number one is sequential flowcharting and pseudocode. Next is branching or we call it conditional. or selection flow charting and pseudocode the third one is we call it looping or iterative program structure and the other one is a combination meaning combination of sequential branching and looping please take note that almost every program involves the steps of input processing and output necessitating some graphical way to separate them so make sure that we're going if we're going to start doing um the flow charting and the pseudo hood we need to first analyze what should be the input what must be the process to make the output program elements and structure To complete the flowchart and the pseudocodes, we need to have program elements and structure. So these are the program elements and structure needed for flowcharting and pseudocode. Number one is constant. A constant is a literal value that does not change during program execution. It can be a numeric format or a numeric type, a character type, or a string type. So let's define first a numeric constant. Numeric constant may be an integer, we call it whole number, or a real number, or we call it decimal place or with fractional components. And a numeric constant may be preceded by a positive or a negative sign. So these are examples. 10 is a valid numeric constant. Negative 28. preceded by a negative sign is a valid numeric constant positive 3.4 preceded by a positive sign with a decimal place using dot symbol or period symbol is a valid numeric constant negative 0.413 is also a numeric constant 0 also and 201 is a valid one take note that there are no other characters except for period or dot can appear together with constants. So these are the following examples of incorrect numeric constants. 10,000 using a comma sign, so to make it correct and valid, so omit the comma. Next is 14.3 with dollar sign, so to make it valid, just omit the dollar sign. 10 miles per hour unit of measurement, so to make it valid, omit miles per hour and for this one half this is also a valid one but in case it is invalid how to make it a valid one one half is equivalent to 0.5 so use 0.5 instead of one half another type of constant is character constant A character constant is enclosed with single quotation mark and it includes numbers 0 to 9, letters A to Z, either a small letter or a big letter, an all special character like a space, comma, percent sign, dollar sign, dash, underscore sign, ampersand sign, etc. may be included. So these are examples of a valid character constant. A J that is enclosed with single quotation mark. percent sign that is enclosed with single quotation mark a period that is enclosed with a single quotation mark is considered as a character constant number one since this is enclosed with single quotation mark we cannot say that one is a numeric constant but rather a character constant g also an example of a character constant that is enclosed with single quotation mark again Thanks for watching!