
Explore what a data structure is as a class with data and methods, why we need them beyond built-in types, and the time and memory tradeoffs involved.
From Algorithms course, but the same perspective.
From the algorithms course. Some problems in this course maybe from LeetCode
From the algorithms course. Some problems in this course maybe from LeetCode
From my C++ course
Analyze how a fixed array becomes dynamic through the append operation by creating a larger memory, copying old data, and resizing, then assess why this yields quadratic performance.
Explore the capacity trick and root cause analysis to optimize array appends with size and capacity, doubling capacity for amortized linear performance.
Explore the insertion operation in a dynamic array, using capacity expansion and rightward shifting to insert at an index, and analyze its linear worst-case complexity.
Understand abstract data types (ADT) and the what versus how distinction, exploring interfaces like lists and dictionaries and how implementations vary while preserving behavior.
Learn to implement python-like array operations with negative indexing, right rotations, and efficient pops. Explore 2d matrices with set/get, and apply a move-to-front index optimization.
Master python array operations through negative indexing, left and right rotations, and modulus optimization, then implement pop position, index transposition, and a dynamic 2d array.
Discover how to judge algorithm efficiency using asymptotic complexity. Focus on time and memory, large n, and dropping constants to identify O(n), O(n^2), and O(1).
Master practical techniques to determine time complexity by ignoring constants, analyzing for loops and nested blocks, and combining orders like O(1), O(n), O(n^2), O(nm) for polynomial time.
Demystify Big O notation by treating constants as upper-bounding factors, introduce n0, and compare O(n) and O(n^2) with practical examples of constants affecting run time.
Explore worst-case, best-case, average-case, and amortized analyses, O() upper bounds, and how these concepts apply to Python data structures like lists, sets, dicts, and hash tables.
Explore memory complexity by estimating the maximum memory used at any moment. Compare constant, linear, and quadratic memory and consider recursion's auxiliary space on the stack.
Explore how linked lists solve dynamic memory challenges by using nodes connected via next pointers. Learn to create and traverse nodes, understand null, and inspect memory addresses (ids) during debugging.
Learn to print a linked list by iterating from head to tail, printing node data, and implement a recursive version plus a find function to locate a node by value.
Learn to build a singly linked list with head and tail, implement insert_end in O(1), handle empty vs non-empty cases, and print and iterate the list safely.
Learn to traverse linked lists and implement core operations: get the nth node with 1-based indexing, return None if not found, and perform a 0-based index search with swapping.
Build a debugging framework for linked lists by sketching test cases (zero, one, two, even or odd sizes) and applying unit testing, then write modular code to prevent runtime errors.
Learn how to maintain data integrity in a linked list by managing head, tail, and length, then implement a verification helper and tests to catch errors with debugging best practices.
Master singly linked lists through homework one by implementing insert_front and delete_front, getting the nth node from back, and verifying identity with list comparison, while testing without a length field.
Explore solutions for a singly linked list homework: insert front, delete front, get nth from back, and list comparison, emphasizing head and tail and edge cases.
Master linked list deletion in Python by removing the front, last, or nth node, or a node with a specific value, using get_nth and ADT concepts, with edge-case handling.
Clarify physical data structures as block or scattered memory in arrays and lists, and logical data structures like queues, noting O(1) array access and O(n) linked-list access.
practice solving five linked list challenges in python, including delete by key, pairwise swap, constant-time reversal, remove even positions, and sorted insert.
Learn to delete an element with a specific key in a linked list by iterating with previous and current, handling head and tail, and using a delete_next_node helper.
Reverse every pair of consecutive values in a linked list by swapping them. Reverse the nodes themselves using previous and current pointers, updating the head and tail as needed.
Delete every even position in a linked list using previous and current pointers with delete_next_node, then insert values into a sorted list via insertion sort and embed_after.
Execute SLL homework tasks: swap head and tail by addresses, rotate left by k, remove duplicates, delete last key occurrence, and move key-matching nodes to the end using nodes only.
swap the head and tail in a singly linked list, handle edge cases, and perform left rotation by n with cycle creation and breaking, using k %= length.
Remove duplicates in an unsorted linked list using a nested-loop approach. Explain hashing to achieve linear time with memory and describe moving nodes to the end with a move_to_the_end helper.
Solve linked list challenges in python: reorder odd and even nodes. Perform zig-zag insertions, add numbers from lists, remove duplicates, and apply k-group reversals.
Learn how to rearrange a linked list by splitting into odd and even positions, then merge by linking the last odd to the first even, handling odd and even lengths.
Develop an alternating merge of two linked lists using a utility insert_after, which inserts nodes from the second list after nodes from the first, updating tails when one list ends.
Add two numbers represented by linked lists by iterating through both lists, using modulus and division to obtain digits and carry, and appending new nodes as needed.
Remove duplicates from a linked list by traversing with previous and current, either keeping the first occurrence or removing all duplicates, using the dummy node trick and achieving O(1) memory.
Solve the last problem by reversing a linked list in groups of size k in Python, extending the standard reverse with an inner helper returning head, tail, and next head.
Explore how a doubly linked list adds a previous pointer to the singly linked list, enabling bidirectional navigation and O(1) backward access, with head, tail, length, and memory trade-offs.
Learn how to insert into a doubly linked list with a link function that connects next and previous pointers, handles none, and enables reuse insert_end, insert_from_front, and insert_sorted with embed_after.
Delete operations in a doubly-linked list enable end deletions in O(1) by updating head and tail. Learn delete_next_node, delete_link_node, and delete_node_with_key.
Practice three doubly linked list operations: delete all nodes with a specific key; delete nodes at even or odd positions; and implement a palindrome check that returns true.
Use a dummy node and delete_link to remove all nodes with a key in a linked list, then delete even or odd positions, and optionally check palindrome with length.
Master five linked-list problems in Python: find the middle node with single pass, implement doubly and singly variants, swap kth nodes by address, reverse, and merge sorted lists in O(n+m).
Learn two methods to find the middle of a linked list: move head and tail toward each other, or apply the tortoise and hare slow and fast pointers approach.
Swap the kth node from the front with the kth from the back in a doubly linked list, re-linking pointers and handling same node, adjacent nodes, and head-tail cases.
Reverse a doubly linked list by moving left to right, swapping two nodes, using copies of the next two nodes to guide linking, and swapping the head and tail.
Merge two sorted linked lists as in merge sort by repeatedly selecting the smaller head from each list. Append the remaining nodes to complete the merge.
Develop a doubly linked list based sparse array that stores only non-empty elements, with set_value, get_value, and print and add operations, enabling polynomial representations.
Implement a sparse array in Python using index and data nodes and a dummy head; use get_node for on-demand creation, then add two linked lists and note quadratic time complexity.
Learn how to implement a sparse matrix as a linked-list of row lists, storing only nonzero values, with zero-based indices, printable as a 2d array, and supporting addition.
Explore building a sparse matrix with a composition-based approach, using a sparse array of rows and inner linked lists to support set, get, and print operations.
From the C++ course. Minor changes maybe for Python
Implement an array-based stack in Python by treating the end of a list as the top, enabling push, pop, and peek with O(1) operations, and discuss simple size checks.
practice with stacks across four problems: reverse digits with a stack, validate parentheses, remove adjacent duplicates in a string, and simulate asteroid collisions, all via leetcode style templates.
Solve reversing an integer with a stack using mod and division, then validate parentheses with a stack and a dictionary mapping closings to openings.
Explore stack-based solutions to cancel adjacent matches in a string and solve the asteroid collision problem using a while loop, illustrating Python implementation and interview warm-ups.
Explore advanced stack-based solutions in Python by simulating recursion with a custom stack, solving complex parentheses scoring problems, and implementing next greater element in linear time.
Learn to implement stack-based recursion in Python by simulating calls with a stack entry, handling base cases, return types, and integrating results.
Use a stack to compute nested parentheses scores by pairing each closed expression with its parent, yielding 1 for empty and doubling for inner values.
Master the daily temperatures problem by applying reverse thinking with a stack. Use a simplification technique to match past days and compute days to wait in linear time.
Learn to implement a stack using a linked list, with push, pop, peek, and empty checks, and compare it to array-based stacks while noting the head as the top.
Explore infix, postfix, and prefix notation, clarify precedence and associativity, and learn how postfix evaluation with a stack simplifies computing expressions.
Convert infix expressions to postfix using a stack-based algorithm with precedence rules, handling single-digit operands and operators + - * /, left-to-right associativity, and final stack flush, with O(n) time.
Explore a stack-based infix to postfix converter that uses operator precedence and single-digit input to produce a postfix expression, emphasizing linear time complexity and the role of parentheses.
Learn to convert infix expressions to postfix with parentheses using a stack, handle sub-problems, precedence, associativity, and token parsing.
Master data structures in python through stack homework, extending expressions to include digits, letters (lower and upper), operators, and parentheses, and mastering postfix evaluation and infix to postfix.
adjust letter acceptance to include lower and upper cases, and address the power operator with right-to-left associativity, ensuring correct equality handling and avoiding premature pops; then evaluate postfix.
Master stack-based postfix evaluation by applying an operator to the last two numbers in the correct order. Avoid reversed operands that yield incorrect results.
Tackle three data-structures challenges in Python: a stack that deletes the middle in O(1), infix-to-prefix conversion via reversal and parentheses handling, and removing brackets from single-digit plus and minus expressions.
Compare stack implementations: a doubly-linked list yields O(1) middle removal and middle pointer moves, while an array requires shifting O(n); highlight trade-offs in access and clear operations for design decisions.
Reverse the input, swap parentheses, apply infix-to-postfix, then reverse the postfix to obtain prefix; adjust associativity by treating + and - as right-associative and ^ as left-to-right.
Learn a stack-based approach to evaluating signs in expressions with parentheses by maintaining an active sign per block and combining signs; the problem focuses on stack logic, not infix/prefix/postfix.
Explore the queue data structure and its FIFO ordering, with enqueue at the rear and dequeue from the front, cover is empty and is full checks, and preview circle queue.
Explore implementing a circular queue with a circular array, using front, rear, and the added elements variable to distinguish empty from full, enabling simple enqueue and dequeue.
Master circular queue coding in Python with a fixed-size array, front and rear indices, and added_elements to manage empty and full states, plus enqueue, dequeue, and display operations.
Implement a linked-list-based queue by keeping a head and tail to enqueue at the rear and dequeue from the front, FIFO semantics, while embracing aggregation and designing for future requirements.
Implement the dequeue in a double-ended queue with enqueue at the front and dequeue at the rear, preserving O(1) operations and illustrating a stack built from a linked list queue.
Implement a queue using two internal stacks to keep dequeue at O(1), and design a priority queue with priorities 1–3 using a linked list, ensuring O(1) enqueue and dequeue.
Learn to implement a queue with two stacks achieving amortized O(1) enqueue, remove the added_elements indicator in a circular queue, and build a LastKNumberSumStream with O(k) memory.
Explore nonlinear data structures with trees, from root and leaves to height, depth, and subtrees, and compare binary trees, tries, and AVL trees, with linked lists as special cases.
Discover the binary tree node structure with left and right pointers, link a root to two children, and implement recursive printing of subtrees using a print(node) function.
Explore binary tree traversal strategies by implementing a non-recursive print function and mastering inorder, preorder, and postorder patterns on expression trees, linking to infix, postfix, and prefix forms.
Implement and verify post-order traversal for binary trees in Python using recursion, printing left subtree, right subtree, and the node, while tracing the what of expressions rather than the how.
Explore detailed recursive tracing of binary tree traversals, including in-order, pre-order, and post-order, with left and right subtree printing and visual techniques.
Discover binary tree types including full binary trees, internal and leaf nodes, perfect and complete trees, degenerate and balanced trees, and the k-ary generalization, with height-focused formulas.
Explore how perfect binary trees yield node counts of 2^levels minus 1 and how height derives from n using log2(n+1) minus 1, plus balanced trees and Catalan numbers.
Create and enrich a binary tree class with a root, provide an inorder print method, and build the tree by adding path based node sequences using value and direction lists.
Master binary tree problems in python with practical tasks like tree_max, maxDepth, and summing left leaves. Also explore cousins, perfect trees, and recursive versus formula-based solutions.
Explore solving tree problems in Python, including tree maximum, maximum depth, sum of left leaves, and cousins, using recursion and divide-and-conquer; compare recursive height with a formula for perfect trees.
Implement non recursive inorder traversal with a stack, explore the left boundary and diameter of binary trees, and build and print a postfix-derived expression tree with proper parentheses.
Rewrite the inorder traversal iteratively by converting a recursive approach to an iterative one using a stack, handling left and right processing order and a completion flag.
Describe printing a binary tree's left boundary by recursively following the left child, discarding non-boundary right nodes, and promoting right children when left is absent to form the boundary chain.
Explore the diameter of a binary tree by analyzing whether the longest path passes through a node or resides in a subtree, using height calculations to update a global diameter.
Learn to build an expression tree from postfix expressions using a stack, assigning left and right operands to operators, and print a correctly parenthesized infix expression.
Explore tree traversals by implementing a print function for a two-level expression tree, demonstrating in-order, post-order, and preorder outputs, including postfix, prefix, and infix concepts.
Use collections.deque to implement level order traversal and process by level using the queue size. Compare time and memory: O(n) time, O(n) memory in worst case.
Practice recursive level order traversal and analyze time complexity, implement zigzag traversal with even levels reversed without reversing, and determine binary tree completeness by enforcing left-before-right node ordering.
Compute the tree height and print nodes at each level with a recursive function, showcasing a slow, level-by-level traversal and its use for limited-depth searches.
Conduct a level order traversal that alternates forward and backward processing on each tree level using a deque, leveraging mirroring and symmetry to simplify implementation.
Determine whether a binary tree is complete using a level-order traversal rule: after a missing node, no further nodes may appear, with a simple left-before-right check.
Reconstruct a binary tree from inorder and preorder by locating the root and dividing left and right subtrees; preorder with postorder or level order alone may fail.
Implements a recursive solution to build a binary tree from preorder and inorder with unique values, returning a deque of [value, is_leaf] for each node, under full binary tree constraints.
Reconstruct a binary tree from preorder and inorder traversals, building left and right subtrees recursively; discuss an improvement, then build a full binary tree from preorder with leaf indicators.
Master binary tree serialization by using preorder with -1 markers to denote nulls, creating a full binary tree representation that simplifies saving, loading, and canonical comparison of structures.
Master the art of analyzing binary trees by checking symmetry with recursive and parenthesizing approaches, performing full-subtree flips to transform structures, and identifying and printing duplicate subtrees.
Build a symmetric tree by checking left and right subtrees for mirror images with a classical recursive approach, and verify mirroring using a reversed parentheses representation.
Learn to solve subtree comparison problems with a canonical parentheses representation, testing equality, mirror relations, and finding duplicate subtrees via recursive dfs and a counting dictionary.
Understand how the binary search tree uses left values smaller and right values larger, producing a sorted inorder traversal and efficient search, especially when the tree is balanced.
Insert values into a binary search tree using a recursive insert function, guiding traversal left or right until the proper spot is found, ignoring equal values.
Tackle BST problems in Python: implement iterative search, validate a BST without duplicates, build a height-balanced tree from a sorted array, and efficiently find the kth smallest element and LCA.
Transform binary search tree homework by implementing an iterative search with a while loop and validate BSTs through inorder sorting and a recursive min-max range approach.
Convert a sorted array into a balanced binary search tree by choosing the middle element as root and recursively building left and right subtrees; avoid slicing to achieve O(n) time.
Find the kth smallest element in a binary search tree using a selective inorder traversal that stops early. Decrement k as you visit nodes and return when k equals 1.
Compute the LCA in a binary search tree by starting at the root and moving left when both lie left, right when both lie right, otherwise return the root.
Find the minimum by going left until no left child; determine the successor in O(h) by either the right subtree’s minimum or ascending from right parents.
Explore how in-order traversal defines the BST successor, using the right-subtree minimum or climbing via ancestors to locate the next node, with or without a parent pointer.
Explore implementing the BST successor using an ancestors path and handling root, right subtree, and edge cases. Identify the maximum and predecessor, and emphasize testing with scenarios before coding.
Enhance binary search trees with parent links and efficient insertion and successor logic. Build value–successor pairs from sorted deques and test degenerate preorder binary search trees.
Mastering skills in data structures using Python shows how to add a parent to a data structure, initialize and link nodes during insertion, and use parent pointers to find successors.
Rewrite the inorder traversal to answer successor queries in a binary search tree, using a deque and early stopping after target is seen, so the next value is the successor.
Verify pre-order represents a degenerate tree by maintaining a min-max range for each node in a binary search tree. Update the range when moving left or right; violations invalidate chain.
Build a binary search tree from pre-order using lists or deques, explore O(n) methods, and verify by comparing pre-order; also construct from level-order traversal.
Build a binary search tree from preorder by locating the first value greater than the root to split left and right, and apply min-max bounds for efficient level-order tree construction.
Learn how to delete a node from a binary search tree, handling leaf, single-child, and two-children cases, using successor or predecessor replacement and maintaining binary search tree properties.
Master BST deletion in Python by implementing search, handling leaf and single-child cases, and deleting two-child nodes via right-subtree minimum replacement and re-linking.
Address binary search tree homework in Python by using the predecessor inside the successor, and convert the successor deletion from recursion to iteration while analyzing successor node states.
Master the bst homework by using the predecessor (maximum from the left) to replace and delete in a two-child case, avoiding recursion with an iterative approach.
Almost all other courses focus on knowledge. In this course, we focus on gaining real skills.
Overall:
The course covers basic to advanced data structures
Learn the inner details of the data structures and their time & memory complexity analysis
Learn how to code line-by-line
Source code and Slides and provided for all content
An extensive amount of practice to master the taught data structures (where most other content fails!)
Content:
Asymptotic Complexity
Arrays
Singly Linked List
Doubly Linked List
Project: Sparse Array and Matrix
Stack
Queue
Binary Tree
Binary Search Tree
Binary Heap
AVL Tree
Letter Tree (Trie)
Hash Table
Extensive Homework sets with video solutions
Teaching Style:
Instead of long theory then coding style, we follow a unique style
I parallelize the concepts with the codes as much as possible
Go Concrete as possible
Use Clear Visualization
By the end of the journey
Solid understanding of Data Structures topics in Python
Mastering different skills
Analytical and Problem-Solving skills
Clean coding for data structures
Black-box applying on DS
With the administered problem-solving skills
You can start competitive programming smoothly [DS type]
Smooth start in Algorithms course
One more step toward interviews preparation
Prerequisites
Strong Programming Skills:
Built-in Data Structures: list, tuple, set, dictionary
Comfortable with recursive functions
Basic Programming Problem-Solving Skills
That is; solved a lot on the basic topics
Use IDE Debugger
Preferred:
Project Building Skills
Don't miss such a unique learning experience!
Acknowledgement: “I’d like to extend my gratitude towards Robert Bogan for his help with proofreading the slides for this course”