Algorithms (PAPER 2) Flashcards
What are the three key techniques for computational thinking
- Give a brief description of each
- Decomposition
- breaking a complex problem into smaller problems and solving each individually
- Abstraction
- picking out important information and ignore the specifics that do not matter
- Algorithmic Thinking
- a logical way of getting from the problem to the solution. If the steps taken follow an algorithm then they can be reused and adapted to solve similar problems in the future
What is pseudocode
code that is not an actual programming language but follows a similar structure
Why is using pseudocode helpful (2)
- don’t have to worry about syntax (finer details)
- easy to convert into code
Why should pseudocode not be vague
so that it can be converted into code easily
What are boxes with rounded corners used for in flow charts
terminals - beginning and end
What are parallelogram boxes used for in flow charts
anything that is taken out or put into the algorithm
What are rectangular boxes used for in flow charts
general instructions, processes and calculations
What are diamond boxes used for in flow charts
decisions, usually yes or no questions
What are arrows used for in flow charts
connects boxes and show the direction that should be followed
What are sub programs in flow charts
references to other flow charts
What is a sequence in a flow chart
a way to get from start to finish
What is a selection in a flow chart
when there are multiple ways to get from start to finish
What is an iteration
a loop that allows you to repeat a task
What are the two common types of search algorithm
- do the terms have to be sorted or not
Binary Search - the terms must be sorted
Linear Search - the terms can be sorted or unsorted
How does a binary search work
- find the middle item ( (n + 1) / 2 )
- If this is the item then stop
- If not compare the terms - if it is after, then delete the first half and vice versa
- repeat until the item is found