how to implement a stack from to quues or vice cersa

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

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.

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.

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..

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 an erm?

> 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...

:)

> 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 a verbal expression that has no place in writing. Silly me! :icon_wink:

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:

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.