Week 1 Practice
After reading this week's notes and engaging in the embedded activities and reflections, you should be able to:
- Define data structures and algorithms through concrete examples
- Given the
headof a linked list, implement basic operations like- Insertion (front, at position)
- Deletion (by value, by position)
- Traversal (print all elements, see if exists, count elements, find and return)
- Implement a dynamic array (array list) that resizes as needed
- Compare and contrast the benefits and drawbacks of using arrays vs. linked lists for different use cases
- Explain the concepts of encapsulation and abstraction in object-oriented programming
- Use Java's syntax to declare and implement interfaces
Please refer to this week's readings to review these concepts and skills.
In the following pages, you'll find additional practice problems to reinforce your understanding and hone your skills.
Practice Problems Overview
This week's practice includes 6 coding problems that build on the concepts above:
- Remove Duplicates from Sorted Array - Array manipulation with two pointers
- Reverse String - In-place string reversal using two pointers
- Two Sum (Special Case) - Finding pairs in sorted arrays with two pointers
- Reverse Linked List - Pointer manipulation in linked structures
- Linked List Cycle Detection - Detecting cycles using two-pointer technique
- Kth to Last Element - Finding relative positions in linked lists
Key Pattern: Most of these problems use the two-pointer technique - a fundamental algorithmic pattern where you use two pointers moving through data structures at different speeds or positions. This technique is especially powerful for array and linked list problems.