We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Try to determine how you can use heaps to solve the problem. Keeping all elements in a min heap would allow you to keep track of the smallest integer, whereas a max heap would let you keep track of the largest. How can you combine these ideas so you have easy access to the median element(s)?
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Find the Running Median
You are viewing a single comment's thread. Return to all comments →
You are on a heap challenge! =P
Try to determine how you can use heaps to solve the problem. Keeping all elements in a min heap would allow you to keep track of the smallest integer, whereas a max heap would let you keep track of the largest. How can you combine these ideas so you have easy access to the median element(s)?