I think stack would solve the purpose. please comment. On Sun, Jul 15, 2012 at 5:42 PM, enchantress <elaenjoy...@gmail.com> wrote:
> It says K days if you keep heap the order of values gets disturbed. How > are last k values accessed then? > > > On Sunday, 15 July 2012 12:46:02 UTC+5:30, adarsh kumar wrote: >> >> Min or max heap accordingly. This will do the job in O(log n) time. >> >> On Sun, Jul 15, 2012 at 1:25 AM, Navin Kumar <algorithm.i...@gmail.com>wrote: >> >>> A set of integer values are being received (1 per day). Store these >>> values and at any given time, retrieve the min and max value over the last >>> k days. What data structures would you use for storing and retrieving ? >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Algorithm Geeks" group. >>> To view this discussion on the web visit https://groups.google.com/d/** >>> msg/algogeeks/-/2AhV1Xn3jD8J<https://groups.google.com/d/msg/algogeeks/-/2AhV1Xn3jD8J> >>> . >>> To post to this group, send email to algogeeks@googlegroups.com. >>> To unsubscribe from this group, send email to algogeeks+unsubscribe@** >>> googlegroups.com <algogeeks%2bunsubscr...@googlegroups.com>. >>> For more options, visit this group at http://groups.google.com/** >>> group/algogeeks?hl=en <http://groups.google.com/group/algogeeks?hl=en>. >>> >> >> -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/algogeeks/-/peWhqjKLIH8J. > > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.