retagged by
341 views
0 votes
0 votes

Suppose we are given a set of elements to be inserted in a Max Heap. What is the approach to follow from the following?

1.Insert an element, apply HEAPIFY, insert the next element, again apply HEAPIFY, and so on.

2. Insert all the elements and once done, apply BUILD-MAX-HEAP.

What is the correct approach?

retagged by

1 Answer

0 votes
0 votes
it depend on the requirements, if elements to be aaded are more then the number of what previously in max heap then use method 2. else 1

obviously time complexity is the main concern

Related questions

1 votes
1 votes
2 answers
1
Jithin Jayan asked Jul 23, 2016
633 views
Given an unsorted Array of n elements and asked to find the Largest element of that array. Can we use Max-Heapify Procedure to find the Largest element in that array in O...
0 votes
0 votes
1 answer
2
1 votes
1 votes
0 answers
3
codingo1234 asked Nov 20, 2018
1,237 views
Consider a binary min heap given below containing integer in [1, 15]. The maximum number of node movement on 5 successive removal of element are ________.
1 votes
1 votes
2 answers
4
Nishisahu asked Sep 23, 2021
425 views
How many min heap possible with 6 distinct node?