Saw this on  a seperate group .. Since answer not known to me sharing it
here

you have a stack . Exposed functionality is push and pop only .

What minimal modifications would you do such that
you should find middle element in o(1) time .

I think this is only possible if you make sure that at push you store the
middle element with the top element as well .. this would mean push would
cease to be o(1)   & become o(n) .. . or is there some other trick ?


thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.


Reply via email to