Section 1 - Fundamentals Of Algorithms Flashcards
What is an algorithm?
An algorithm is a series of steps that can be followed to complete a task.
What is decomposition?
Decomposition involved breaking down a problem into smaller, simpler steps.
What is abstraction?
Abstraction involves removing unnecessary details from a problem in order to solve it.
What are flowcharts?
Flowcharts are diagrams which use certain symbols to show the flow of data
What does the oval represent in a flowchart?
The START and END
What does the quadrilateral represent in a flowchart?
It is a process box. (E.g 1 + 1)
What does the parallelogram represent in a flowchart?
This is an input and output box
What does the diamond represent in a flowchart?
This is a decision box that can only accept yes or no answers
What is pseudocode?
Pseudocode is used to write an algorithm in programming-style constructs but it is not in an actual programming language
What are the 3 constructs used to write algorithms?
Sequence, selection and iteration
What is selection?
If, elif and else
What is sequence?
Sequence is just the order code goes in.
What is iteration?
For, while and repeat
What are the 2 common search routines?
Linear and binary searches
What is a linear search?
When data is unsorted, the only sensible option when searching for a particular item is to start at the beginning and look at every item until you find the one you want
What is a binary search?
If the list is sorted, it repeatedly divides in half the data, that could contain the required data item
What are the 2 kinds of sorting algorithm?
Bubble and merge sort
What is bubble sort?
A bubble sort works by repeatedly going through the list to be sorted comparing each pair of adjacent elements. If the elements are in the wrong order they are swapped.
What is merge sort?
This is a 2 stage sort, in the first stage, the list is successively dividing in half, forming sublists, until each sublist is of length one. Then all the numbers recombine with the numbers swapping with whichever one is higher.