Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Oppiskele 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

Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 2. Luku 2

Kysy tekoälyä

expand

Kysy tekoälyä

ChatGPT

Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme

Suggested prompts:

Kysy minulta kysymyksiä tästä aiheesta

Tiivistä tämä luku

Näytä käytännön esimerkkejä

Awesome!

Completion rate improved to 4.35

bookQueue

Pyyhkäise näyttääksesi valikon

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

Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 2. Luku 2
some-alt