6.(10%) Write an algorithm queue partitioning(g. k) to reorder all data elements in a queue q. Assume that the queue q has n integer elements initially. Given an integer k > 1, the reordering will form k ordered partitions of these integers. The resulting queue should be in the order of partition 0, partition 1, and partition k-1. The
partition of these integer elements contains all integer elements e in the original queue such that e mod k= i. (In this algorithm, you can utilize an empty queue q2 as a local variable.) You can use a function length(q) to get the length of the queue q.
For illustration, Figure 3 shows an example with an initial queue state, k = 3, ordered partitions, and a final queue state.
