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.
"how will you...find the new maximum value?"
- peep the top of the stack. If a previous value has become the new max, it will be sitting at the top of the stack.
This is because if the top two values m1, m2 lie at x_i, x_i+n, then all the values [x_i, x_i+n) = m1.
Maximum Element
You are viewing a single comment's thread. Return to all comments →
"how will you...find the new maximum value?" - peep the top of the stack. If a previous value has become the new max, it will be sitting at the top of the stack.
This is because if the top two values m1, m2 lie at x_i, x_i+n, then all the values [x_i, x_i+n) = m1.
For example: