阅读背景:

PAT:Stack (30)(树状数组+二分查找)

来源:互联网 
Stack is one of the most fundamental data structures, which is based on the principle of Last In First Out (LIFO).  The basic operations include Push (inserting an element onto the top position) and Pop (deleting the top element).  Now you are supposed to implement a stack with an extra operation: PeekMedian -- return the median value of all the elements in the stack.  With N elements, the median value is defined to be the (N/2)-th smallest element if N is even, or ((N+1)/2)-th if N is odd.Stack is one of the most fundamental data



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: