Flashcards
Sorting
Flashcards do conjunto (24)
- 1Sorting algorithms The end result will always be the _____ no matter which algorithm you use to sort itsame
- 2Sorting Algorithms The choice of algorithm affects only the _____ and _____ _____ of the programruntime and memory use
- 3Sorting Algorithms Bubble sort, Selection Sort and Insertion Sort are _____ to program but _____easy but inefficient
- 4Sorting Algorithms Merge Sort is _____ than Selection Sort and Insertion Sort but _____ to programfaster but harder to program
- 5Bubble 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 listadjacent
- 6Bubble Sort The process is repeated until there are no more _____ to be made. This is when it has finishedswaps
- 7Bubble Sort The bubble sort keeps track of the occurring swaps by use of a _____flag
- 8Selection Sort _____ but _____ sorting algorithmsimple but inefficient
- 9Selection Sort Its first iteration selects the _____ element in the array and swaps it with the _____ elementIts first iteration selects the SMALLEST element in the array and swaps it with the FIRST element
- 10Selection Sort The 2nd iteration selects the _____ smallest item and swaps it with the _____ elements. This process is repeated until the list is doneThe 2nd iteration selects the 2ND smallest item and swaps it with the 2ND element
- 11Selection Sort Efficiency This algorithm runs in _____ time.O(n2)
- 12Selection Sort Efficiency Contains _____ for loops2
- 13Selection Sort Efficiency The outer for loop iterates over the first _____ elements in the arrayn-1
- 14Selection Sort Efficiency The inner for loop iterates over each item in the remaining array searching for the _____ elementsmallest
- 15Selection Sort Efficiency In Big O terms, smaller terms drop out and constants are ignored , leaving a final big O of _____O(n2)
- 16Insertion Sort Another, _____ but _____ methodsimple but inefficient
- 17Insertion Sort The first iteration of this algorithm takes the _____ element in the array, and if it is less than the first element, swaps the two2nd
- 18Insertion 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 continues3rd
- 19Quick 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 combined2
- 20Quick sort If the array contains only _____ element or _____ elements then the array is sorted.1 or 0
- 21Quick 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.
- 22Quick sort The 2 arrays created from the pivot element are sorted _____recursively
- 23Quick sort The arrays are then _____combined
- 24Quick 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
Informações
- Descrição
- Masters of Science Programming 2 FlashCards sobre Sorting, criado por Nathan Hunsdale em 02-06-2014.
- Criado por
- Nathan Hunsdale
- Visualizações
- 22
- Avaliação