Hi,
nachdem ich nun schon 2h lang nachgedacht habe und auf stackoverflow nach Erklärungen gesucht habe, aber dennoch nicht schlauer geworden bin, will ich es hier versuchen.
Die Aufgabenstellung lautet:
Suppose that a client performs an intermixed sequence of stack push and pop operations. The push operations push the integers 0 through 9 in order on to the stack; the pop operations print out the return value. Which of the following sequences could not occur?
(a) 4 3 2 1 0 9 8 7 6 5
(b) 2 1 4 3 6 5 8 7 9 0
(c) 0 4 6 5 3 8 1 7 2 9
(d) 4 6 8 7 5 3 2 9 1 0
(e) All of these sequences are possible
Die Antwort ist C. Ich kann aber überhaupt nicht nachvollziehen warum. Bitte erklärt mir das einer für ganz doofe Menschen.
nachdem ich nun schon 2h lang nachgedacht habe und auf stackoverflow nach Erklärungen gesucht habe, aber dennoch nicht schlauer geworden bin, will ich es hier versuchen.
Die Aufgabenstellung lautet:
Suppose that a client performs an intermixed sequence of stack push and pop operations. The push operations push the integers 0 through 9 in order on to the stack; the pop operations print out the return value. Which of the following sequences could not occur?
(a) 4 3 2 1 0 9 8 7 6 5
(b) 2 1 4 3 6 5 8 7 9 0
(c) 0 4 6 5 3 8 1 7 2 9
(d) 4 6 8 7 5 3 2 9 1 0
(e) All of these sequences are possible
Die Antwort ist C. Ich kann aber überhaupt nicht nachvollziehen warum. Bitte erklärt mir das einer für ganz doofe Menschen.