DSA Tutorial - 2025
DSA Tutorial - 2025
and Algorithm
Kibret Zewdu
Department of Computer Science
College of Informatics
University of Gondar
Arrays & Strings
• Stores data elements based on sequential, most commonly 0 based, index.
• Time Complexity
• Indexing: Linear array: O(1), Dynamic array: O(1)
• Search: Linear array: O(n), Dynamic array: O(n)
• Traverse: O(n)
• Among these data structures, heap data structure provides an efficient implementation of priority
queues.
• Heap data structure is a complete binary tree that satisfies the heap property, where any given
node is
• always greater than its child node/s and the key of the root node is the largest among all other
nodes. This property is also called max heap property.
• always smaller than the child node/s and the key of the root node is the smallest among all
other nodes. This property is also called min heap property.
Adjacency Matrix
• If there is an edge between two nodes, the corresponding cell contains a 1 (or the weight
of the edge in weighted graphs).
3. Edge List
4. Shell Sort
• An optimized version of insertion sort that compares elements at varying gaps.
• Time Complexity: O(n log n) (depends on gap sequence).
• Best for: Medium-sized datasets.
3. When retrieving data, the same hash function is used to find the index instantly.