SME
College · Engineering
Data Structures & Algorithms
4 topics
Computer
Before this course
Topics
Lists, stacks and queues
Main lesson
Circular queue indices
Use this for “A circular queue has 8 slots, its front at slot 6 and 4 items. Where is the last item, and where does the next one go?”
Address of an array element
Use this for “A two-dimensional array of 8-byte numbers starts at address 2000 and has 10 columns. Where is element (3, 4)?”
Cost of a growing array
Use this for “An array starts with 1 slot and doubles when full. How many items are copied while 1000 are pushed?”
Evaluate a postfix expression
Use this for “Evaluate the postfix expression 3 4 + 2 × 7 − with a stack.”
Trees and graphs
Main lesson
Heap array indices
Use this for “A heap is stored in an array from index 0. What are the parent and children of the node at index 5?”
Adjacency matrix or list size
Use this for “An undirected graph has 1000 vertices and 5000 edges. How many cells does its adjacency matrix take, and how many entries its adjacency list?”
Preorder traversal of a search tree
Use this for “Insert 50, 30, 70, 20, 40, 60, 80 into an empty binary search tree. In what order does a preorder traversal visit the nodes?”
Sorting and searching
Main lesson
Comparisons: quadratic sorts vs merge sort
Use this for “How many comparisons does selection sort make on 1000 items, and at most how many does merge sort make?”
Hash table probes
Use this for “750 keys sit in a hash table of 1000 slots. How many probes does a search take on average?”
Merge sort pass by pass
Use this for “Show the passes of merge sort on 5 2 8 1 9 3 7 4. How many comparisons does it make?”
Big-O analysis
Main lesson
The master theorem
Use this for “Solve T(n) = 8T(n ÷ 2) + Θ(n²) with the master theorem.”
Counting nested loops
Use this for “For i from 1 to 100 and j from 1 to i − 1, how many times does the inner body run?”
Ordering growth rates
Use this for “Order n², log n, 2ⁿ, n log n, √n, n!, 1 and n from slowest to fastest growth.”
Course test
See what you know: 10 questions on this course
New questions each time. Pass to mark it complete.