For an inexperienced student such as myself, that title can
seem a bit daunting. Hopefully this post will help make it easier to understand
while providing some advice on when certain designs should be used before
others. I tend to learn best from watching YouTube videos in addition to
reading text, so I will also post a couple links to videos I personally found
helpful. Understanding how data structures and algorithms work will help you
solve problems in a more effective and efficient manner.
Let’s
start with explaining what an algorithm is and discussing some of the important
categories. Tutorialspoint.com defines algorithms as a “step-by-step procedure,
which defines a set of instructions to be executed in a certain order to get
the desired output.” Think of any process you perform on a daily basis that
requires several steps, and you probably follow an algorithm. Some of the
categories include:
Search:
An algorithm designed to search for a specific item in a data structure. The
two most popular search algorithms are Linear Search and Binary Search
Sort: An
algorithm designed to sort items into a certain order. Some examples are Merge
Sort, Insertion Sort, and Heap Sort
Insert: An
algorithm designed to insert items into a data structure
Update: An
algorithm designed to update an existing item in a data structure
Delete: An
algorithm designed to delete an existing item from a data structure
So how do you determine which algorithm and
data structure is going to be the most effective? Your first instinct may be to
go with whichever one is going to use the most resources to provide the fastest
response time. In some cases, this may be fine, but if you are dealing with a
simple program that doesn’t require a lot of processing, you should use a
simple data structure that won’t eat up all of a computer’s resources. For
example, an array is a great choice for accessing indexed data in a list. A
hash table is a list of paired values with the first item being the key and
second item the value. This allows access to objects by using the key,
providing high-speed lookups, but it does not maintain any order. Stacks use a
process called Last In First Out, or LIFO. This means data can only be
inserted, read or removed from the end of a stack. Queues are similar to stacks
except data can only be inserted at the end, read from the front, and removed
from the front, much like a line of people waiting to enter a movie theater. There are many
more types of algorithms and data structures, and possessing a basic
understanding of them can help in your design process. The video below
discusses the importance of understanding these concepts:
References
Development (2019, January 10). Improving your Data Structures, Algorithms, and Problem Solving Skills. [Video]. YouTube. https://www.youtube.com/watch?v=X1R70KucERw
Jain, S. (2019, November 23). Why are Data Structures Necessary. [Video]. YouTube. https://www.youtube.com/watch?v=V5he1JXiQbg&t=2s
TutorialsPoint.com (n.d.). Learning Data Structure. Retrieved from https://www.tutorialspoint.com/data_structures_algorithms/index.htm