Sorting

Description

Masters of Science Programming 2 Flashcards on Sorting, created by Nathan Hunsdale on 06/02/2014.
Nathan Hunsdale
Flashcards by Nathan Hunsdale, updated more than 1 year ago
Nathan Hunsdale
Created by Nathan Hunsdale about 12 years ago
22
1

Resource summary

Question Answer
Sorting algorithms The end result will always be the _____ no matter which algorithm you use to sort it same
Sorting Algorithms The choice of algorithm affects only the _____ and _____ _____ of the program runtime and memory use
Sorting Algorithms Bubble sort, Selection Sort and Insertion Sort are _____ to program but _____ easy but inefficient
Sorting Algorithms Merge Sort is _____ than Selection Sort and Insertion Sort but _____ to program faster but harder to program
Bubble Sort The bubble sort compares _____ elements. The first and second elements are compared and then swapped if out of order and this continues the whole way down the list adjacent
Bubble Sort The process is repeated until there are no more _____ to be made. This is when it has finished swaps
Bubble Sort The bubble sort keeps track of the occurring swaps by use of a _____ flag
Selection Sort _____ but _____ sorting algorithm simple but inefficient
Selection Sort Its first iteration selects the _____ element in the array and swaps it with the _____ element Its first iteration selects the SMALLEST element in the array and swaps it with the FIRST element
Selection Sort The 2nd iteration selects the _____ smallest item and swaps it with the _____ elements. This process is repeated until the list is done The 2nd iteration selects the 2ND smallest item and swaps it with the 2ND element
Selection Sort Efficiency This algorithm runs in _____ time. O(n2)
Selection Sort Efficiency Contains _____ for loops 2
Selection Sort Efficiency The outer for loop iterates over the first _____ elements in the array n-1
Selection Sort Efficiency The inner for loop iterates over each item in the remaining array searching for the _____ element smallest
Selection Sort Efficiency In Big O terms, smaller terms drop out and constants are ignored , leaving a final big O of _____ O(n2)
Insertion Sort Another, _____ but _____ method simple but inefficient
Insertion Sort The first iteration of this algorithm takes the _____ element in the array, and if it is less than the first element, swaps the two 2nd
Insertion Sort The second iteraton looks at the _____ element and inserts it into the correct position and puts it into the correct position with respect to the elements that have already been sorted; the first 3 items are now in order. This continues 3rd
Quick Sort This is a divide and conquer algorithm. This means that the data is separated into _____ parts (divide) which are individually sorted(conquered) and then combined 2
Quick sort If the array contains only _____ element or _____ elements then the array is sorted. 1 or 0
Quick sort What is the pivot element and what is it used for? An element selected from the array which is the breaking point. If elements are smaller than the breaking point then they are put into one array and the ones that are bigger go into another.
Quick sort The 2 arrays created from the pivot element are sorted _____ recursively
Quick sort The arrays are then _____ combined
Quick sort Quick sort can then be implemented to sort "in place". What does this mean? Sorting takes place in the array and no additional array needs to be created
Show full summary Hide full summary

Similar

Computer science unit 2
Somto Ibeme
Searching and Sorting Algorithms
Josh Calvert
Who goes first
Karl Taylor
Get player names
Karl Taylor
Computer science unit 2
tabassum88 abedi
Computer science unit 2
tabassum88 abedi
Computer science unit 2
джордж гаврилович
Computer science unit 2
Brokoli Momkey
Searching and Sorting Algorithms
Arnav Kolhe
Searching and Sorting Algorithms
yo uo
Sorting & Searching Algorithms
Jasen M