CS205

Guided Exercises

Learn by doing! These step-by-step exercises will guide you through implementing common algorithms and data structure operations.

Beginner

Find Maximum Element
Learn how to find the maximum element in an array by iterating through all elements.
Arrays
Beginner
4 steps~10 min

You'll learn:

  • Understand array traversal
  • Learn to track a running maximum
  • +1 more
Start Exercise
Reverse an Array
Learn how to reverse an array in-place by swapping elements from both ends.
Arrays
Beginner
4 steps~12 min

You'll learn:

  • Understand two-pointer technique
  • Learn in-place array manipulation
  • +1 more
Start Exercise
Implement ArrayList add()
Complete the add(index, element) method for ArrayList that inserts an element at a specified index.
Arrays
Beginner
3 steps~10 min

You'll learn:

  • Understand how ArrayList shifts elements on insert
  • Handle array resizing when capacity is reached
  • +1 more
Start Exercise
Implement ArrayList remove()
Complete the remove(index) method that removes and returns the element at a specified index.
Arrays
Beginner
3 steps~10 min

You'll learn:

  • Understand how ArrayList shifts elements on remove
  • Properly return the removed element
  • +1 more
Start Exercise
Implement Singly LinkedList addFirst()
Complete the addFirst() method that inserts an element at the beginning of a singly linked list.
Arrays
Beginner
3 steps~8 min

You'll learn:

  • Understand node creation
  • Learn to update head pointer
  • +1 more
Start Exercise
Implement Singly LinkedList removeFirst()
Complete the removeFirst() method that removes and returns the first element.
Arrays
Beginner
3 steps~8 min

You'll learn:

  • Handle empty list case
  • Update head pointer correctly
  • +1 more
Start Exercise

Intermediate

Implement Bubble Sort
Learn the bubble sort algorithm step by step. Bubble sort repeatedly compares adjacent elements and swaps them if they are in the wrong order.
Sorting
Intermediate
5 steps~15 min

You'll learn:

  • Understand the bubble sort algorithm
  • Learn nested loop patterns
  • +2 more
Start Exercise
Implement ArrayList ensureCapacity()
Complete the ensureCapacity() method that doubles the array size when more space is needed.
Arrays
Intermediate
2 steps~8 min

You'll learn:

  • Understand dynamic array resizing
  • Learn the doubling strategy
  • +1 more
Start Exercise
Implement Doubly LinkedList addLast()
Complete the addLast() method for a doubly linked list, handling both prev and next pointers.
Arrays
Intermediate
3 steps~10 min

You'll learn:

  • Understand doubly-linked node structure
  • Update both prev and next pointers
  • +1 more
Start Exercise
Implement Doubly LinkedList remove()
Complete the remove(index) method for a doubly linked list, updating both prev and next pointers.
Arrays
Intermediate
3 steps~12 min

You'll learn:

  • Traverse to find the node to remove
  • Update pointers on both sides
  • +1 more
Start Exercise

How Guided Exercises Work

1Read the instruction

Each step has a clear explanation of what to do next.

2Write the code

Fill in the blanks in the code editor. Use hints if you get stuck.

3Check and learn

Submit your answer to get instant feedback and explanations.