Question

Explain the difference between a fixed-front array-based queue and a floating array-based queue. Does the floating...

Explain the difference between a fixed-front array-based queue and a floating array-based queue. Does the floating array-based queue have potential value for implementing a stack?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

In fixed front array based queue the front which is the index of the first element of the array is fixed, whereas in floating based array the front is not fixed. FIxed front array based queue is of static type but floating array based queue is dynamic in nature. In floating array based queue insertion and deletion can be performed in both sides, but in fixed front array based queue insertion can be done only from one side and deletion from the other.

Yes the floating array based queue can have a potential value. If we consider the push time to be 0(1), than push and pop will take 0(n), also we need to make the array infinite. we can improve the 0(n) performance/potential of top by introducing an extr variable to store top of stack. The variable is updated whenever push and pop are called. The Operation of push and pop takes constant time. But the approach is not feasible.

Add a comment
Know the answer?
Add Answer to:
Explain the difference between a fixed-front array-based queue and a floating array-based queue. Does the floating...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • In Array Based Queue. The program calls for implementing a queue using an array such that...

    In Array Based Queue. The program calls for implementing a queue using an array such that the queue wraps around to reuse empty array slots. This means that the Head and Tail of the array can reverse relative positions. If, rather than changing the value of the Head and Tail, a modulus (of the size of the array) was used instead, what boundary condition could eventually be reached?

  • 2. Consider a circular array based Queue as we have discussed in the lectures (class definition...

    2. Consider a circular array based Queue as we have discussed in the lectures (class definition given below for reference) public class CircArrayQueue<E> implements Queue<E private EI Q private int front-0 indicates front of queue l indicates position after end of queue private int end-0: public CircArrayQueue( public int getSize (.. public boolean isEmpty ( public void enqueue (E e)... public E dequeue ) throws EmptyQueueException... Il constructor We are interested in implementing a Stack class based on the above...

  • Build and use your own minimal queue class using an array of type String of fixed...

    Build and use your own minimal queue class using an array of type String of fixed size to hold the queue. The array should have the default size of 5. The array size should be setable via a constructor. The following methods must be implemented: enqueue – inserts a value at the rear of the queue dequeue – returns the value at the front of the queue, removing the value from the queue isEmpty – returns true if the queue...

  • Lab 3 – Array-Based Stack and Queue Overview In this assignment, you will be implementing your...

    Lab 3 – Array-Based Stack and Queue Overview In this assignment, you will be implementing your own Array-Based Stack (ABS) and Array-Based Queue (ABQ). A stack is a linear data structure which follows the Last-In, First-Out (LIFO) property. LIFO means that the data most recently added is the first data to be removed. (Imagine a stack of books, or a stack of papers on a desk—the first one to be removed is the last one placed on top.) A queue...

  • Suppose we have an array-based queue (circular buffer) of size 6: int data[6]; int front =...

    Suppose we have an array-based queue (circular buffer) of size 6: int data[6]; int front = 0, back = 0; void enqueue(int x) { data[back] = x; back = (back + 1) % 6; } void dequeue() { front = (front + 1) % 6; } and we perform the following series of queue operations: enqueue(1); dequeue(); enqueue(2); dequeue(); enqueue(7); enqueue(3); enqueue(5); dequeue(); dequeue(); enqueue(4); enqueue(6); Write the state of the queue array after each operation, and at the end,...

  • What is the principle difference in behavior between a stack and a queue? a stack preserves...

    What is the principle difference in behavior between a stack and a queue? a stack preserves the order in which items are added whereas a queue reverses order there is no difference a stack reverses the order in which items are added whereas a queue preserves order xa stack does nothing whereas a queue can preserve and reverse the order that items are added to it Fill in the blank in the following sentence with one of the answers listed....

  • Exercise 5: Sketch the circular array based queue after each operation. Include the front and rear...

    Exercise 5: Sketch the circular array based queue after each operation. Include the front and rear indices in each sketch. queue <int, 5> bar; bar.enqueue(5); bar.enqueue(4); bar.dequeue(); bar.enqueue(3); bar.dequeue();

  • explain the difference between fixed and floating exchange rates 10. Why does total revenue vary directly with price, if the demand is relatively price inelastic? Explain the relationships betwee...

    explain the difference between fixed and floating exchange rates 10. Why does total revenue vary directly with price, if the demand is relatively price inelastic? Explain the relationships between elasticity, price, and revenue 10. Why does total revenue vary directly with price, if the demand is relatively price inelastic? Explain the relationships between elasticity, price, and revenue

  • Where does top point, when implementing a stack with a LLL? Queue ADT: 1· 2. Where...

    Where does top point, when implementing a stack with a LLL? Queue ADT: 1· 2. Where does front point, when implementing a queue with a LLL? Where does rear point, when implementing a queue with a LLL? Where does rear point, when implementing a queue with a CLL? a. b. c. 3. If you were to enqueue 10, 20, and 30 onto a queue in this order and then dequeue them off, in what order will they be removed from...

  • uppose that Q is an initially empty array-based queue of size 5. Show he values of...

    uppose that Q is an initially empty array-based queue of size 5. Show he values of the data members front and back after each statement has een executed. Indicate and errors that might occur. Queue< char Q 5 Q.enqueue( 'A'); Q. enqueue( 'B Q.enqueue(C; char c = Q.dequeue( ); Q. enqueue( 'A; front = front » front - front = front = front = back back = back - back back =-- back =

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT