lect12-heaps-and-heapsort

lect12-heaps-and-heapsort - Lecture Notes CMSC 251...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Lecture Notes CMSC 251 Divide-and-conquer: Understand how to design algorithms by divide-and-conquer. Understand the divide-and-conquer algorithm for MergeSort, and be able to work an example by hand. Also understand how the sieve technique works, and how it was used in the selection problem. (Chapt 10 on Medians; skip the randomized analysis. The material on the 2-d maxima and long integer multiplication is not discussed in CLR.) Lecture 11: First Midterm Exam (Tuesday, March 3, 1998) First midterm exam today. No lecture. Lecture 12: Heaps and HeapSort (Thursday, Mar 5, 1998) Read: Chapt 7 in CLR. Sorting: For the next series of lectures we will focus on sorting algorithms. The reasons for studying sorting algorithms in details are twofold. First, sorting is a very important algorithmic problem. Procedures for sorting are parts of many large software systems, either explicitly or implicitly. Thus the design of efficient sorting algorithms is important for the overall efficiency of these systems. The other reason is more pedagogical. There are many sorting algorithms, some slow and some fast. Some possess certain desirable properties, and others do not. Finally sorting is one of the few problems where there provable lower bounds on how fast you can sort. Thus, sorting forms an interesting case study in algorithm theory. In the sorting problem we are given an array A [1 ..n ] of n numbers, and are asked to reorder these elements into increasing order. More generally, A is of an array of records, and we choose one of these records as the key value on which the elements will be sorted. The key value need not be a number. It can be any object from a totally ordered domain. Totally ordered means that for any two elements of the domain, x , and y , either x<y , x = ,or x>y . There are some domains that can be partially ordered, but not totally ordered. For example, sets can be partially ordered under the subset relation, , but this is not a total order, it is not true that for any two sets either x y , x = y or x
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/13/2012 for the course CMSC 351 taught by Professor Staff during the Fall '11 term at University of Louisville.

Page1 / 3

lect12-heaps-and-heapsort - Lecture Notes CMSC 251...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online