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
What does diamond indicate?
- Point where decision is made
What does the hexagon indicates?
- The beginning of the repetition structure
What does the double line rectangle indicates?
- Used at a point where a subprogram is used
What does the arrow indicates?
- The direction of flow of the algorithm
What does circles with arrows indicate
- To connect the flowchart between pages
What is the most important and the most often forgotten steps?
- Test Algorithm for Correctness
What is the main purpose for testing algorithm for correctness?
- To identify major logic errors early, so that they may be easily corrected
What do we do when we are in Step 5 : Code th Algorithm?
- Code the algorithm into a specific programming language
What should we do when we are in Step 6 : Run the Program? ( 2 )
- Use the program compiler
- Use programmer-designed test data to machine-test the code for both syntax and logic errors
What are program maintenance
- Refers to changes which may need to be made to a program
What is the oval shape in flowchart indicate?
- The beginning or end of an algorithm
What does the parallelogram indicates in flowchart?
- The input or output of information
What does rectangle indicate in flowchart ?
- A computation ( calculation ) , with the result of the computation assigned to a variable
What does good structured programming refers to? ( 3 )
- Structure Theorem
- Top Down Development
- Modular Design
What does structure theorem in structured programming refers to? ( 3 )
- Sequence
- Selection ( IF - THEN - ELSE )
- Repetition ( DOWHILE )
What does top down development in structured programming refers to? ( 3 )
- Outline general solution
- Break down into detailed steps
- Also known as stepwise refinement or functional decomposition
What does modular design in structured programming refers to? ( 2 )
- Grouping tasks together because they all perform the same function
- Aids in reading and understanding the program
Should we do the program documentation after finishing the program?
- No
- It should start it early and continue throughout the development process
Is writing program documentation an ongoing task? When should it start and when should it end? ( 3 )
- Yes, it was an ongoing task
- Initial definition
- Final test result
What does program documentation includes? ( 2 )
- External Documentation
- Hierarchy Charts
- Solution Algorithm
- Test Data Results
- Internal Documentations