Is it possible to find the maximum in a min-heap in O(log n) time? Justify.
Answer: No.it is false because The maximum element in a min-heap can be anywhere in the bottom level of the heap. There are up to n/2 elements in the bottom level, so finding the maximum can take up to O(n) time
Is it possible to find the maximum in a min-heap in O(log n) time? Justify.
(e) Consider an initially empty max-heap, where the following keys are to be inserted one at a time: 11, 19, 23, 12, 13, 17, 13, 14, 18, and 33. Draw the tree that results after building this max-heap. (f) Is it possible to find the maximum in a min-heap in O(log n) time? Justify. Important Notes: • For part (e) of this problem, you must draw the min (or max) heaps using the appropriate graphics tools at your convenience.
Provide an O(k log k) algorithm that uses a heap data structure to find the kth largest element from the heap of n elements where n > k. Sketch your algorithm. (Hint: You may need to use an additional heap) Use the example data below to demonstrate the process. (e.g. Find the 7 largest element from this heap and it should be 45) Justify the running time. Heap H 100 80 70 40 50 65 60 20 40 10 30...
please justify.
A Fibonacci heap is a fancy priority queue data structure. For a heap of size n, it takes O(log n) time to do an extractMin() operation but only O(1) time to do an insert or decrease operation. Suppose we replace the binary heap used in Dijkstra's algorithm by a Fibonacci heap. 6. If the graph is dense, what is the asymptotic complexity of Dijkstra's algorithm using a Fibonacci heap, in terms of V|? 7. If the graph is...
What is the computational complexity of deleting an item from a heap? O(1) O(log n) O(n) O(n log n) O(n^2) (n squared)
C++
Question 9 5 pts Deleting the minimum element in a min-heap of N elements takes in average case O(N log N) O(1) O(N) Oſlog N) D Question 10 5 pts The time taken to find an element in an AVL tree of depth d is Old) 02) Oſlog d) Old log d) Question 11 5 pts Secondary clustering in a hash table occurs when using Linear probing Separate chaining Quadratic probing Double hashing Question 12 5 pts When sorting...
3. N elements are inserted from a min-heap with N elements. The total running time is: a) O(N2) worst case b) O(logN) worst case c) O(N) worst case d) None of these
C++
Question 5 5 pts In a min-heap of N elements, if we want to find the max element, we have to search all the leaves. What is the big-o running time of findMax? O(N^2) Oſlog N) O(N) OIN log N) Question 6 5 pts An AVL tree is a Binary Search Tree that has the following additional property for every node in the tree, the height of the left and right subtrees is the same none of the above...
2. [6 marks] Are the following functions O(n)? Justify your answer. a) n log n b) f(n) = Vn (log n)
what is the worst case run time when finding the maximum value in a binary min heap(implemented using array ) containing N elements? worst case run time: explain:
When sorting n records, Merge Sort has worst-case running time O(log n) O O(n log n) O O(n) O(n^2)