Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Define a queue. What are the three interfaces we defined related to our Queue AD

ID: 3807114 • Letter: D

Question

Define a queue. What are the three interfaces we defined related to our Queue ADT? Complete the implementation of the isFull method: public boolean isFull() // Returns true if this queue is full, otherwise returns false. { // complete the method body } Complete the implementation of the enqueue method: public void enqueue(T element) // Throws QueueOverflowException if this queue is full. // otherwise adds element to the rear of this queue { // complete the method body } Complete the implementation of the dequeue method: public: T dequeue() // Throws QueueUnderflowException if this queue is empty // otherwise removes front element from this queue and returns it. { // complete the method body } Define a list. What are the three varieties of lists defined in the textbook? What operations are required by our IndexedListInterface but not by our Listlnterface? (at least 3 to get full grade) Describe the functionality of the list contains method.

Explanation / Answer

Define Queue:

Queue is an abstract data structure, it is similar to Stacks.Queue is open at both of its ends. It basically works on method called FIFO (First in -First out).

One end is always used to insert data (enqueue) and the other is used to remove data (dequeue).

So the data first inserted in the queue will be accessed first.

Example : In a single lane road, vehicle first enters the tunnel will leave the tunnel first.

2. Interfaces related to Queue ADT

                        Following are the interfaces that are used in Queue ADT

a.) enqueue ()

b.) dequeue()

c.) isEmpty()

Complete the implementation : isFull()

public boolean IsFull()
    {
       /*Return true if the queue is full or false if the quere is empty.*/
    
       if (Head == (Tail + 1 % Qsize )) /*Head is out of range of Queue full*/
         return true;
       else return false;
    }

Complete the implementation enqueue()

Complete the implementation dequeue()

Define List:

                  List is an abstract data type it represents finite number of ordered values, where same value may occur more than once. If the same value occurs multiple time, it will be considered as distinct items.

Types of List in Data structures:

       a.) Singly linked list

       b.) Doubly linked list

       c.) Circular linked list

Contains() method

                      The Contains() method will work in such a way it will return true if the value available in the list, else will return false.

               

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote