DSA Additional Study
DSA Additional Study
1. Basic Operations:
o Access, append, insert, and modify elements.
o Deletion (pop) from the end.
o Checking for membership (in) and length.
2. Complexity Awareness: Understanding O(1) for append and access, O(n) for
insertions not at the end, and O(n) for checking membership.
1. Two-Pointer Technique:
o Useful for problems like finding pairs, reverse in place, and removing
duplicates from sorted arrays.
2. Sliding Window Technique:
o Useful for subarray and substring problems, especially when dealing with
constraints on the sum, maximum, or minimum values.
3. Kadane’s Algorithm:
o Efficient way to find the maximum sum subarray in linear time.
4. Dynamic Array Resizing:
o Understanding underlying memory implications of array resizing (Python’s
list is dynamically resized in the background).
1. String Slicing:
o Understanding and efficiently using slicing (s[start:end:step]), which is
helpful for substring operations.
2. String Reversal:
o Simple technique using slicing (s[::-1]) or loops for in-place reversal in
mutable string scenarios (e.g., lists of characters).
3. String Comparison and Case Conversion:
o Using .lower(), .upper(), .strip(), etc., for handling case sensitivity and
trimming whitespace.
4. Basic String Manipulation:
o Splitting (split), joining (join), replacing (replace), and searching
substrings (find and index).
1. Palindrome Checking:
o Using two-pointer technique for palindrome checks.
2. Anagram Check:
o Sorting or using hash maps (like Counter in Python) to verify if two strings
are anagrams.
3. Substrings and Subarrays:
o Techniques for finding all substrings, subarrays, and applying sliding windows
for specific conditions (e.g., longest substring without repeating characters).
4. Tries (Prefix Trees):
o While more advanced, tries are useful for efficiently handling prefix-based
string problems.
Array Problems:
o Find the missing number, duplicates, or unique element in an array.
o Implement matrix operations or transformations (transpose, rotate).
o Find the k-largest/smallest element.
String Problems:
o Longest common prefix, suffix, or substring.
o Count occurrences of each character in a string.
o Convert between camelCase and snake_case.
LINKED LISTS:
Core Topics (Covered)
1. Node Class Creation: Both singly and doubly nodes, with val, next, and prev
pointers.
2. Basic Operations on Singly Linked List:
o Insertion at head and end.
o Traversal and display.
o Searching for a value.
3. Basic Operations on Doubly Linked List:
o Insertion at head and end.
o Display with bidirectional arrows for easy visualization.
4. Complexity Analysis: Basic understanding of O(n) traversal and O(1) insertion at
the head or tail.
1. Insertion at Specific Position: Inserting a node at any position in both singly and
doubly linked lists.
2. Deletion:
o Deleting a node by value or position in singly and doubly linked lists.
o Handling edge cases, like deleting the head or tail node.
3. Reversal:
o Reversing a singly linked list (changing the direction of next pointers).
o Reversing a doubly linked list (swap next and prev pointers).
4. Cycle Detection: Using Floyd’s Tortoise and Hare algorithm to detect cycles in a
linked list.
5. Length Calculation: Writing a function to find the length of a linked list.
6. Middle of Linked List: Using the slow and fast pointer technique to find the middle
node.
7. Merging Sorted Linked Lists: Merging two sorted linked lists into one sorted list
(important for understanding recursion and merging techniques).
8. Intersection of Linked Lists: Finding the intersection node between two linked lists
if they merge at some point.
9. Linked List with a Random Pointer: Creating a linked list where each node also has
a random pointer pointing to any other node, including itself (a bit advanced but
common in interviews).
Flattening a Linked List: Working with a linked list that has child pointers and
flattening it into a single-level list.
Implementing LRU Cache with Doubly Linked List: Often asked to demonstrate
understanding of linked lists combined with hash maps.
Memory Optimization: Explaining when a singly vs. doubly linked list might be a
better choice for memory efficiency.
Covering these additional topics will give you a well-rounded grasp of linked lists and
prepare you for a range of interview questions. Let me know if you'd like examples for any of
these!
HASH TABLES