473,770 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Queue or the sorts

I am trying to create a 'queue', or something like it. I am storing 1 to 6
integers in a list and need to move backwards and forwards in the list
(like the back and forward arrows do in internet explorer, except these are
numbers). I have tried a Stack, queue class, but can't seem to make them
work right moving back forwards / backwards. This list of numbers will
start with no numbers in it and grow to a max of 6 numbers, depending on how
many numbers are added to it.
Thanks a bunch
BUC
Mar 6 '07 #1
4 1118
On Mar 6, 2:07 pm, <bucrepuswrot e:
I am trying to create a 'queue', or something like it. I am storing 1 to 6
integers in a list and need to move backwards and forwards in the list
(like the back and forward arrows do in internet explorer, except these are
numbers). I have tried a Stack, queue class, but can't seem to make them
work right moving back forwards / backwards. This list of numbers will
start with no numbers in it and grow to a max of 6 numbers, depending on how
many numbers are added to it.
Thanks a bunch
BUC
I would use a List(Of T) I think. You really need random access for
this, and queues and stacks aren't really designed for this.

--
Tom Shelton

Mar 6 '07 #2
Hi,

A queue and a stack are not made for what you ask, I don't know if you have
ever been to England because that is the best place learning what is a
queue.

If you go to a shop you nicely go to the end of the queue, wait until you
are at the end and do your shoping. Maybe you find this normal, however in
England it is real exactly done like this.

A stack is how your program is working.

You have the Main Stack A, that calls another stack B, that calls another
stack C, which is the same as the previous the B. The A is done, the B is
done, the C is done, the B ends, the C ends, the B ends, the A ends. (In
this is a part of recursion)

I hope this gives an idea

Therefore I have the same idea as Tom and use his advice.

Cor
<bucrepusschree f in bericht news:%2******** *******@TK2MSFT NGP02.phx.gbl.. .
>I am trying to create a 'queue', or something like it. I am storing 1 to 6
integers in a list and need to move backwards and forwards in the list
(like the back and forward arrows do in internet explorer, except these are
numbers). I have tried a Stack, queue class, but can't seem to make them
work right moving back forwards / backwards. This list of numbers will
start with no numbers in it and grow to a max of 6 numbers, depending on
how many numbers are added to it.
Thanks a bunch
BUC

Mar 7 '07 #3
Cor,
That's a nice analogy. To put it more briefly, queues are used for
first-in-first-out, and stacks are used for first-in-last-out.
Robin S.
--------------------------------
"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:O2******** ********@TK2MSF TNGP05.phx.gbl. ..
Hi,

A queue and a stack are not made for what you ask, I don't know if you
have ever been to England because that is the best place learning what is
a queue.

If you go to a shop you nicely go to the end of the queue, wait until you
are at the end and do your shoping. Maybe you find this normal, however
in England it is real exactly done like this.

A stack is how your program is working.

You have the Main Stack A, that calls another stack B, that calls another
stack C, which is the same as the previous the B. The A is done, the B is
done, the C is done, the B ends, the C ends, the B ends, the A ends. (In
this is a part of recursion)

I hope this gives an idea

Therefore I have the same idea as Tom and use his advice.

Cor
<bucrepusschree f in bericht
news:%2******** *******@TK2MSFT NGP02.phx.gbl.. .
>>I am trying to create a 'queue', or something like it. I am storing 1 to
6 integers in a list and need to move backwards and forwards in the list
(like the back and forward arrows do in internet explorer, except these
are numbers). I have tried a Stack, queue class, but can't seem to make
them work right moving back forwards / backwards. This list of numbers
will start with no numbers in it and grow to a max of 6 numbers,
depending on how many numbers are added to it.
Thanks a bunch
BUC


Mar 7 '07 #4
WTF is england?

I thought that they are now a state in the US or something


On Mar 6, 10:18 pm, "RobinS" <Rob...@NoSpam. yah.nonewrote:
Cor,
That's a nice analogy. To put it more briefly, queues are used for
first-in-first-out, and stacks are used for first-in-last-out.
Robin S.
--------------------------------
"Cor Ligthert [MVP]" <notmyfirstn... @planet.nlwrote in messagenews:O2* *************** @TK2MSFTNGP05.p hx.gbl...
Hi,
A queue and a stack are not made for what you ask, I don't know if you
have ever been to England because that is the best place learning what is
a queue.
If you go to a shop you nicely go to the end of the queue, wait until you
are at the end and do your shoping. Maybe you find this normal, however
in England it is real exactly done like this.
A stack is how your program is working.
You have the Main Stack A, that calls another stack B, that calls another
stack C, which is the same as the previous the B. The A is done, the B is
done, the C is done, the B ends, the C ends, the B ends, the A ends. (In
this is a part of recursion)
I hope this gives an idea
Therefore I have the same idea as Tom and use his advice.
Cor
<bucrepusschree f in bericht
news:%2******** *******@TK2MSFT NGP02.phx.gbl.. .
>I am trying to create a 'queue', or something like it. I am storing 1 to
6 integers in a list and need to move backwards and forwards in the list
(like the back and forward arrows do in internet explorer, except these
are numbers). I have tried a Stack, queue class, but can't seem to make
them work right moving back forwards / backwards. This list of numbers
will start with no numbers in it and grow to a max of 6 numbers,
depending on how many numbers are added to it.
Thanks a bunch
BUC

Mar 7 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
9126
by: Chris Foster | last post by:
I am trying to implement a very fast queue using SQL Server. The queue table will contain tens of millions of records. The problem I have is the more records completed, the the slower it gets. I don't want to remove data from the queue because I use the same table to store results. The queue handles concurrent requests. The status field will contain the following values: 0 = Waiting
3
5154
by: Kceiw | last post by:
Dear all, When I use #include "queue.h", I can't link it. The error message follows: Linking... G:\Projects\Datastructure\Queue\Debug\main.o(.text+0x136): In function `main': G:\Projects\Datastructure\Queue\main.cpp:16: undefined reference to `Queue<char>::Queue()' G:\Projects\Datastructure\Queue\Debug\main.o(.text+0x394): In function `Z10do_commandcR5QueueIcE':
6
9021
by: imutate | last post by:
How do you use std::priority_queue to store say an index type (call it intidx) and sort using another integer type (but smallest weight at the top) ? How do you pop off the top index ? I mean top() returns the top element but how do you access the index and the weight. Is it std::priority_queue <intidx, int>; ? Where does the comparison fit into it ?
4
4599
by: j_depp_99 | last post by:
Thanks to those guys who helped me out yesterday. I have one more problem; my print function for the queue program doesnt work and goes into an endless loop. Also I am unable to calculate the length of my queue. I started getting compilation errors when I included a length function. <code> template<class ItemType> void Queue<ItemType>::MakeEmpty() {
0
9617
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10254
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10036
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9904
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7451
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5481
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3607
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2849
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.