Home > Back-end >  Two stack implementation team what is the best solution?
Two stack implementation team what is the best solution?

Time:04-08

Once interviewed the question, when seen A similar interpretation, use A stack is responsible for the push, another stack is responsible for the pop team all the time in A stack, out of the team and to its full pressure into B stack, so that the top is to output value, but the interviewer said to me can also optimize? I can't answer, finally said there are more optimal solution, how to do excuse me?

CodePudding user response:

A total of three methods, have a kind of the highest space utilization, both of the stack space available, source code, see "the essence of c + + programming tutorial" operator overloading instance of chapter 11,

CodePudding user response:

The most efficient code of the stack to see "the essence of c + + programming tutorial" chapter 11,

CodePudding user response:

2 patients in reference to the building height response:
once interviewed the question, when seen A similar interpretation, use A stack is responsible for the push, another stack is responsible for the pop team all the time in A stack, out of the team and press it all into B stack, so that the top is to output value, but the interviewer said to me can also optimize? I can't answer, finally said there are more optimal solution, how to do excuse me?

The most efficient code of the stack to see "the essence of c + + programming tutorial" chapter 11
  • Related