DSA Tutorial
DSA stands for Data Structures and Algorithms. A data structure is a way to organise data, like a list or a tree. An algorithm is a step-by-step method to solve a problem, like sorting a list or finding the shortest route.
Knowing DSA helps you write programs that stay fast even with millions of records. It is also the main topic in coding interviews at software companies.
Why Learn DSA?
- You learn to choose the right tool for each problem
- Your programs become faster and use less memory
- Technical interviews, in Pakistan and abroad, test DSA a lot
- It improves your problem-solving skills in any language
What You Will Learn
- Big O notation: how to measure speed
- Arrays and linked lists
- Stacks and queues
- Hash tables
- Recursion
- Searching: linear and binary search
- Sorting: bubble, selection, insertion, merge and quick sort
- Trees and binary search trees
- Graphs, BFS and DFS
All examples are in Python, because it is easy to read. You should know basic Python (variables, lists, loops and functions) before you start.
A First Example
Finding the largest number is a simple algorithm: look at each item once and remember the biggest so far.
Example
def find_max(numbers):
biggest = numbers[0]
for n in numbers:
if n > biggest:
biggest = n
return biggest
print(find_max([42, 17, 88, 5, 63]))88
Exercises and Quiz
Every lesson ends with an exercise, and the last lesson is a quiz on the whole tutorial.
Exercise
What does DSA stand for?
What to Learn After DSA
After DSA, practise problems on coding challenge sites. To use these ideas in other languages, try Go, Rust or Kotlin.
Want to master Python and problem solving with a teacher? The Workownix Python Programming course covers Python and core DSA, online or at our institute in Orangi Town, Karachi.
