Question: In java (a) Given the following specification of the ADT Queue, iplement this data structure using Array representation. You should write the class ArrayQueue that
(a) Given the following specification of the ADT Queue, iplement this data structure using Array representation. You should write the class ArrayQueue that imple- ments the interface Queue Specification of ADT Queue enqueue (Type e): requires: Queue Q is not full. input: Type e. results Element e is added to the queue at its tail. output: none . serve (Type e): requires : Queue Q is not empty. nput: none. results: the element at the head of Q is removed and its value assigned to e. output: Type length (intl): requires : none. nput: none. results: The number of elements in the Queue Qis returned. output: 1 full (boolean flag): requires: none. input: none. results: If Qis full then flag is set to true, otherwise flag is set to false. output: flag New methods: multiEnqueue(Type els), int k, : requires: None. input: Type els), int k. results: Te first k elements of the array els are added to the queue at its tail one at a time until the queue is full or all k elements are added. The output l is set to the number of elements that have been added. output:l multiServe(Type els0, int k, int ): requires: None. input: Type els, int k results: The first k elements of the queue are served and stored in els starting at position 0 untl the queue is empty or all k elements are served. The output l is set to the number of elements that have been served. output: 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
