# Data Structures final exam review

Source: https://helio.education/finals/data-structures

[Final exam review](https://helio.education/finals)

# Data Structures final exam review

The topics, worked on a live board with an AI tutor.

[Start my review](https://helio.education/signup?next=%2Fhome%3Fcourse%3Dcs.data-structures)

## Units

1. Analysis of algorithms [Counting steps](https://helio.education/subjects/computer-science/data-structures/counting-steps) [Big-O, Big-Omega and Big-Theta](https://helio.education/subjects/computer-science/data-structures/big-o) [Analyzing loops](https://helio.education/subjects/computer-science/data-structures/analyzing-loops) [Dynamic arrays and amortized cost](https://helio.education/subjects/computer-science/data-structures/amortized-dynamic-arrays) Practice How many steps does sum_list take on a list of 6 numbers?Answer 20 Hint: 3 × 6 + 2 [Counting steps](https://helio.education/subjects/computer-science/data-structures/counting-steps) Find c and n₀ that show 2n + 10 is O(n).Answer c = 3 and n₀ = 10, since 2n + 10 ≤ 3n means n ≥ 10 Hint: Choose c = 3 and solve for n [Big-O, Big-Omega and Big-Theta](https://helio.education/subjects/computer-science/data-structures/big-o)
2. Linked lists [Singly linked lists](https://helio.education/subjects/computer-science/data-structures/singly-linked-lists) [Linked list insertion and deletion](https://helio.education/subjects/computer-science/data-structures/linked-list-operations) [Doubly linked lists and sentinels](https://helio.education/subjects/computer-science/data-structures/doubly-linked-lists) Practice Build, in the same way, the chain 2, 7 with head referring to the node holding 2. Which Node calls do you write?Answer c = Node(7), then head = Node(2, c) Hint: Start from the last node [Singly linked lists](https://helio.education/subjects/computer-science/data-structures/singly-linked-lists) Starting from 2 → 4 → 9 → None, run insert_after on the node holding 9 with x = 1. What is the list, and what is the next of the new node?Answer 2 → 4 → 9 → 1 → None; the next of the new node is None Hint: Line 3 copies the next of the node 9 [Linked list insertion and deletion](https://helio.education/subjects/computer-science/data-structures/linked-list-operations)
3. Stacks and queues [Stacks](https://helio.education/subjects/computer-science/data-structures/stacks) [Queues](https://helio.education/subjects/computer-science/data-structures/queues) [Stack applications: postfix expressions](https://helio.education/subjects/computer-science/data-structures/postfix-evaluation) Practice A stack gets push(6), push(1), push(4), then pop(), then push(5). What does peek return, and what is the whole stack from bottom to top?Answer 5; the stack is 6, 1, 5 Hint: Pop() removes the 4 [Stacks](https://helio.education/subjects/computer-science/data-structures/stacks) A queue gets enqueue(p), enqueue(q), dequeue(), enqueue(r), dequeue(). What does the second dequeue return, and what is left in the queue?Answer q; the queue holds only r Hint: p leaves first, then q [Queues](https://helio.education/subjects/computer-science/data-structures/queues)
4. Recursion What exams ask Search problems such as filling a sudoku, finding a route that visits every town or checking every way to schedule exams are solved by trying a choice, going on, and undoing it when it fails, and the same pattern also shows when a search is too big to finish. [Recursion and the call stack](https://helio.education/subjects/computer-science/data-structures/recursion-call-stack) [Recurrences and divide and conquer](https://helio.education/subjects/computer-science/data-structures/recurrences) [Backtracking](https://helio.education/subjects/computer-science/data-structures/backtracking) Practice For the list 5, 1, what does total return, how many calls are made, and how deep does the stack get?Answer 6; 3 calls; 3 frames Hint: One call for each node and one for None [Recursion and the call stack](https://helio.education/subjects/computer-science/data-structures/recursion-call-stack) The same search on a list of 32 numbers. Using the recurrence, what are T(32) and the sizes of what is left after each probe?Answer T(32) = 6; the sizes go 32, 16, 8, 4, 2, 1 Hint: Build up from T(1) = 1 by adding 1 [Recurrences and divide and conquer](https://helio.education/subjects/computer-science/data-structures/recurrences)
5. Sorting [Selection and insertion sort](https://helio.education/subjects/computer-science/data-structures/elementary-sorts) [Merge sort](https://helio.education/subjects/computer-science/data-structures/merge-sort) [Quicksort](https://helio.education/subjects/computer-science/data-structures/quicksort) [Sorting limits and counting sort](https://helio.education/subjects/computer-science/data-structures/sorting-lower-bound) Practice Selection sort on 4, 7, 1, 9, 3. What is the list after the first two passes, and how many comparisons in all?Answer 1, 3, 4, 9, 7; 10 comparisons Hint: Pass 0 swaps the 4 and the 1, and the total is 4 + 3 + 2 + 1 [Selection and insertion sort](https://helio.education/subjects/computer-science/data-structures/elementary-sorts) Merge 2, 9, 10 with 4, 5, 11, 12. What is the output, and how many comparisons were made?Answer 2, 4, 5, 9, 10, 11, 12; 5 comparisons Hint: After the 10 is taken the first list is empty, and the rest is copied [Merge sort](https://helio.education/subjects/computer-science/data-structures/merge-sort)
6. Trees [Trees and binary trees](https://helio.education/subjects/computer-science/data-structures/binary-trees) [Tree traversals](https://helio.education/subjects/computer-science/data-structures/tree-traversals) [Binary search trees: search and insert](https://helio.education/subjects/computer-science/data-structures/bst-search-insert) [Binary search trees: deletion](https://helio.education/subjects/computer-science/data-structures/bst-delete) [Balanced trees: AVL rotations](https://helio.education/subjects/computer-science/data-structures/avl-trees) Practice In the same tree, what are the depth and the height of the node 14?Answer Depth 2 and height 1 Hint: 14 is below 10, which is below 8, and 13 is one line below 14 [Trees and binary trees](https://helio.education/subjects/computer-science/data-structures/binary-trees) What is the preorder of the tree with root 6, whose left child 3 has the children 2 and 5, and whose right child is 8?Answer 6, 3, 2, 5, 8 Hint: Add 6, then do all of the subtree under 3, then 8 [Tree traversals](https://helio.education/subjects/computer-science/data-structures/tree-traversals)
7. Heaps and priority queues [Binary heaps and insertion](https://helio.education/subjects/computer-science/data-structures/heap-insert) [Removing the minimum](https://helio.education/subjects/computer-science/data-structures/heap-remove) [Building a heap and heapsort](https://helio.education/subjects/computer-science/data-structures/heapify-heapsort) Practice In the array 2, 5, 3, 8, 6, 4, 9, which indices are the children of index 1, and which index is the parent of index 6?Answer The children are at 3 and 4, holding 8 and 6, and the parent of index 6 is at 2, holding 3 Hint: 2i + 1, 2i + 2 and (i − 1)//2 [Binary heaps and insertion](https://helio.education/subjects/computer-science/data-structures/heap-insert) Pop from the min-heap 1, 3, 2, 7, 4. What does the pop return, and what is the array afterwards?Answer 1, and the array is 2, 3, 4, 7 Hint: 4 goes to the root and swaps with the smaller child, 2 [Removing the minimum](https://helio.education/subjects/computer-science/data-structures/heap-remove)
8. Hash tables What exams ask Hash tables give Python's dict and set, database indexes and caches their average constant-time lookups, and choosing a hash and a table size that spread keys evenly is what keeps them fast; computing bucket indexes by hand is a standard exam question. Separate chaining is the simplest working hash table and the model behind Java's HashMap; the load factor argument, a successful search about 1 + α/2 and a failed one about α, and doubling to keep α bounded are what exams and interviews ask when they ask why hash tables are O(1). [Hash functions and hash tables](https://helio.education/subjects/computer-science/data-structures/hash-functions) [Collisions: separate chaining](https://helio.education/subjects/computer-science/data-structures/separate-chaining) [Collisions: open addressing](https://helio.education/subjects/computer-science/data-structures/open-addressing) Practice With m = 7, place 14, 21 and 9. Which of them collide?Answer 14 % 7 = 0 and 21 % 7 = 0 collide in bucket 0; 9 goes to bucket 2 Hint: Multiples of 7 give 0 [Hash functions and hash tables](https://helio.education/subjects/computer-science/data-structures/hash-functions) Suppose the table never grew. Insert 15 and 20 into the table above. Which chain do they join, and what does a search for 20 cost?Answer Bucket 0, making the chain 25, 40, 15, 20; a search for 20 takes 4 comparisons Hint: Both are multiples of 5 [Collisions: separate chaining](https://helio.education/subjects/computer-science/data-structures/separate-chaining)
9. Graphs What exams ask BFS finds the fewest hops in an unweighted network, such as degrees of separation, the fewest moves in a puzzle or the shortest route in a grid maze, and it is the skeleton of many graph algorithms; tracing its queue is a standard exam question. DFS is the other basic graph walk; it explores mazes, finds what is reachable, splits a network into connected pieces, detects cycles such as circular dependencies, and underlies topological sort, all in O(V + E); tracing its order is a staple exam question next to BFS. [Graphs and their representations](https://helio.education/subjects/computer-science/data-structures/graph-representations) [Breadth-first search](https://helio.education/subjects/computer-science/data-structures/bfs) [Depth-first search](https://helio.education/subjects/computer-science/data-structures/dfs) [Topological sort](https://helio.education/subjects/computer-science/data-structures/topological-sort) [Shortest paths: Dijkstra's algorithm](https://helio.education/subjects/computer-science/data-structures/dijkstra) Practice A graph has degrees 1, 2, 2, 3 and 4. How many edges does it have?Answer 6, since the degrees add to 12 Hint: Halve the sum [Graphs and their representations](https://helio.education/subjects/computer-science/data-structures/graph-representations) Run BFS from F. What are the distances of E, C and A?Answer 1, 2 and 3 Hint: F's only neighbour is E [Breadth-first search](https://helio.education/subjects/computer-science/data-structures/bfs)

[The whole course](https://helio.education/subjects/computer-science/data-structures)

## Questions

### What does the Data Structures review cover?

Every unit of the course, 9 in all. Pick one and Helio teaches it on the board, then asks you questions. Analysis of algorithms; Linked lists; Stacks and queues; Recursion; Sorting; Trees; Heaps and priority queues; Hash tables; Graphs.

### Can it help the week before my final?

Yes. Pick a topic, and Helio explains it, checks you and goes over what you miss.

### Is it the same as my class?

It follows the usual topics of Data Structures. For anything else on your syllabus, type the topic and Helio teaches that too.

### How much is free?

30 minutes a month for one learner, with no card. Starter is free for 7 days with a card: cancel in time and pay nothing.

## More courses

- [Introduction to Programming in Java](https://helio.education/finals/intro-programming)
- [Introduction to Programming in Python](https://helio.education/finals/intro-python)
- [Computer Organization](https://helio.education/finals/computer-organization)

[Final exam review](https://helio.education/finals)

## A tutor you can talk to

30 minutes every month. No card.

[Start my review](https://helio.education/signup?next=%2Fhome%3Fcourse%3Dcs.data-structures)

---

# Helio at a glance

> Helio is an AI tutor you talk to, in math, science, English and history. It draws each step on a board and checks the math.

## Key facts

- 187 courses, from first sums to college math.
- What is Helio, and who is it for? An AI tutor you talk to, and it draws each step on a board. It’s for kids in school, college students and adults.
- How is Helio different from a chatbot? You talk, and it draws each step on a board. Course lessons follow a plan made ahead, and every math step is checked.
- How much is free? 30 minutes a month for one learner, with no card. Starter is free for 7 days with a card: cancel in time and pay nothing.
- Which subjects does Helio teach? Math, science, reading and writing, history and computer science. Math goes deepest, and every math step is checked.
- Which language are lessons in? English, Spanish, French, Arabic, Hindi and many more. Pick one in settings, or just speak it.
- What do I need? A phone, tablet or computer with a mic, and a quiet spot.
- How long is a session? Most lessons take 15 to 20 minutes.
- Can my child type instead of talking? Yes. They can type, or choose to write their answers on the board.
- Can Helio help with homework? Yes. Take a photo of up to ten pages, and work through the problems together.
- Does Helio just give the answer? No. It teaches the steps, then hands over the pen.
- Is Helio always right? Not always. Outside math it can be wrong, so ask why.
- Is my child's voice recorded? No. Speech becomes text, and the sound is not saved.
- What can I see as a parent? What your child knows, in plain words, and a replay of each lesson.
- How does my child sign in? With a code and secret words. Children do not need an email.
- Can a whole class use Helio? Yes. Students join a class with a code, and the teacher sees who is stuck.
- Does Helio work with Clever or ClassLink? Not yet. A class code works everywhere, and students need no email.
- The website is in English, Español, Português, Français, Deutsch, Italiano, العربية, עברית, Türkçe, Română, Русский, हिन्दी, 中文, 日本語, 한국어 and Tiếng Việt.
- Helio is made by Surf Platforms Inc. in San Jose, California. Contact: support@helio.education
- To start: make an account at https://helio.education/signup and pick a course or bring homework. Schools start at https://helio.education/schools.

## Plans

- Helio Free: $0. 30 minutes a month, for one learner.
- Helio Starter: $15 a month, or $160 a year. 2 hours a month, for one learner.
- Helio Plus: $50 a month, or $500 a year. 5 hours a month, for one learner.
- Helio Pro: $100 a month, or $1,000 a year. 10 hours a month, shared by up to 3 learners.
- Helio Ultra: $200 a month, or $2,000 a year. 20 hours a month, shared by up to 5 learners.
