954,506 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

stack and queues

how to implement a stack from to quues or vice cersa

gaurav2589
Newbie Poster
1 post since Nov 2007
Reputation Points: 10
Solved Threads: 0
 

add entry at bottom of stack in lieu of top, in real project you may never need it.

ithelp
Nearly a Posting Maven
Banned
2,230 posts since May 2006
Reputation Points: 769
Solved Threads: 128
 

The stacks and queues are under data structures .stack is a data structure in which insertion and and deletion are done in the top of the stack.but in queue these two are done in the
head and tail of the queue.

mohanrobin
Light Poster
34 posts since Nov 2007
Reputation Points: 36
Solved Threads: 0
 

Erm, stacks and queues are very useful, very basic, and very well-used data structures. To clarify what mohanrobin said:

For a stack, you have a list that you can add items to and remove items from, but only to or from the end (or "top") of the stack.

A queue is basically a stack, except that you can add and remove items from either end.

So it is fairly easy to implement one in terms of the other. Why don't you post some code and/or homework requirements and we'll see if we can't help you further.

[EDIT] BTW. There are "similar threads" down at the bottom of the page that list a whole bunch of stuff about stacks and queues in C.

Duoas
Postaholic
2,043 posts since Oct 2007
Reputation Points: 1,140
Solved Threads: 229
 

i`ve a question regarding stack and queue...
its as to implement queue and stack on these
data: 23,34,56,67,89,90
using linklist....can anyone tell me how to begin..

rizrash
Newbie Poster
19 posts since Apr 2007
Reputation Points: 10
Solved Threads: 0
 
i`ve a question regarding stack and queue...


So start your own thread, don't hijack someone else's thread.its as to implement queue and stack on these
data: 23,34,56,67,89,90
using linklist....can anyone tell me how to begin..
Read the rules and other important sticky posts, make your own thread, and tell us which you want -- stack, queue, or linked list.Erm, What the heck is anerm?

WaltP
Posting Sage w/ dash of thyme
Moderator
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
 

> What the heck is an erm.

:$ Oh, urgh, um... Exchange Rate Mechanism, Enterprise Resource Management, Erase Reserved Memory, Electronic Rodent Monitoring, Earth Resistance Meter, uh...

:)

Duoas
Postaholic
2,043 posts since Oct 2007
Reputation Points: 1,140
Solved Threads: 229
 

> What the heck is an erm.

:$ Oh, urgh, um... Exchange Rate Mechanism, Enterprise Resource Management, Erase Reserved Memory, Electronic Rodent Monitoring, Earth Resistance Meter, uh...

:)


Oh, of course. I thought I was averbal expression that has no place in writing. Silly me! :icon_wink:

WaltP
Posting Sage w/ dash of thyme
Moderator
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
 

Actually, though, you are right. I've a bad habit of doing that. I don't imagine it to be very understandable to people for whom English is a second language. I'll try to desist. :sweat:

Duoas
Postaholic
2,043 posts since Oct 2007
Reputation Points: 1,140
Solved Threads: 229
 
The stacks and queues are under data structures .stack is a data structure in which insertion and and deletion are done in the top of the stack.but in queue these two are done in the head and tail of the queue.


i think stacks are working with a principle LIFO(LAST IN FIRST OUT). i.e suppose any element i.e you insert it is going ro the first elemne . like if you do a tower with books you remove the last inserted book. thats way stack are used,


but in queues ,it based on the first in first out.

venkat.malasani
Newbie Poster
1 post since Feb 2008
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You