第十六题选A 采用双栈当队时,假设前n个元素都先“入队”进入栈A,第一次进行"出队"操作时,所有元素都从栈A出栈到栈B,时间复杂度O(n),但之后的每一次出栈操作,都只需要进行B.pop()即可,时间复杂度O(1),故均摊下来,其均摊时间复杂度为O(1)
By signing up a 水木清研 OJ universal account, you can submit code and join discussions in all online judging services provided by us.
Using your 水木清研 OJ universal account