Computers & Technology
6 November, 16:09
Contrast and compare: an array, a stack, and a queue. Identify the principal uses of each and give an example.
6 November, 17:54
All three of them are linear Data Structures.
A stack is a FILO (First In Last Out) or LIFO (Last In First Out) type data structure means first inserted element will be the last one to be removed form the stack. Insertion and Deletion is from one end only called head.
ex:-A stack of books on the shelf.
A queue is FIFO (First In First Out) type means the first inserted element will be the first one to be removed. In queue insertion is from the back or tail and removal of elements is done form the front.
ex:-A queue at the ticket counter.
In array each element stored is given an index, by which we can be access the element very easily. We can use this index to modify or store element at that index of the array. i. e any object can be accessed with the right index, unlike queue and stack.
We can access only the front and back in the queue. In stack we can access only the top but in array we can access any element with the index.
Know the Answer?
New Questions in Computers & Technology
Why did Louis XVI marry Marie Antoinette
What is not critical when you are first designing a database?
Which Azure service should you use to correlate events from multiple resources into a centralized repository? A. Azure Event Hubs B. Azure Analysis Services C. Azure Monitor D. Azure Log Analytics
You and your brother each start a child-care service. You spend $50 on supplies and plan to charge $10 per hour. Your brother spends $30 on supplies and plans to charge $8 per hour.
What is the answer to the equation, 27x^3 - 8?
⭐️ Computers & Technology
» Contrast and compare: an array, a stack, and a queue. Identify the principal uses of each and give an example.