Queue or the sorts

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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