File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -20,4 +20,21 @@ Geeks for Geeks Link: [**Heap Sort**][G4GLink]
20
20
21
21
[ G4GLink ] : https://www.geeksforgeeks.org/heap-sort/
22
22
23
+ Many teaching resources say the best case for Heap sort is O(n log n).
24
+ However, there is a case where it is O(n) - can you figure out what it is?
25
+
26
+ Here we have presented the "bottom up" way of creating a heap from an
27
+ unsorted array. There is also a "top down" method where we start with
28
+ just the first element of the array (which can be considered a heap)
29
+ and repeatedly include the next element in the array until all array
30
+ elements are included in the heap. At each stage some elements may need
31
+ to be rearranged to ensure the heap condition is met (using an operation
32
+ normally called * UpHeap* ). Work out (or look up) the details of this
33
+ algorithm. Try to work out (or look up) the worst case time complexity
34
+ for these two ways of creating a heap.
35
+
36
+ Heaps are an efficient way of implementing the * piority queue* abstract
37
+ data type. What operations does this ADT support and how can they
38
+ be implemented using a heap? What are priority queues useful for?
39
+ Can you find some algorithms in AIA that use priority queues?
23
40
You can’t perform that action at this time.
0 commit comments