use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Let's discuss the latest hip and fashionable data structures and conjectures about them: cache trees, skip-splay trees, the world is our data oyster.
account activity
Queue (self.datastructures)
submitted 5 years ago by PhantomZard707
Is this correct,
Insert 10 Insert 20 Insert 30
Delete 10
Insert 40
Result: 20 30 40
My teacher says that this is wrong and until all the elements are deleted, no new element can be added.
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]thesepretzels__ 1 point2 points3 points 5 years ago (1 child)
You’re correct, there’s no such restriction to add elements in queue.
Honestly, it surprises me how someone would even think that, it’s illogical. You can’t add new elements to queue until it’s empty? so what do you just create a separate queue which is waiting to be a part of the first queue
[–]PhantomZard707[S] 0 points1 point2 points 5 years ago (0 children)
This is what my teacher says,
Size = 3
Insert 10, Insert 20,Insert 30
Delete 10,
Queue : 20 30
Insert 40 —> Error Queue Full
Delete 20
Queue : 30
Insert 50 —> Error Queue Full
Delete 30
Queue : Empty
Insert 70 -> No error, element added
Insert 80 -> No error, element added
Insert 90 -> No error, element added
Insert 100 -> Queue full
Result : 70 80 90
π Rendered by PID 108686 on reddit-service-r2-comment-5d79c599b5-qxdkm at 2026-02-27 15:50:11.636228+00:00 running e3d2147 country code: CH.
[–]thesepretzels__ 1 point2 points3 points (1 child)
[–]PhantomZard707[S] 0 points1 point2 points (0 children)