Queue management task | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

Queue management task

Why do we set size as 0 and reserve memory from the heap in the constructor Queue()? Doesn’t that mean that we’re going to have size 0 every time we create an object? https://code.sololearn.com/cuq3IyszKJ4s/?ref=app

25th Jul 2022, 8:36 AM
samuraicat
2 Réponses
+ 1
Yes, each new instance of Queue would have zero item, and reserved 100 slots for its items.
25th Jul 2022, 8:45 AM
Ipang
+ 1
Ipang I din’t realize that’s for many queues, that was helpful, ty
25th Jul 2022, 8:55 AM
samuraicat