The Gateway to Computer Science Excellence
0 votes
44 views

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)?

in Algorithms by Active (5k points) | 44 views
+1

if you call the Heapify then for n element then it will take  = O(n log n) time.

The Solution of this problem is 

Take All the 2*n element and call the Build Heap().

So, It will take  O(2n) = O(n) time.

0
oh ok

Please log in or register to answer this question.

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,666 questions
56,131 answers
193,671 comments
93,309 users