1.1 Algorithms Flashcards
1
Q
What are Algorithms?
A
- Algorithms are a sequence of instructions that perform a certain task.
- They are completely independent and can be implemented
2
Q
What is Pseudocode?
A
Programmable code written in standard english for easier understanding.
3
Q
What is a Flowchart?
A
Flowcharts also represent data flow, but the shapes have different meanings.
The oval → Start/End
The Square → Process
The Rhombus → Decision
The Parallelogram → Inputs/Outputs
The Lined Rectangle → Subroutines
4
Q
What is a Linear Search?
A
- A linear search checks each element until a match is found, or until the whole list has been checked.
- Uses Brute Force.
5
Q
What is Binary Search?
A
- Binary search is done by dividing a list into two and eliminating the half not containing the targeted element.
- The list must also be ordered.
- Works by simplification.
6
Q
How is a Binary Search conducted?
A
- Find the Midpoint
- Eliminate Unneeded half
- Repeat Until found
7
Q
What is a Bubble Sort?
A
- A bubble sort orders an unordered list
- It does so by making comparisons to adjacent elements and swapping them, largest value to the back
- Each comparison to the full data set is a pass
8
Q
What is a Merge Sort?
A
- Divide and Conquer and Merge:
- The list is first divided into two, keeps splitting until there is one element left
- Sorts the list recursilvely
- Merge the lists from the single elements
9
Q
When should Linear/Binary Search be used?
A
- Linear Search should be used in unordered lists, whilst binary searches require ordered lists.