3 votes 3 votes Where in a max-heap might the smallest element reside, assuming that all elements are distinct ? Algorithms cormen algorithms sorting binary-heap descriptive + – akash.dinkar12 asked Apr 5, 2019 retagged Apr 6, 2019 by akash.dinkar12 akash.dinkar12 2.7k views answer comment Share Follow See 1 comment See all 1 1 comment reply Kajal Khobragade commented Apr 14, 2019 reply Follow Share Smallest element will be at the last level of the max heap. 0 votes 0 votes Please log in or register to add a comment.
Best answer 1 votes 1 votes In a max heap the smallest element will be one of the leaf nodes. T(n) = O(n) for finding the smallest element in a max heap. Tsering_Dorjay answered Jul 15, 2020 selected Apr 18, 2021 by Arjun Tsering_Dorjay comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes smallest element will b at last level of the max heap Irri answered Apr 24, 2019 Irri comment Share Follow See 1 comment See all 1 1 comment reply noob_coder commented Apr 30, 2019 reply Follow Share Not necessarily at last level. Minimum element will be at the leaf node. Eg. consider this max heap 5,4,2,3. Here 2 is at 2nd level. 2 votes 2 votes Please log in or register to add a comment.
0 votes 0 votes The smallest element in a max-heap will be present at the last level of a max-heap whose index start from floor(n/2)+1, floor(n/2)+2 ...., n. Avinash31 answered Jul 11, 2020 Avinash31 comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes Smallest Element will be one of the leaf node. Sanandan answered Sep 9, 2020 Sanandan comment Share Follow See all 0 reply Please log in or register to add a comment.