2.1 – Algorithms Flashcards
What is abstraction?
- Removing unnecessary details and including only the relevant ones
- Focuses on what is important in problem solving
What is decomposition?
- Breaking down a complex problem into small, more manageable parts
- Makes problems easier to solve & different people can work on different parts of a problem at the same time
What is algorithmic thinking?
- Getting to a solution by identifying the steps needed
- Creates a set of rules you can follow to lead to an answer
- Can allow a solution to be automated
What is an algoritm?
A sequence of steps designed to perform a particular task
What is an input?
Data that is entered into or received by a computer
What is a process?
A program that is running in a computer
What is an output?
How to computer presents the result of a process
What is a flow diagram?
A method of designing algorithms before coding using symbols
What is a structure diagram?
A diagram that illustrates problem decomposition, produced using a method known as step-wise refinement
How do structure diagrams work?
- Decompose the problem; some areas will need more breaking down than others
- Lowest level nodes should achieve a single task which can then be coded as a single module or sub-program
What is Pseudocode?
An alternative, text-based way of representing the sequence of steps in an algorithm (simplified programming code)
Has no defined syntax so cannot be compiled or interpreted by the computer
What does Pseudocode do?
Lays down the logic of a program in an almost “real code” way without worrying about actual rules & syntax or an actual language
What is a Binary Search?
Accessing the middle record and determining whether the data item has been found
If not, checking whether it is before or after the current record in the data set
Discarding the half of the data set that does not contain the record in each pass
Repeating the algorithm until the data item is found or it is not in the data set
It only works if records in the file are in sequence
What is a Bubble Sort?
Repeatedly steps through a data set comparing each pair of adjacent items
Swaps pairs of items if they are in the wrong order
Stops when no swaps are made
What is an Insertion Sort?
Finds the correct location in a list for an item…
…By comparing it to the other items in the list in a linear way…
…Inserting the new item at the correct position…
…By moving all the other items after it by one index