Unit 1 : Algorithm Introduction Flashcards
What is a program? ( 4 )
- Is a collection of computer instructions or operations
- grouped together
- logical manner
- accomplish a given task.
Basic Computer Operations ( 6 )
A computer can:
1. receive information. → input
2. produce information. → output
3. perform arithmetic ( Basic Calculation + , - , * , / )
4. assign a value to a piece of data.
5. compare two pieces of information and select one of two alternative actions.
6. repeat a group of actions.
What is Problem Solving refer to?
- The entire process of taking the statement of a problem and developing a computer program that solves that problem.
What is an Algorithm?
- Instructions to describe the processes necessary to produce the desired output from a given input
Key characteristics of an effective algorithm ( 5 )
- Step-by-step
- Detailed
- Unambiguous ( Must be clear that what is meant )
- Follow logical orders for Coffectness & Efficiency
- Input & Output
What tools can we represent algorithm ? ( 2 )
- Pseudocode
- Flowchart
What are the standard rules to pseudocode? ( 5 )
- Statements are written in simple English. → semiformal
- Each instruction is written on a separate line.
- Keywords and indentation are used to signify particular control structures
- Each set of instructions is written from top to bottom, with only one entry and one exit.
- Write whatever you want but it must be understandable to others ( Pseudocode doesn’t have any standard )
What is the purpose of define the procedual logic of an algorithm using Pseudocode? ( 2 )
- Easy to understand for its readers.
- Free of syntactical complications of programming language. ( a broadmap without using complicated programming language )
What does flowchat use to represent the program logic?
- Shapes ( Geometrical symbols and lines which are connected according to the logic of the algorithm )
- Graphical Representation
What are the steps to develop a program? ( 7 )
- Define the problem.
- Outline the solution.
- Develop the outline into an algorithm.
- Test the algorithm for correctness.
- Code the algorithm into a specific programming
language. - Run the program on the computer.
- Document and maintain the program.
How can we define the problem when developing our program ?
- Divide into 3 separate components
- Inputs : a list of source data provided to the problem
- Outputs : a list of the outputs required
- Processing: a list of actions needed to produce the required outputs
- It can presented in an IPO chart ( Tables dividing Input, Processing and Output )
What does outline the solution do ?
- breaking down the problem into manageable parts and identifying the key components needed to solve it
How can we outline the solution? ( 5 )
- Major processing tasks involved. ( The major processing tasks would include summing the numbers and dividing the sum by the count )
- Major subtasks (if any) ( Other features, like letting user decide how many numbers to sum up )
- Major control structures ( Conditions [ if-else ] , Loops [ while, for ], Functions, Classes )
- Major variables ( sum, num1 , averageNumber )
- Mainline logic ( how to calculate average number )
Example : Write a program to calculate the average of a list of number
How to develop ( write out ) an algorithm using what tools ? ( 2 )
- Pseudocode
- Flowcharts
List out all the common terms used ( 5 )
- Start / End
- Display ( Print )
- Prompt user for ( Read )
- If () Then, Else, Endif
- Dowhile (), Enddo
- We can also write it in our own ways
Write ENDIF in the last if or elseif or else statement
Same as Enddo