Queue using c#
-
Seeking help with (i) method/ c# code to remove every second item in a queue I tried front.next = front.next.next but it this is removing only one second item just after the first but would like to remove every other second item/element through out the queue. (ii) c# code for reversing a queue . :confused:
-
Seeking help with (i) method/ c# code to remove every second item in a queue I tried front.next = front.next.next but it this is removing only one second item just after the first but would like to remove every other second item/element through out the queue. (ii) c# code for reversing a queue . :confused:
(ii) A queue is a first in first out type right? So take a queue that you want reversed and put it into a stack. Then move the stack to a new queue. This will reverse the queue.
-
(ii) A queue is a first in first out type right? So take a queue that you want reversed and put it into a stack. Then move the stack to a new queue. This will reverse the queue.
-
Seeking help with (i) method/ c# code to remove every second item in a queue I tried front.next = front.next.next but it this is removing only one second item just after the first but would like to remove every other second item/element through out the queue. (ii) c# code for reversing a queue . :confused:
This sounds like a homework problem. Even if someone here did it for you, you still wouldn't be able to do future (and harder!) problems. Use an easy problem like this to develop your programming skills. Figure out the procedure you'd use to solve this with pen and paper. Then figure out how to implement this algorithm with C#.