Stacks, Queues, and Search Algorithms in Programming Coursework

Exclusively available on Available only on IvyPanda® Made by Human No AI

Stacks and queues are two similar abstract data types (ADT) that build on the linked list, though they can be implemented using vectors or arrays, instead. They limit the base ADT’s functionality by restricting access to elements at either end of the list. The queue allows reading elements from the tail; the stack, conversely, grants read access to the elements at its head. Both ADTs only allow elements to be added at the head. Thus, the queue is a first in, first out (FIFO) structure, while the stack is a first in, last out (FILO) structure.

These ADTs are useful for situations where elements are added onto the structure over time but should be accessed or processed only in the same order they were added or the opposite. For instance, stacks are often used as part of undo/redo functionality in applications (Geeksforgeeks, 2021). Queues, meanwhile, see use in order processing or message routing systems to ensure requests are processed in the order they were created (Tang, 2013). Ultimately, the critical factors in deciding to use stacks or queues rather than other ADTs are the necessity to only access data in a specific order. The decision between a queue and a stack depends on the specific order in question, as described by the structures’ FIFO or FILO definitions.

Various sorting algorithms allow one to order a set of data in a list or array according to some comparable attribute. Alphabetical ordering and order by number are some of the most obvious examples. One can combine algorithms for efficiency and effectiveness; for instance, binary search is generally an efficient search algorithm; however, it can only work on an ordered collection. Therefore, it stands to reason that a collection (array or list) that must be searched often should be sorted first to achieve higher efficiency and, thus, better performance. Furthermore, one can use a sorting or search algorithm when adding new elements to a collection to ensure that the data contained within is always sorted. This approach saves processing time on searching for specific elements at the cost of performance when adding new elements.

Reference

Geeksforgeeks.com (2021). .

Tang, D (2013). CS240 — Lecture Notes: Queues. Cpp.edu. Web.

More related papers Related Essay Examples
Cite This paper
You're welcome to use this sample in your assignment. Be sure to cite it correctly

Reference

IvyPanda. (2023, February 7). Stacks, Queues, and Search Algorithms in Programming. https://ivypanda.com/essays/stacks-queues-and-search-algorithms-in-programming/

Work Cited

"Stacks, Queues, and Search Algorithms in Programming." IvyPanda, 7 Feb. 2023, ivypanda.com/essays/stacks-queues-and-search-algorithms-in-programming/.

References

IvyPanda. (2023) 'Stacks, Queues, and Search Algorithms in Programming'. 7 February.

References

IvyPanda. 2023. "Stacks, Queues, and Search Algorithms in Programming." February 7, 2023. https://ivypanda.com/essays/stacks-queues-and-search-algorithms-in-programming/.

1. IvyPanda. "Stacks, Queues, and Search Algorithms in Programming." February 7, 2023. https://ivypanda.com/essays/stacks-queues-and-search-algorithms-in-programming/.


Bibliography


IvyPanda. "Stacks, Queues, and Search Algorithms in Programming." February 7, 2023. https://ivypanda.com/essays/stacks-queues-and-search-algorithms-in-programming/.

If, for any reason, you believe that this content should not be published on our website, please request its removal.
Updated:
This academic paper example has been carefully picked, checked and refined by our editorial team.
No AI was involved: only quilified experts contributed.
You are free to use it for the following purposes:
  • To find inspiration for your paper and overcome writer’s block
  • As a source of information (ensure proper referencing)
  • As a template for you assignment
1 / 1