Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7494823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T17:47:30+00:00 2026-05-29T17:47:30+00:00

Suppose we have a min heap with some elements which satisfy the heap property.

  • 0

Suppose we have a min heap with some elements which satisfy the heap property.
What happens if I change the algorithm from min heap to max heap without rearrange the internal array?

That is, if I keep the array unchanged, what happens when I append an element to the internal array?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T17:47:32+00:00Added an answer on May 29, 2026 at 5:47 pm

    Consider the following example from Wikipedia:
    enter image description here

    The array representation of this would look like this:

    [1, 2, 3, 17, 19, 36, 7, 25, 100]
    

    Now we “change” the heap from min to max, but without rearranging the elements and insert a new element “25”. The array position would be 9 so the parent node is “19” at position 4.

    After inserting we must repeatedly compare the new item with its parent to ensure heap property (now max-heap => parent must be greater than child). Thus we must swap “25” with “19”, “2” and “1” until it is the root node.

    Now the max-heap property holds for the root node (its children are indeed smaller), but not for the other nodes, e.g. “3” is still the parent of “7” and violates the max-heap condition.

    To conclude this: Doing what you describe does not change the min-heap to a max-heap.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose you have 2 different ASP.NET applications in IIS. Also, you have some ASCX
Suppose I have: Toby Tiny Tory Tily Is there an algorithm that can easily
suppose i have one column in mysql database which is stated last time one
Suppose I have a LimitedValue class which holds a value, and is parameterized on
Suppose we have two variables that we wish to build a model from: set.seed(10239)
Suppose I have taken a video file from iphone library. I want to put
I have a page which needs to use $.post() but for some reason the
So here's the question: Suppose as min heap uses parent pointers such that each
To retrieve the smallest value i have to use numeric_limits<int>::min() I suppose the smallest
Suppose I have a stringbuilder in C# that does this: StringBuilder sb = new

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.