Data structure queue confusion

PRCube

I'm practising with data structures at the moment, I came across this question at one of the online tests I was taking and it confused me. Can anyone clarify this for me because I couldn't answer it and I started hesitating my knowledge.

Question:

Assume that the underpinning data structure for the implementation of queues is an array. How will you guarantee that an empty queue (array) is not taken mistakenly for a full one.

Carorus

If you implement a queue using an array the queue's max size will be the size of the array, but you can't tell if the queue is empty or full just using the size of the array cause is static, you need to keep a counter that increases or decreases depending if you add or remove elements to the queue, when the counter is equal to the length of the array the queue if full, you could also validate if the queue is empty when all the positions in the array are null, but that'll consume more time that having just a counter, I guess you actually know all this but to me seems like the question is referring to that.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

confusion with data structure allignment?

From Dev

Python queue like data structure

From Dev

data structure confusion over implementation of perceptron in java

From Dev

Structure Confusion

From Dev

A data structure like Queue with access to last element

From Dev

What is the best data structure to implement a queue?

From Dev

issue in making Queue data structure as array implementation

From Dev

Best Data Structure for Priority Queue implementation

From Dev

Python Queue and Threading confusion

From Dev

Confusion in getting size of a structure

From Dev

Pyramid directory structure confusion

From Dev

What's the advantage using lazy evaluation in Queue data structure?

From Dev

What data structure should I use for a music play queue?

From Dev

Concurrency help on a custom queue-like data structure

From Dev

Need Idea to customize an Algorithm in Data Structure Using Priority Queue

From Dev

Data-structure for a priority queue with element uniqueness based on an element field

From Dev

Concurrency help on a custom queue-like data structure

From Dev

WPF Data Binding confusion

From Dev

Confusion regarding Netflow data

From Dev

Data base confusion

From Dev

What is the right data structure for a queue that support Min, Max operations in O(1) time?

From Dev

What data structure do I need or how to implement a "LIFO-like" queue?

From Dev

Node JS, Express Structure and Require Confusion

From Dev

Construct confusion matrix with missing data

From Dev

confusion over data initialization in Java

From Dev

Confusion over data structures in Haskell

From Dev

data bus and addressing memory confusion

From Dev

Mongo Mongoose Data Bridging Confusion

From Dev

Confusion about data usage in Controllers

Related Related

  1. 1

    confusion with data structure allignment?

  2. 2

    Python queue like data structure

  3. 3

    data structure confusion over implementation of perceptron in java

  4. 4

    Structure Confusion

  5. 5

    A data structure like Queue with access to last element

  6. 6

    What is the best data structure to implement a queue?

  7. 7

    issue in making Queue data structure as array implementation

  8. 8

    Best Data Structure for Priority Queue implementation

  9. 9

    Python Queue and Threading confusion

  10. 10

    Confusion in getting size of a structure

  11. 11

    Pyramid directory structure confusion

  12. 12

    What's the advantage using lazy evaluation in Queue data structure?

  13. 13

    What data structure should I use for a music play queue?

  14. 14

    Concurrency help on a custom queue-like data structure

  15. 15

    Need Idea to customize an Algorithm in Data Structure Using Priority Queue

  16. 16

    Data-structure for a priority queue with element uniqueness based on an element field

  17. 17

    Concurrency help on a custom queue-like data structure

  18. 18

    WPF Data Binding confusion

  19. 19

    Confusion regarding Netflow data

  20. 20

    Data base confusion

  21. 21

    What is the right data structure for a queue that support Min, Max operations in O(1) time?

  22. 22

    What data structure do I need or how to implement a "LIFO-like" queue?

  23. 23

    Node JS, Express Structure and Require Confusion

  24. 24

    Construct confusion matrix with missing data

  25. 25

    confusion over data initialization in Java

  26. 26

    Confusion over data structures in Haskell

  27. 27

    data bus and addressing memory confusion

  28. 28

    Mongo Mongoose Data Bridging Confusion

  29. 29

    Confusion about data usage in Controllers

HotTag

Archive