CSE5311M2 - CSE5311 Module 2 This Class Heaps and Heapsort?...

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

View Full Document Right Arrow Icon
1 CSE5311 – Module 2 This Class At the end of the class – Heaps and Heapsort? –Q u i c k S o r t –M e r g e s o r t – Other Sorting Algorithms At the end of the class Binary trees Priority queues and heaps Quicksort Worstcase Bestcase 8/30/2009 M KUMAR CSE5311 1 Mergesort Recurrences for Quicksort and Mergesort Further Reading Reference books on Algorithms Course Syllabus Review of Asymptotic Analysis and Growth of Functions, Recurrences Sorting Algorithms Graphs and Graph Algorithms. Greedy Algorithms: Minimum spanning tree,Union-Find algorithms, Kruskal's Algorithm, Clustering, Huffman Codes, and Multiphase greedy algorithms. Dynamic Programming: Shortest paths, negative cycles, matrix chain multiplications, sequence alignment, RNA secondary structure, application examples. •N e t w o r k F l o w : Maximum flow problem, Ford-Fulkerson algorithm, augmenting paths, Bipartite matching problem, disjoint paths and application problems . 8/30/2009 M KUMAR CSE5311 2 NP and Computational tractability: Polynomial time reductions; The Satisfiability problem; NP-Complete problems; and Extending limits of tractability. Approximation Algorithms, Local Search and Randomized Algorithms
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 Heaps and Heapsort Further Reading Reference books on Algorithms SORTING ALGORITHMS Priority Trees Building Heaps Maintaining Heap 8/30/2009 M KUMAR CSE5311 3 Maintaining Heaps Heapsort Algorithm Analysis of Heapsort Algorithm Priority Queues What is a priority queue? A priority queue is an abstract data type which consists of a set of elements. Each element of the set has an associated priority or key Priority is the value of the element or value of some component of an element Example : S : {(Brown, 20), (Gray, 22), (Green, 21)} priority based on name {(Brown, 20), (Green,21), (Gray, 22)} priority based on age 8/30/2009 M KUMAR CSE5311 4 Each element could be a record and the priority could be based on one of the fields of the record
Background image of page 2
3 Example A Student's record: Attributes : Name Age Sex Student No Marks Attributes : Student No. Values : John Brown 21 M 94XYZ23 75 Priority can be based on name, age, student number, or marks Operations performed on priority queues, 8/30/2009 M KUMAR CSE5311 5 - inserting an element into the set - finding and deleting from the set an element of highest priority Priority Queues Priority queues are implemented on partially ordered trees (POTs) POTs are labeled binar trees POTs are labeled binary trees the labels of the nodes are elements with a priority the element stored at a node has at least as large a priority as the elements stored at the children of that node the element with the highest priority is at the root of the tree 8/30/2009 M KUMAR CSE5311 6
Background image of page 3

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

View Full DocumentRight Arrow Icon
4 Example 24 21 19 13 14 03 10 7 2 11 8/30/2009 M KUMAR CSE5311 7 HEAPS The heap is a data structure for implementing POT's Each node of the heap tree corresponds to an element of the array that stores the value in the node The tree is filled on all levels except possibly the lowest, which are filled from left to right up to a point.
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 11/18/2009.

Page1 / 24

CSE5311M2 - CSE5311 Module 2 This Class Heaps and Heapsort?...

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

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