You can do this using two stacks
---------------------------------------------------------------------------------------------------------------------------
Stack s, m;
 
Push(x):
    s.push(x)
    if(x > m.top())
         m.push(m.top())
    else
         m.push(x)
 
Pop():
    m.pop()
    return s.pop()
 
FindMin():
    return m.top()
---------------------------------------------------------------------------------------------------------------------------
 
On 3/28/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

Fine, I read it "can" be! Bone head!
Obvi can't, as some one already put it
that would mean sorting in O(n).


, 133470973390.236450, 270};
int main(){m[2]--?m[0]*=4,m[1]*=5,main():printf(m);}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to