Algorithms Flashcards
Name 3 characteristics of an Algorithm
- Unambiguous
- Sequence of steps
- Provides a solution to a problem
What does an OVAL indicate in flowcharts?
start/end of an algorithm
What does a ROUNDED RECTANGLE indicate in flowcharts?
indicates a process to be carried out
What does a DIAMOND indicate in flowcharts?
indicates a decision to be made
What does a PARALLELOGRAM indicate in flowcharts?
input/output
What does an ARROW indicate in flowcharts?
displays the logical flow of the algorithm
What is a variable?
A variable holds a value that can be changed or used throughout the program
Give 3 examples of a date type
1) Integer
2) String
3) Boolean
What is a boolean?
a binary variable that can have one of two possible values, 0 (false) or 1 (true).
What is a constant?
A constant is always constant- it stays the same.
What is bubble sort?
The bubble sort algorithm starts at one end of the list and compares pairs of data items. If they are in the wrong order, they are swapped. The comparison of pairs continues to the end of the list.
What are the 4 steps of bubble sorting (ascending order)?
- Start at the beginning of the list
- compare the values in position 1 and position 2. If they are not in ascending order, swap them
- compare values in position 2 and 3 and swap if necessary
- Continue to the end of the list
What is Merge Sort?
Merge sort is a sorting algorithm that divides a list into two smaller lists and then divides these until the size of the list is one.
define recursion
a process that is repeated
define brute force
an algorithm design that does not include any techniques to improve performance, but instead relies on computing power to try all possibilities until the solution to a problem is found
give an example of a brute force algorithm
bubble sort
define ‘divide and conquer’
an algorithm design that works by dividing a problem into small sub problems, until they are easy to solve.The solutions to these are then combined to give a solution to the complete problem.
What are the 5 steps of binary search?
- Select the median item of the list
- Stop if the median item is equal to the search item
- If the median is too high then repeat 1 and 2 with the sublist to the left
- If the median is two low then repeat 1 and 2 with the sublist to the right
- Repeat steps 3 and 4 until the item has been found
What is computational thinking?
the thought processes involved in formulating problems and their solutions so that the solutions are represented in a form that can be effectively carried out by a computer.
What are the 3 skills of computational thinking?
- algorithm design
- decomposition
- abstraction
what is decomposition?
breaking a problem down into smaller, more manageable parts, which are easier to solve
what is abstraction?
the process of removing or hiding unnecessary detail so that only the important points remain.
Define subprograms
a self contained module of code that preforms a specific task. It can be ‘called’ by the main program when it is needed.