Created by Josh Calvert
almost 8 years ago
|
||
Question | Answer |
Which search/sorting algorithm is this pseudo-code from and what is its function? while left <= right and array[left] <= p left = left + 1 | Quick Sort Until the left check value crosses the right check value or the left check value is less than the pivot, keep checking |
Which search/sorting algorithm is this pseudo-code from and what is its function? while pos > 0 and array[position - 1] > val array[pos] = array[pos - 1] pos = pos - 1 | Insertion Sort Starting at the highest position, until the value being checked is less than the number above it or is the lowest number, check the next value |
Which search/sorting algorithm is this pseudo-code from and what is its function? if array[midpoint] < item first = midpoint + 1 else last = midpoint - 1 | Binary Search If the search value is greater than the mid value of the list, repeat between the mid index + 1 and last. Otherwise, repeat between the mid index - 1 and first |
Which search/sorting algorithm is this pseudo-code from and what is its function? if right < left flag = true else temp = array[left] array[left] = array[right] array[right] = temp | Quick Sort If the left and right markers have crossed, the array is sorted. Otherwise, swap the values at the left and right markers |
Which search/sorting algorithm is this pseudo-code from and what is its function? temp = array[i] array[i] = array[i + 1] array[i + 1] = temp | Bubble Sort Swap the value in position "i" with the value in position "i + 1" |
Which search/sorting algorithm is this pseudo-code from and what is its function? while i = 0 < arraylength - 1 and flag = true flag = false for j = 0 to arraylength - i - 2 | Bubble Sort Until a whole pass of the list is complete or the list is sorted, assume the list isn't sorted and cycle through all numbers that haven't been checked this pass |
Which search/sorting algorithm is this pseudo-code from and what is its function? while i = 0 < arraylength and flag = false if array[i] = item flag = true | Linear Search Check every value in the list until you find what you want. If you do, flag you found it for use elsewhere |
Which search/sorting algorithm is this pseudo-code from and what is its function? left = array[0, mid] right = array[mid, arraylength - 1] run(left) run(right) | Merge Sort Split the array into left and right halves, pause execution and run algorithm on left half and then run on right half |
Want to create your own Flashcards for free with GoConqr? Learn more.