Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
17 Cards in this Set
- Front
- Back
Algorithm (informal definition) |
a set of instructions for solving a problem |
|
5 Important Characteristics of an Algorithm |
1. well-ordered 2. unambiguous operations 3. effectively computable operations 4. produce a result 5. halt in a finite amount of time |
|
3 Different Sorting Algorithms |
1. Selection Sort 2. Insertion Sort 3. Simple Sort |
|
Swap Algorithm (3 Steps) |
1. Copy cell A to temporary cell 2. Copy cell B to cell A 3. Copy temporary cell to cell B |
|
Simple Sort Algorithm (5 Steps) |
1. Get unsorted list of numbers 2. compare all numbers 3. find smallest 4. put smallest in sorted list 5. repeat 2-4 until unsorted list is empty |
|
Insertion Sort Algorithm (6 Steps) |
1. Get unsorted list of numbers 2. Set a marker for the sorted section after the first number in the list 3. Select the first unsorted number 4. Swap this number to the left until it is in correct position 5. Advance the marker to the right one position 6. Repeat 3-5 until list is sorted |
|
Selection Sort Algorithm (6 Steps) |
1. Get unsorted list of numbers 2. Set a marker for the unsorted list at the front of the list 3. compare all numbers and select smallest 4. swap this number with the first number in the unsorted list 5. advance the marker to the right one position 6. Repeat 3-5 until list is sorted |
|
3 Factors of Time Efficiency |
1. # of items copied 2. # of items compared 3. # of items swapped |
|
Single Factor of Space Efficiency |
amount of computer memory |
|
Cells (space) needed for sort for an 'n' item list: 1. Simple Sort 2. Insertion Sort 3. Selection Sort |
1. 2n (unsorted list and sorted list) 2. n+1 (one list with marker) 3. n+1 (one list with marker) |
|
4 Common Classes of Algorithms (Order Notation) |
1. O(log n) 2. O(n) 3. O(n^2) 4. O(2^n) |
|
Execution time focuses on ___ |
CPU is the focus of _______ ____ |
|
Memory Space focuses on ___ |
RAM is the focus of _______ _____ |
|
Memory Space: Count every integer as _ bytes |
2 bytes |
|
Memory Space: Count every float as _ bytes |
4 bytes |
|
Memory Space: Count every string as _ bytes |
6 bytes |
|
2 Rules of Determining Execution Time |
1. 1 CPU Cycle per line of code 2. Do not include 'def' and 'return' lines |