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