what are stacks? For what are they good? when should i use them and how are they implemented?
what are stacks? For what are they good? when should i use them and how are they implemented?
Stack is an Abstract Data Type,not an data structure as most books say!! as u can implement it with array , list etc. It obeys LIFO(Last in Fast Out) rule. It is used extensively in programming where u need to insert data items and retrieve them in such a way that the last item is got when a POP() operation is called.
Operation on a stack:
1. Push() : 2 insert data item
2. Pop() : 2 delete the last item inserted
3. Peep() : 2 see the last item inserted
4. Show_stack() : 2 see the contents of the stack
Try 2 implement these in C/C++.(try first using array)
Refer a good book in case of sudying data structure.
Sorry i could give u more on it but sorry i am very busy now!!!
For more info on C/C++ ask freely at
[email protected]
The internet holds a wonderful amount of information: http://www.google.com/search?q=stack%20data%20structure
Look at that! The very first link is straight from wikipedia, and the second link points at a tutorial on cprogramming.com! Who would have thought that we'd have tutorials?
If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein
Stack of cards, stack of plates.what are stacks?
Storing stuff.For what are they good?
When you want to retrieve items in the reverse order in which they were stored, i.e. you want to retrieve the last item you stored first, and the first item you stored last.when should i use them
The STL uses a deque.and how are they implemented?
By default... you can change it to something else if you want.Originally Posted by 7stud
"Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
-Christopher Hitchens