Data Structures & Algorithms Basics
Part of the Data Science Roadmap
In short
Data science rounds are lighter on DSA than software ones, but bigger companies still ask the basics. Knowing when a dict beats a list, and why, covers a surprising number of questions.
Lighter-weight than a pure software engineering interview, but basic comfort with arrays, hashmaps, and time complexity is often still expected, especially at larger tech companies.

Think of it like this
The hostel lockers
Finding your friend's bag by opening every locker in the hostel takes ages. If every locker has a room number on it, you walk straight to the right one. That's a list search versus a hashmap lookup, and most DSA basics come down to that choice.
Watch it happen
Two-sum with a hashmap, target 15
1/5Find two numbers that add up to 15. We walk once and remember what we've seen in a dict.
The big ideas
What you need to know
Big-O intuition
O(n) means one pass. O(n²) means comparing every pair, painful once data grows.
Dicts and sets for lookup
Checking 'is x in here?' is O(1) on average for a set, O(n) for a list.
Sort plus two pointers
Sorted data lets two pointers move inwards to find pairs or remove duplicates quickly.
Edge cases count
Empty input, duplicates, negatives and ties. Mention them before the interviewer does.
See it in code
Walk through the code
1def two_sum(nums, target):2 seen = {} # value -> index3 for i, x in enumerate(nums):4 need = target - x5 if need in seen:6 return seen[need], i7 seen[x] = i8 return None9 10print(two_sum([3, 8, 1, 9, 6, 4], 15)) # (3, 4)1/4The dict remembers each value we've passed and where it was.
The classic two-sum. One pass and a dictionary turn an O(n²) double loop into O(n).
Save yourself the pain
Common mistakes
Oops
Writing a double loop and never mentioning its cost.
Do this instead
It's fine to start with brute force, but say it's O(n²) and then improve it.
Oops
Ignoring edge cases like an empty list or no valid answer.
Do this instead
Ask about them up front and handle them, even with a simple return None.
Your mission
Three easy classics
Quick check
You check 'x in data' a million times. Why use a set instead of a list?
Go deeper
- 1Review basic data structures (arrays, hashmaps, sets) and their typical time complexities.
- 2Practice a handful of easy-to-medium coding problems on a standard practice platform.
- 3Learn to state a solution's time complexity out loud as part of your answer.
More coding & sql at this stop
Stuck on this topic? Ask an Insider
Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.