intro to algorithms Flashcards
what is a program
A collection of computer instructions or operations grouped together in a logical manner to accomplish a given task.
What are the six Basic computer operations?
A computer can:
-receive information
-repeat a group of actions
-output information
-perform arithmetic
-assign a value to a piece of data
-compare two pieces of date and select one of two alternative actions
what is an algorithm?
it is a set of instructions or steps that are detailed, ordered and unambiguous that are developed to describe the processes necessary to produce a desired output from a given input to accomplish a task.
an algorithm can be represented using
-flowchart
and
-pseudocode
what is pseudocode?
It is a high level description of a computer program or algorithm that uses simple, English-like statements to outline the basic logic of the program
what are the Benefits of pseudocode
-Simplifies the logic of a program
-makes it easy to communicate the logic of the program to non programmers.
-can prevent common mistakes and save time.
what are the steps to writing pseudocode
- understand the problem
2.Break down the problem into steps - write the pseudocode
- test the pseudocode
- translate the pseudocode into actual code
What are the steps to developing a program?
1.define he problem
2. outline the problem
3. develop the outline into an algorithm
4. test the algorithm for correctness
5. code the algorithm into a specific programming language
6. run the program on the computer
7. document and maintain the program.
what is a flow chart?
a flow chart is the graphical representation of computer logic it shows the flow of input and ouput and processes throughout the program.
what is program documentation?
this is the continuous record of the process of the program through out its creation and evaluation.
what are the two types of documentation?
external and internal documentation. external documentation includes hierarchy charts, the solution algorithm, and test data results. internal documentation is coded into the actual program and by be comments the programmer made while coding.
what is program maintenance?
Program maintenance refers to changes which may need to be made to a program throughout its usage.
what is selection control structure?
this refers to the capablity of the computer to make a decision. This deision is based on a conidtion and the action sthat can be taken given that the condition has been meet or not. In order to do so the computer program by use IF THEN ELSE, DO WHILE and CASE OF
what are the types of if statements
simple selection
simple selection with null branch
combined selection
nested if
what is a simple if and give and example
a simple if statement is when computer is given a condition and has the choice of doing one or the other action based on the condition.
e.g IF input/2 = 0
THEN PRINT “even”
ELSE PRINT “odd”
END IF