算法设计与分析基础第三版ch06.pptVIP

  • 3
  • 0
  • 约2.79千字
  • 约 43页
  • 2020-08-30 发布于湖北
  • 举报
Instance simplification - Presorting;How fast can we sort ?;Searching with presorting;Element Uniqueness with presorting;Instance simplification – Gaussian Elimination;Gaussian Elimination (cont.);Example of Gaussian Elimination;大家学习辛苦了,还是要坚持;Pseudocode and Efficiency of Gaussian Elimination;Searching Problem;Taxonomy of Searching Algorithms;Binary Search Tree;Dictionary Operations on Binary Search Trees;Balanced Search Trees ;;;General case: Single R-rotation;General case: Double LR-rotation;;;Analysis of AVL trees;Multiway Search Trees;2-3 Tree ;2-3 tree construction – an example;Analysis of 2-3 trees;Heaps and Heapsort;Illustration of the heap’s definition;Some Important Properties of a Heap;Heap’s Array Representation;Step 0: Initialize the structure with keys in the order given Step 1: Starting with the last (rightmost) parental node, fix the heap rooted at it, if it doesn’t satisfy the heap condition: keep exchanging it with its largest child until the heap condition holds Step 2: Repeat Step 1 for the preceding parental node ;Example of Heap Construction;Pseudopodia of bottom-up heap construction;Stage 1: Construct a heap for a given list of n keys Stage 2: Repeat operation of root removal n-1 times: Exchange keys in the root and in the last (rightmost) leaf Decrease heap size by 1 If necessary, s root with larger child until the heap condition holds ;Sort the list 2, 9, 7, 6, 5, 8 by heapsort Stage 1 (heap construction) Stage 2 (root/max removal) 1 9 7 6 5 8 9 6 8 2 5 7 2 9 8 6 5 7 7 6 8 2 5 | 9 2 9 8 6 5 7 8 6 7 2 5 | 9 9 2 8 6 5 7 5 6 7 2 | 8 9 9 6 8 2 5 7 7 6 5 2 | 8 9 2 6 5 | 7 8 9 6 2 5 | 7 8 9 5 2 | 6 7 8 9 5 2 | 6 7 8 9 2 | 5 6 7 8 9;Stage 1: Build heap for a given list of n ke

文档评论(0)

1亿VIP精品文档

相关文档