Thread: Stacks and Vectors in C++
November 8th, 2009, 08:59 PM #1
- Join Date
- Apr 2009
Stacks and Vectors in C++
I am currently working on a project and need help with one part. We are not allowed to use the built in library for the stack, but instead must create one of our own. We haven't seen any examples of this, and were just told that we could use either a linked list or a vector, and we chose vector. Any help?
November 11th, 2009, 01:28 PM #2
Depends on the data too. A simple array would work if the data isn't too complicated (one or two dimensional array).
More complicated data would work in a linked-list for sure.
Just remember the basic rule of a stack (and you'll have to implement this in your code): Stacks are LIFO (Last In First Out) and this is accomplished with PUSH and POP operations.
You'll need the push and pop functions along with a pointer to the current location within the stack.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
By butch81385 in forum Graphic Design and Digital PhotographyReplies: 5Last Post: November 19th, 2005, 06:05 PM
By italiamodena575 in forum Graphic Design and Digital PhotographyReplies: 3Last Post: September 13th, 2005, 02:18 AM
By gentry_joey in forum Graphic Design and Digital PhotographyReplies: 2Last Post: July 22nd, 2005, 11:36 PM
By gentry_joey in forum Graphic Design and Digital PhotographyReplies: 11Last Post: August 27th, 2003, 08:18 PM
By Pshawn5 in forum IMO CommunityReplies: 3Last Post: January 10th, 2002, 03:20 PM