English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

a file used to store the names of the students . If a stack concept is used to insert or remove the names from the file show how the following names will be inserted or removed in the sequence as follows ;
push Rose
Push Melinda
Pop
Push jerry
Push Danny
pop

2007-06-30 05:49:54 · 2 answers · asked by t_a_jd 2 in Computers & Internet Programming & Design

2 answers

For a Stack, "push" places an object at the top of the stack, and "pop" removes the top object. The file's contents after each of those operations:

push Rose (Rose)
Push Melinda (Melinda / Rose)
Pop (Rose)
Push jerry (Jerry / Rose)
Push Danny (Danny / Jerry / Rose)
pop (Jerry / Rose)

2007-06-30 06:02:15 · answer #1 · answered by McFate 7 · 0 0

A stack is a LIFO (Last In First Out) list, so its easy to work out ~:)

2007-06-30 12:52:44 · answer #2 · answered by Linux OS 7 · 0 0

fedest.com, questions and answers