WGU C949 EXAM REVIEW QUESTIONS AND
CORRECT ANSWERS!!
Algorithm
A set of instructions followed step by step to solve a problem
Characteristics of an Algorithm
1. Clear & unambiguous
2. Well-defined inputs
3. Well-defined outputs
what will be produced?
4. Finite-ness
5. Feasible
6. Language independent
Factors of an Algorithm
1. Modularity (can be broken down)
2. Correctness
3. Maintainability (no major changes when redefining the algorithm)
4. Functionality
5. Robustness (ability to define problem clearly)
6. User friendly
7. Simplicity
8. Extensibility (Future developers can understand it & build upon it)
Which factor takes the ability to easily update an algorithm into consideration?
maintainability
What is a high-level consideration in an algorithm’s design?
simplicity
Prior analysis
,things you'd consider before implementing an algorithm, such as processing speed
Post analysis
happens after implementation
Types of Algorithms
-Brute-force algorithm
-Searching algorithm
-Sorting algorithm
-Recursive algorithm
-Backtracking algorithm
-Divide & conquer algorithm
-Greedy algorithm
-Dynamic programming algorithm
-Randomized algorithm
Brute Force Algorithm
an algorithm that tries all possible solutions in order then chooses the best one
Example of searching algorithms
linear search and binary search
Linear Search Algorithm
Starts from the beginning of a list & checks each element until the search key is found or the end
of the list is reached.
Data can be sorted or unsorted
Binary Search Algorithm
starts at the middle of a sorted data set of numbers and eliminates half of the data; this process
repeats until the desired value is found or all elements have been eliminated
Sorting Algorithms
, Bubble Sort
Selection Sort
Insertion Sort
Quick Sort
Merge Sort
RADIX
Bubble Sort Algorithm
Compares elements that are side by side & determine if the left element is greater than the right
element. If so, it swaps them and continues to compare elements until it reaches the end of the
list. The largest # is "bubbled" to the top of the list
Selection Sort Algorithm
finds the lowest value in an array & moves it to the front of an array
Uses a sorted & unsorted list
*nested loop
Insertion Sort Algorithm
Takes 2 elements & moves them to a sorted list, sorts them least to greatest, then goes back to
the unsorted list & keeps moving elements down to the sorted list, making swaps 1 at a time until
the list is fully sorted.
Quicksort Algorithm
Quicksort divides the array into 2 parts low & high)
All values in the low partition are <= to the pivot value
All values in the high partition are >= to the pivot value
Merge Sort Algorithm
Breaks data into small groups, puts the groups in order, then combines groups until all are in
order
*divide & conquer algorithm
CORRECT ANSWERS!!
Algorithm
A set of instructions followed step by step to solve a problem
Characteristics of an Algorithm
1. Clear & unambiguous
2. Well-defined inputs
3. Well-defined outputs
what will be produced?
4. Finite-ness
5. Feasible
6. Language independent
Factors of an Algorithm
1. Modularity (can be broken down)
2. Correctness
3. Maintainability (no major changes when redefining the algorithm)
4. Functionality
5. Robustness (ability to define problem clearly)
6. User friendly
7. Simplicity
8. Extensibility (Future developers can understand it & build upon it)
Which factor takes the ability to easily update an algorithm into consideration?
maintainability
What is a high-level consideration in an algorithm’s design?
simplicity
Prior analysis
,things you'd consider before implementing an algorithm, such as processing speed
Post analysis
happens after implementation
Types of Algorithms
-Brute-force algorithm
-Searching algorithm
-Sorting algorithm
-Recursive algorithm
-Backtracking algorithm
-Divide & conquer algorithm
-Greedy algorithm
-Dynamic programming algorithm
-Randomized algorithm
Brute Force Algorithm
an algorithm that tries all possible solutions in order then chooses the best one
Example of searching algorithms
linear search and binary search
Linear Search Algorithm
Starts from the beginning of a list & checks each element until the search key is found or the end
of the list is reached.
Data can be sorted or unsorted
Binary Search Algorithm
starts at the middle of a sorted data set of numbers and eliminates half of the data; this process
repeats until the desired value is found or all elements have been eliminated
Sorting Algorithms
, Bubble Sort
Selection Sort
Insertion Sort
Quick Sort
Merge Sort
RADIX
Bubble Sort Algorithm
Compares elements that are side by side & determine if the left element is greater than the right
element. If so, it swaps them and continues to compare elements until it reaches the end of the
list. The largest # is "bubbled" to the top of the list
Selection Sort Algorithm
finds the lowest value in an array & moves it to the front of an array
Uses a sorted & unsorted list
*nested loop
Insertion Sort Algorithm
Takes 2 elements & moves them to a sorted list, sorts them least to greatest, then goes back to
the unsorted list & keeps moving elements down to the sorted list, making swaps 1 at a time until
the list is fully sorted.
Quicksort Algorithm
Quicksort divides the array into 2 parts low & high)
All values in the low partition are <= to the pivot value
All values in the high partition are >= to the pivot value
Merge Sort Algorithm
Breaks data into small groups, puts the groups in order, then combines groups until all are in
order
*divide & conquer algorithm