{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lect12-heaps-and-heapsort

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

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

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

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

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

{[ snackBarMessage ]}

What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern