search
Log In

Recent questions tagged heap

0 votes
2 answers
1
0 votes
1 answer
2
1 vote
3 answers
3
0 votes
0 answers
4
Show that in any subtree of a max-heap, the root of the subtree contains the largest value occurring anywhere in that subtree.
asked Apr 5, 2019 in Algorithms akash.dinkar12 48 views
0 votes
0 answers
5
0 votes
1 answer
6
6 votes
5 answers
7
Consider the following statements: The smallest element in a max-heap is always at a leaf node The second largest element in a max-heap is always a child of a root node A max-heap can be constructed from a binary search tree in $\theta(n)$ time A binary search tree can be constructed ... time Which of te above statements are TRUE? I, II and III I, II and IV I, III and IV II, III and IV
asked Feb 7, 2019 in DS Arjun 4.4k views
1 vote
1 answer
8
I was going through the heap concept and one question came into my mind what will be the best case time complexity of finding the minimum element in a max heap? Thank you:)
asked Jan 15, 2019 in DS Nandkishor3939 569 views
1 vote
0 answers
9
2 votes
1 answer
10
what is the time complexity of various problems such as: 1) Creating the heap 2) Getting maximum element in the max heap 3) Getting minimum element in the max heap 4) Getting maximum element in min heap 5) Getting minimum element in min heap 6) Heapify the element 7) ... ) Deletion of an element in the max heap 10) Insertion of an element in the max heap 11) Insertion of an element in min heap
asked Jan 1, 2019 in Programming Hira Thakur 141 views
2 votes
2 answers
11
Consider the following modified Heapify and Build_heap procedure. void Heapify(int* A, int i, int n) { int left=2*i+1; int right=2*i+2; int mid=i; if (left<=n && right <=n) { if ((A[left] > A[right] && A[left]< A[i]) || A[left]<A[right] && A[left] >A[i]) mid=left; else if((A[left<A[right] && A[right]<A[i]) ... $6 \: 8 \: 1 \: 9 \: 4$ $9 \: 6 \: 1 \: 8 \: 4$ $6 \: 9 \: 1 \: 8 \: 4$
asked Dec 27, 2018 in Algorithms Ruturaj Mohanty 333 views
1 vote
1 answer
12
What is the time complexity of 'deleting any random node from a max or min heap'?
asked Dec 21, 2018 in DS Avijit Shaw 839 views
0 votes
2 answers
13
For the given nodes: $89, 19, 50, 17, 12, 15, 2, 5, 7, 11, 6, 9, 100$ minimum ______ number of interchanges are required to convert it into a max-heap. $3$ $4$ $5$ $6$
asked Dec 7, 2018 in DS Arjun 154 views
0 votes
0 answers
14
https://gateoverflow.in/459/gate2008-47 here if we insert all elements together and then call heapify function then it’ll take O(logn) time. why answer is O(n)?
asked Dec 4, 2018 in Algorithms aditi19 73 views
0 votes
1 answer
15
Consider there are n/logn min heap trees each of size logn. What will be the time complexity to find the smallest element and greatest element in these min heap trees respectively? A) O(n/logn), O(n) B) O(n), O(n/logn) C) O(n), O(n) D) O(logn), O(logn)
asked Dec 2, 2018 in Algorithms pps121 108 views
1 vote
1 answer
16
What is the time complexity to find the Kth largest element in a Min-Heap? Or equivalently, What is the time complexity to find Kth smallest element in Max-Heap?
asked Dec 1, 2018 in Algorithms gmrishikumar 475 views
3 votes
1 answer
17
The minimum number of comparisons required to find the 65th smallest element in a minheap is equal to
asked Nov 24, 2018 in DS Utkarsh Joshi 1.1k views
0 votes
0 answers
18
This question is in CLRS,if we have a max heap it is always in sorted order(descending) order.And by extension if we have min heap the array is sorted in ascending order.Is this true? I have a counter example for 100,50,20,1,3,10,5,this satisfied max- ... it as an array is it an heapified representation or not? If we heapify after deletion and store max deleted element then we get sorted array.
asked Nov 15, 2018 in DS sripo 554 views
0 votes
1 answer
19
For a heap containing n elements,smallest element can be found in n/2 operations.I always get confused and think as logn operations.Please help me differentiating between these two times.
asked Nov 8, 2018 in DS sripo 147 views
1 vote
1 answer
20
Does Heap Allocation support both recursion and dynamic memory allocation? Because,a stack can be implemented using dynamic memory allocation.Please correct me. Test Series answer shows only dynamic memory allocation
asked Nov 3, 2018 in Compiler Design sripo 474 views
0 votes
0 answers
21
$(1)$ In a binary heap with $'n'$ elements with the smallest element at the root, the $7th$ smallest element can be found in time? $A)\theta(nlogn)$ $B)\theta(n)$ $C)\theta(logn)$ $D)\theta(1)$ $(2)$ In binary max heap containing $'n'$ numbers, the smallest element can be ... ) into this heap. The total time required for this is? $A)\theta(logn)$ $B)\theta(n)$ $A)\theta(nlogn)$ $A)\theta(n^{2})$
asked Nov 1, 2018 in Algorithms Lakshman Patel RJIT 235 views
1 vote
0 answers
22
0 votes
0 answers
23
https://gateoverflow.in/?qa=blob&qa_blobid=17275535249024428371
asked Sep 10, 2018 in Algorithms manvi_agarwal 121 views
0 votes
0 answers
24
What is the number of comparisons required to extract 45th element of the min heap?
asked Sep 10, 2018 in Algorithms bts1jimin 615 views
0 votes
0 answers
25
What is Binomial tree please explain in easy words. Construct the Binomial heap for the following sequence of numbers 7,2,4,17,1,11,6,8,15,10,20. Also apply the operation of extracting the minimum key in the resulting binomial Heap.
asked Sep 10, 2018 in Algorithms LavTheRawkstar 186 views
0 votes
1 answer
26
Sort The Following Sequence of input using Heap sort. { 10 , 2 , 1 , 5, 3 ,8 ,11,24 ,7 } Please show the output at every pass because i am getting confused.
asked Sep 9, 2018 in Algorithms LavTheRawkstar 170 views
0 votes
0 answers
27
How traversal in a heap takes place? Consider a min heap , I think we cannot traverse it like a binary tree ......For Example if we have to print all elements of heap Do we need to perform delete operation on root O(1) time then perform Heapify O(lgn) and again perform delete and so on which overall takes O(N) time ? Whether same is for search as well Plz explain...
asked Aug 20, 2018 in DS Shiv Gaur 153 views
0 votes
0 answers
28
Consider a binary tree, where left and right subtreealready heapified. But we havenot done heapificationfor root yet. Then what is time complexity to convert it in a full heap tree? $A)O(\log n)$ or $o(n)$ $B)\Omega (\log n)$ or $\omega(n)$ $C)\Theta (\log n)$ or $\theta (n)$ $D)\text{None of these}$
asked Aug 18, 2018 in DS srestha 507 views
0 votes
0 answers
29
a)Deletion of smallest element in heap b)Insertion of an element in a heap will take $O(n)$ or $O(logn)$ time?
asked Aug 16, 2018 in DS srestha 322 views
0 votes
2 answers
30
Consider the array A=<4, 1, 3, 2, 16, 9, 10, 14, 8, 7>. After building heap from the array A, the depth of the heap and the right child of max-heap are ______ and _____ respectively (Root is at level 0). 3, 14 3, 10 4, 14 4, 10
asked Jul 13, 2018 in DS Pooja Khatri 921 views
...