Should DevOps Engineers Learn DSA? (Truth No One Tells You)
Should a DevOps Engineer Learn Data Structures and Algorithms?
Simple Answer: Yes.
As a DevOps engineer, many people think Data Structures and Algorithms (DSA) are only for software developers. But from my experience, DSA is very important for DevOps as well.
When you understand data structures and algorithms:
- You write better scripts.
- You design cleaner CI/CD pipelines.
- You automate tasks more efficiently.
- You troubleshoot problems with better logic.
- You perform better in technical interviews (especially in MNCs).
Real-Time Example (Interview Scenario)
Let’s say you apply to a multinational company (MNC).
Usually, interviews have multiple rounds:
- First Round: Introduction and background discussion.
- Second Round: Basic technical round.
- Task Round: You may get tasks where:
- You store values
- Manipulate data
- Write logic
- Solve small problems
Most of these tasks require understanding of data structures and basic algorithms.
If your fundamentals are strong, you easily clear these rounds.
That’s why DSA is basic but powerful knowledge.

Types of Data Structures
Data structures are mainly divided into two types:
- Primitive
- Non-Primitive
1️⃣ Primitive Data Structures
Primitive means basic or primary data types that store single values.
Example:
a = 2Here:
ais a variable- It holds the value
2 - Its type is
int
Common primitive data types in Python:
intfloatstrbool
These are basic building blocks.
2️⃣ Non-Primitive Data Structures
Non-primitive data structures can store multiple values.
They are divided into:
- Linear
- Non-Linear
Linear Data Structures
In linear data structures, data is stored in sequence (like a line).
Types of Linear Data Structures:
- List
- Tuple
- Set
- Dictionary
Let’s understand List, because it is very important in DevOps scripting.
Python List
Python is one of the easiest and most powerful languages for DevOps automation.
How to Create a List?
Method 1:
Create a file: list_ex.py
list_of_names = list()
print(type(list_of_names))Output:
<class 'list'>Run the file:
python list_ex.pyMethod 2:
list_of_envs = []Both methods create a list.
⚠ Important: Not everything inside [] is automatically valid — it must be proper Python syntax.
Difference Between List and Array
- Array → Stores similar type of data.
- List (Python) → Can store different types of data.
Example of array-like data:
list_of_envs = ["dev", "stg", "prd"]Example of list with mixed types:
list_of_envs = ["dev", "stg", "prd", True, 3.5]What is Indexing?
Indexing means accessing values by their position.
Example:
list_of_envs = ["dev", "stg", "prd", True, 3.5]Index starts from 0
ValueIndexdev0stg1prd2
If you run:
print(list_of_envs[0])Output:
devIf you try:
print(list_of_envs[20])You will get an error:
IndexError: list index out of rangeBecause the list has limited positions.
Using Loop with List (Real DevOps Example)
Let’s say we want to deploy code to multiple environments.
list_of_envs = ["dev", "stg", "prd", "tst", "qa"]for env in list_of_envs:
print("Deploying to", env)
Output:
Deploying to dev
Deploying to stg
Deploying to prd
Deploying to tst
Deploying to qaNow suppose we want to add another environment:
list_of_envs.append("client")append() adds value at the end of the list.
This is how DevOps engineers automate deployments across environments.
Useful List Functions
You can explore list functions using:
print(dir(list_of_envs))This shows all available methods of a list.
To read documentation of any method:
print(list_of_envs.reverse.__doc__)This prints documentation of the reverse() function.
Insert at Specific Index
list_of_envs.insert(1, "testing")This will insert "testing" at index 1.
Learning Python from Python
You can even explore primitive types.
Example:
a = 2
print(dir(a))To read documentation:
print(a.denominator.__doc__)Python gives built-in documentation. This is a very powerful way to learn.
Non-Linear Data Structures (Brief Introduction)
Non-linear data structures do not store data in sequence.
Examples:
- Linked List
- Tree
- Graph
These are more advanced and commonly used in backend systems, networking, and complex applications.
Final Thoughts
As a DevOps engineer, do not ignore Data Structures and Algorithms.
Even if you are:
- Writing CI/CD pipelines
- Automating infrastructure
- Managing cloud systems
- Writing Python or Bash scripts
Strong fundamentals make you a better engineer.
Stay calm. Stay consistent.
Python is easy — just practice daily.
If you found this blog helpful, share it and stay connected with me.
— Raees Yaqoob Qazi
DevOps Engineer 🚀
🌐 Online References
- LinkedIn: https://www.linkedin.com/in/raees-yaqoob-qazi-ryqs/
- Medium Blog: https://medium.com/@raeesyaqubqazi
- Blogspot: https://brillertechnologies.blogspot.com/
- Facebook Page: https://web.facebook.com/profile.php?id=61553548371216
- YouTube Channel: https://www.youtube.com/@RaeesQ.
- TikTok: https://www.tiktok.com/@mrryqs?_t=ZS-8y7t0fQfJKu&_r=1
Comments
Post a Comment