End of Term Review 1.8

End of Term Review 1.8 - Zig Performed when the node x has...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Zig Performed when the node x has no grandparent i.e., its parent is the root y x zig x w y T4 w T3 T1 T1 T2 T3 T4 T2 CSE 2011 Prof. J. Elder - 36 - Last Updated: 4/1/10 2:37 PM Topic 2. Sorting CSE 2011 Prof. J. Elder - 37 - Last Updated: 4/1/10 2:37 PM Sorting Algorithms Comparison Sorting Selection Sort Bubble Sort Insertion Sort Merge Sort Heap Sort Quick Sort Linear Sorting Counting Sort Radix Sort Bucket Sort CSE 2011 Prof. J. Elder - 38 - Last Updated: 4/1/10 2:37 PM Comparison Sorts Comparison Sort algorithms sort the input by successive comparison of pairs of input elements. Comparison Sort algorithms are very general: they make no assumptions about the values of the input elements. 4 3 7 11 2 2 1 3 5 e.g.,3 11? CSE 2011 Prof. J. Elder - 39 - Last Updated: 4/1/10 2:37 PM Sorting Algorithms and Memory Some algorithms sort by swapping elements within the input array Such algorithms are said to sort in place, and require only O(1) additional memory. Other algorithms require allocation of an output array into which values are copied. These algorithms do not sort in place, and require O(n) additional memory. 4 3 7 11 2 2 1 3 5 swap CSE 2011 Prof. J. Elder - 40 - Last Updated: 4/1/10 2:37 PM ...
View Full Document

This note was uploaded on 02/14/2012 for the course CSE 2011Z taught by Professor Elder during the Fall '11 term at York University.

Ask a homework question - tutors are online