OpenStudy (anonymous):

what are linked list, stack and queue ??

OpenStudy (anonymous):

A linked list is a sequential access data structure, where each element can be accessed only in particular order A stack is a container of objects that are inserted and removed according to the last-in first-out (LIFO) principle A queue is a container of objects (a linear collection) that are inserted and removed according to the first-in first-out (FIFO) principle.

OpenStudy (rsmith6559):

When you think of a stack, think of the stack of dishes in your cabinet. The last dish put on the stack is the first one you'll use. A queue is analogous to the check out line anywhere. The first one in line is the next one. Linked lists are more datacentric. It's a list of objects. Whatever you want in the collection, and a pointer to the next object in the list, a link. This makes you start at the first element and search through the list in one direction. A doubly linked list has both the address of the next object and the previous object in the list so it can be searched in both directions.

OpenStudy (anonymous):

thank you for all the replies.. please Could you also help me to write basic programs (like inserting / deleting new element) based on Linked Lists, Stacks AND Queues in C++

OpenStudy (anonymous):

Hi Akshay, Have you tried reading any algorithm for implementing the same? Are you having trouble implementing/coding the algorithm? Or you haven't understood the algorithm?

OpenStudy (rsmith6559):

Queues and stacks can be implemented with vectors. As you add elements, you just use the push_back() method. To remove from a stack, you just remove from the end of the stack. To remove from a queue, you'd remove from the beginning. Linked lists really need to use objects, because each element in the list will have the element, and the address of the next element. Usually the last element of a linked list has a null address for the next address, but actually any sentinel value would do. Google these data structures or start with Wikipedia, I'm sure there are good tutorials out there.

OpenStudy (anonymous):

i am having trouble understanding the algorithm.