Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Stack.push(el) = {
- buff = Queue()
- buff.push(el)
- while(!q.empty())
- buff.push(q.pop())
- q = buff
- }
- Stack.pop = q.pop()
- Stack.top = q.front()
- Stack.max = {
- buff = Queue()
- max_el = null
- while(not q.empty()) {
- el = q.pop()
- if(max_el is null or max_el < el)
- max_el = el
- buff.push(el)
- }
- q = buff
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement