Prepare a method rearrange that takes a queue of integers


Question: Prepare a method rearrange that takes a queue of integers as a parameter and rearranges the order of the values so that all of the even values appear before the odd values and that otherwise preserves the original order of the list.

For case, suppose a queue called q stores this sequence of values: front [3, 5, 4, 17, 6, 83, 1, 84, 16, 37] back Then the call of rearrange(q); should rearrange the queue to store the subsequent sequence of values: front [4, 6, 84, 16, 3, 5, 17, 83, 1, 37] back Notice that all of the evens appear at the front of the queue followed by the odds and that the order of the evens is the same as in the original list and the order of the odds is the same as in the original list.

You may use one stack as auxiliary storage.

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: Prepare a method rearrange that takes a queue of integers
Reference No:- TGS0962025

Expected delivery within 24 Hours