Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Impara Queue | Data Structures Part I
Data Structure & Algorithms PART I

bookQueue

OperationBest Time ComplexityAverage Time ComplexityWorst Time ComplexityMemory Complexity
SearchO(1)O(n)O(n)O(1)
InsertionO(1)O(1)O(1)O(1)
DeletionO(1)O(1)O(1)O(1)

FIFO - first input, the first output.

Every day we go shopping. After choosing all products, we need, we go to the box office to pay for our purchases. And there, near the box office, we will meet other people who also decided to go shopping.

In computer programming, the queue is so ideal that the first person in the queue leaves the queue only if the last new customer has become a part of the queue.

The same in the data structure queue.

Enqueue is the process when the new customer becomes the last person in the queue. The process when the first customer leaves the queue is called dequeue.

The problem with the data structure queue is that it can be full. For example, only 10 people can stay near the box office while the rest of the customers must wait until there will be some empty place for them. In computer programming, we can check if the queue isEmpty or IsFull.

Advantage:

  • Slight saving of memory is possible.

Disadvantage:

  • The array size limits the maximum number of elements in the queue.
question mark

What statement is true?

Select the correct answer

Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 2. Capitolo 2

Chieda ad AI

expand

Chieda ad AI

ChatGPT

Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione

Awesome!

Completion rate improved to 4.35

bookQueue

Scorri per mostrare il menu

OperationBest Time ComplexityAverage Time ComplexityWorst Time ComplexityMemory Complexity
SearchO(1)O(n)O(n)O(1)
InsertionO(1)O(1)O(1)O(1)
DeletionO(1)O(1)O(1)O(1)

FIFO - first input, the first output.

Every day we go shopping. After choosing all products, we need, we go to the box office to pay for our purchases. And there, near the box office, we will meet other people who also decided to go shopping.

In computer programming, the queue is so ideal that the first person in the queue leaves the queue only if the last new customer has become a part of the queue.

The same in the data structure queue.

Enqueue is the process when the new customer becomes the last person in the queue. The process when the first customer leaves the queue is called dequeue.

The problem with the data structure queue is that it can be full. For example, only 10 people can stay near the box office while the rest of the customers must wait until there will be some empty place for them. In computer programming, we can check if the queue isEmpty or IsFull.

Advantage:

  • Slight saving of memory is possible.

Disadvantage:

  • The array size limits the maximum number of elements in the queue.
question mark

What statement is true?

Select the correct answer

Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 2. Capitolo 2
some-alt