Guide · Algorithms · Data structures
Data Structures – Learning Guide
A data structure is the way data is stored in memory. The choice of structure determines how quickly an element is added, removed or found – which is why the same task can take a second or an hour.
The guide goes from the array, the string and the matrix, through the stack, the queue and sets, to the structures used in the national competition and SIO: the Fenwick tree and the segment tree.
- Grades 6–8 and secondary school
- C++
- Competition preparation
Some lessons linked below are available only in Serbian for now. They are marked (SR).
1 Basic structures
The array, the string, the matrix, structures and vectors – the foundation of all the others.
2 Linear structures
Elements arranged one after another, with different rules for adding and removing.
3 Sets, maps and the priority queue
Ready-made structures from the C++ library that work in O(log n).
4 Advanced structures
Structures for the national competition and SIO.
Suggested order
- Array, string and matrix – tasks
- Structures and unions
- Vectors
- Linked lists
- Stack (SR)
- Queue (SR)
- Sets and maps (SR)
- Priority queue (SR)
- Disjoint Set Union
- Fenwick tree (SR)
- Segment tree (SR)
Useful external resources
- VisuAlgo – animations of the stack, the queue, the heap, DSU, the Fenwick tree and the segment tree
- CSES Problem Set – the "Sorting and Searching" section, tasks with automatic checking
- cp-algorithms – Data Structures – detailed articles about advanced structures
