Prepare
Practice
Interview
Aptitude
Reasoning
English
GD
Placement papers
HR
Current affairs
Engineering
MCA
MBA
Online test
Login
Online Practice Test
>
Data structure
« Previous
Next »
In a heap, element with the greatest key is always in the ___________ node
Options
- leaf
- root
- first node of left sub tree
- first node of right sub tree
CORRECT ANSWER : root
Discussion Board
Data Structure - Trees
In a heap, element with the greatest key is always in the root node. Heap is a complete binary tree such that root node is always greater than or equal to the key value in both its children. There are two types of heap, if the parent nodes are greater than their children, then it is called as Max-Heap , and if the parent nodes are smaller than their child nodes, heap is called Min-Heap . A heap can be considered as a priority queue; the most important node will always be at the top. Heap is also used in sorting.
Prajakta Pandit 02-1-2017 12:23 AM
About Definition
While some question asked i think it is also necessary to define all the terms used in that question also. Like this question heap is not defined
Amit 12-27-2016 10:17 PM
heap
The key value in anynode N is greater than or equal to the key values in both its children
NEERAJ MAURYA 11-29-2016 09:45 AM
Data Structure
In a heap, the highest priority element is always stored at the root, hence the name heap. A heap is not a sorted structure and can be regarded as partially ordered.So, the answer is right.
Prajakta Pandit 09-24-2015 03:50 AM
correction of answers
Yes u right krishna why they are saiyng that is root is the correct
sajidkasuri 12-24-2014 12:19 AM
heap
Here either max_heap or min_heap is not mentioned. So how can we say the greatest key is only at root. If we consider the min_heap then the greatest key is at leaf.... Am I correct?
Krishna Chaitanya Karyampudi 12-13-2014 11:33 PM
« Previous
Next »
Write your comments
*
*
Email must be in the form someone@domain.com
*
*
Enter the code shown above:
Please enter the code shown above
(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)
Related Content
C test (42)
C (12)
C++ for beginners (10)
C++ (20)
C++ (24)
C++ (18)
C++ (14)
C++ (12)
C++ (15)
C++ (15)
Data structure (20)
Data structure (10)
Data structure (10)
Data structure (10)
PERL (25)
VC++ (11)
Oops (30)
Mainframe (41)
Mainframe (15)
Embedded systems (15)
OOAD (49)
Advertisement
▲