Why Knowing & Understanding Data Structures & Algorithms is Important for Software Engineers

It’s a sunny Sunday afternoon. You’ve had a long, stressful day volunteering at the Community Centre and all you want to do is to grab a cold drink before heading home to nap. You find your way to your favourite store, wave enthusiastically at John who’s behind the counter and head straight to the beverage refrigerator. 

You open the refrigerator only to be met with shock: Your preferred drink is out of stock. As you head out of the store downcast, John asks why you aren’t buying anything. When you tell him, he insists that the product you’re looking for is in fact, in the refrigerator you just opened. But you did not see it. Why did you not see it? 

John informs you that a few hours earlier, his new assistant, Esther had stocked the fridge–haphazardly–which explains why you couldn’t immediately find what you were looking for. So you painstakingly scan through the products in the refrigerator again and this time, you find your drink, flanked by products with identical packaging, “hiding in plain sight”.

This illustration vividly captures the essence of Data Structures and why they are important–not just in Software Engineering but in different aspects of our lives. We’ll expatiate shortly but in the meantime:

Types of Data Structures

There are 8 commonly used Data Structures that can be classified under 2 major categories: 

A. Linear: 

1. Arrays

2. Stacks

3. Queues

4. Linked Lists

B. Non-Linear

5. Trees

6. Graphs

7. Tables

8. Sets

Data Structure Types Explained

S/NData structureDescriptionUsesWhat to know
1ArraysAn array is a collection of similar data elements stored at bordering memory locations.i. Data values displayed in a Table.
ii. Items displayed in a List.
iii. Options in a Select field
i. How to create arrays
ii. How to iterate through arrays
iii. How to find, insert & delete certain elements.
iv. How to filter & fetch a sub-array 
v. How to merge arrays
2StacksA Stack is a type of list where an element is entered to and exited from just one end.i.  Follows a particular order in which the operations are performed–this could either be Last In, First Out  or First In, Last Out. e.g: A stack of files, A folder of documentsi. How to reverse a stack
ii. How to sort a stack
iii. How to delete middle element of a stack
iv. How to sort an array using Stacks
v. How to reverse individual words
vi. How to check if an array can be sorted with stack
3QueuesQueues and Stacks are quite similar. However, unlike Stacks, with Queues, an element is entered at one side and exited at the other side. 
The process of inserting data through an end is known as enqueue while that of removing data from the other end is referred to as dequeue. 

It follows the First-In-First-Out process which means that the data item stored first will be accessed first.

A real-world example is actual queues where people/things are attended to on a “first come, first serve” basis.
i. How to creating a Queue
ii. How to insert an item to Queue
iii. How to remove an item from a Queue
iv. Size of the Queue
4Linked List A Linked List is a sequential structure with a sequence of items linked to each other in a linear order. This means data can only be accessed sequentially. i. Symbol table management in compiler design.
ii.  Switching between programs using Alt + Tab 
i. How to search or find the first element
ii. How to insert a key to the linked list.
iii. How to delete or remove an element
5TreesA Tree provides a hierarchical way of storing data. It allows for insertion, deletion and searching operations in ways that are quicker than an array or linked list. i. Search for a given key–though faster than Linked List but slower than arrays
ii. insert/delete keys in better time 
iii. provides a flexible way to hold and move data.
i. How to create a Tree
ii. How to traverse through Tree
iii. How to fetch sub tree & siblings
iv. How to add & remove an element
6GraphsA Graph consists of a limited set of vertices or nodes connected by edges or arcs where edges may be directed or undirected.i. Social Network connections
ii. Locations and Routes on a Map
iii. Web pages on the internet
i. Breadth First Search
ii. Depth First Search
iii. Graph Cycle
iv. Minimum Spanning Tree
v. Shortest Paths
7Hash TablesA hash table is a special collection used to store key-value items. This means instead of storing just one value like the stack, array list and queue, the hash table stores two values.
i. Storing different fields of values for a single Entity. E.g: Name, Address and other details 
ii.  User’s preferences.
e.g; Theme, Color, Font etc.
i. How to create an Hash Table
ii. How to insert & delete an Entry
iii. Getting Value for a Key
iv. How to check if a Key exists
8SetsSets are used to contain unique elements which may or may not be ordered.i. Adding items to a cart on a shopping site–when new items are added to a shopping cart, the quantity increasesi. How to create a Set
ii. Iterating through a Set
iii. How to get, insert & delete Elements
iv. How to merge Sets

What is an Algorithm?

An Algorithm is a step-by-step procedure that defines a set of instructions to be executed in a particular order so as to achieve desired results. Algorithms work independent of underlying languages. This means that an algorithm can be implemented in more than one programming language in order to solve a problem. Here are some commonly known categories of Algorithms:

i. Search: Used to find an item in a data structure

ii. Sort: Used to sort items in a given order

iii. Insert: Used to insert an item in a data structure

iv. Update: Used for updating an item in a data structure

v. Delete: Used for deleting an existing item in a data structure

The Relationship between Data Structures & Algorithms

Data Structures and Algorithms (DSA) are vital concepts in Software Engineering. While Data structures are used to hold data, algorithms help to solve problems using that data. 

In a chat, Olawale Quadri, a Senior Software Engineer at TalentQL (as at interview time) explains that the need for Data Structure & Algorithms (DSA) in programming cannot be overemphasized as it is “the base of every problem a developer would face.”

He posits that DSA not only helps to solve unique problems in many different ways; they equally aid logical thinking and help build better programmers. 

Why Software Engineers Must Learn to Use Data Structures & Algorithms

Perhaps the most important need for Data Structures & Algorithms is the efficiency it brings to productivity. Tasks are completed within a shorter amount of time and with even fewer resources as programmers are able to easily identify problems and choose the best approach to solving them. 

There are unarguably long term implications for developers that do not use DSA

According to Quadri, ranking top is their inability to apply for and effectively function in Senior Software Engineer roles at big corporations. Many developers are often stuck at entry and mid-level positions, unable to move up the career ladder. 

He also stresses that big tech combat much harder problems on a much larger scale and to stay above these problems, employers have to ensure that their developers possess the knowledge and skills necessary for dynamic and spontaneous problem-solving. 

Highlighted below are some other key points discussed:

  1. Remote companies require algorithms and data structure tests before hiring and onboarding technical talents: To get remote jobs with enticing salary packages, software engineers have to learn and understand the application of DSA in decision-making and problem-solving processes.  
  1. DSA is a key requirement in specific tech sectors: For software engineers working on products in sectors that deal with large amounts of data and processing (e.g Fintech), DSA is a must-have. 
  1. Knowing how DSA works also aids a better understanding of new frameworks like React, Vue, Angular, Spring etc.

The Way Forward: Learn & Practice

Quadri suggests that “the best time to learn it [Data Structures and Algorithms] is when you start. The second best time is now.” To get started, platforms like YouTube, Free Code Camp and other online learning centres have valuable resources that can be accessed for free. 

Key information sources: 

https://www.geeksforgeeks.org

​​https://www.simplilearn.com/tutorials/data-structure-tutorial

https://in.indeed.com/career-advice/finding-a-job/what-is-tree-data-structure

No Comments

Post A Comment