|
Main, Syllabus, Office hours |
Schedule |
Slides |
Daily |
Homework |
Code |
Exams |
CSE 3318 - Resources: slides, code, references
Slides
- Useful materials and links:
-
High-level course overview and goals
- Linked lists intro(pdf, pptx)
Before this lecture, students are expected to have seen and implemented some functions for linked lists and have a strong understanding of pointers in C.
Linked Lists in C REVIEW - review of code relevant to Linked lists, steps for solving problems with loops (for linked lists), representation of memory (static and dynamic) for linked lists (pptx)
Here is a video (with subtitles) explaining pointers. link
I like the Stanford CS Education Library:
- Time Complexity
- Prerequisites (to review): code (executions of for loops, behavior of function calls), math (log, exponent, summations)
- Informal time complexity and motivation, insertion sort code
- Time complexity notes used in videos for:
- loops (pdf)
- worst, best, average cases (pdf , OneNote )
- Time complexity of loops 2024 slides (pptx )
- PRACTICE time complexity of loops
- Discussion of add operation for ArrayList in Java
(Here is some optional material, not required for class: slides on detailed instruction count: pptx, pdf ; and slides on exact calculation of the number of loop repetitions: pdf, pptx)
- Growth of functions - CLRS chapter 3 (all).
-
Examples of Algorithms (pdf
, pptx) - CLRS Chapters 1 and 2, - Sorting (properties, abstraction, selection sort, insertion sort, indirect sorting), searching.
If time permits, most likely not, interpolated search and proof of correctness of insertion sort.
-
Count sort, Bucket sort, Radix sort (the LSD method) ( pptx) - CLRS chapter 8. s
(more on radix sort- not required)
-
Merge sort - CLRS - Section 2.3 (Designing Algorithms).
- Master Theorem only
Recurrences - Solving recurrence formulas (pptx) - These slides have BOTH the Tree Method and the Master Theorem method.
Master Theorem on Wikipedia: https://en.wikipedia.org/wiki/Master_theorem_(analysis_of_algorithms)
( The substitution method for recurrences is posted here . )
Recursion (pdf, pptx) - EXTRA topic (if time permits)
Students are expected to be able to write a recursive definition for a simple function like the factorial (N!).
- Quick sort (it includes the median-of-three example)
- Stacks (pdf, pptx )
- Amortized TC, resizing array TC, and add() operation for ArrayList in Java ( The old version of this document is here)
- FIFO Queues (pdf,pptx)
- Interesting topic, not covered: CLRS Chapter 10.3 (page 241) "Implementing pointers and objects". See their implementation of double-linked lists using arrays in sections: "A multiple array representation of objects", "A single array representation of objects" and "Allocating and freeing objects"
- Heaps (pdf , pptx)- CLRS Chapter 6.
- Java: PriorityQueue.
- lambda expression for greater than Comparator for Integer (best, flexible): Comparator<Integer> greater = (a, b) -> b-a;
- use the Collections class to get a comparator that reverses the order: Collections.reverseOrder()
- Binary Trees and Search Trees
- Binary Trees (theory only) ( pptx )
- Binary Trees (data structure, code) ( pptx )
- VisualAlgo - good visualization tool. Has code/pseudocode, shows code line executed and corresponding data update, has several operations including (succesor/predecesor, remove, get kth smallest), flexibility in building the tree.
- leetcode practice: search with Tag "binary tree" and solve "easy" problems. (Tag "binary search tree" shows only a few problems).
Here is a list of problems and leetcode representation of trees.
- Search Trees: Binary Search Trees ( pptx )
>>>>> Binary trees PRACTICE (problems and solutions)- Stanford Library - highly recommended.
- Search Trees: 2-3-4 trees ( pptx )
- Animation: from B-Tree select Max Degree 4 and Preemptive Split/Merge to see the same behavior as shown in class.
- AVL tree video (MIT open courseware) - Gives tree properties, insertion steps (not code), proof that an AVL tree with N nodes has height O(lgN). Uses the left and right rotations discussed for binary trees.
- Red-Black trees (wikipedia) - See properties, image, and correspondence with 2-3-4 trees.
-
Hashing ( pptx) CLRS Chapter 11 (CLRS)
Good video Hash Tables and Hash Functions.
Worked out example of double hashing and quadratic hashing
Good read: https://rcoh.me/posts/hash-map-analysis/
-
Greedy Algorithms (pdf, pptx) for 0/1 Knapsack and Job Scheduling
(CLRS Chapter 16 )
(extra, not required: Knapsack - 4 versions(pdf, pptx)
- Huffman Code Tree - covered at the end of class if time permit (CLRS Chapter 16 )
Good read (class notes based on it): https://www2.cs.duke.edu/csed/poop/huff/info/
- Dynamic Programming - CLRS Chapter 15 (15.1, 15.3, ?? 15.4, ??15.2) (Sedgewick - Sections 5.1, 5.3).
-
Edit Distance, Longest Common Subsequence, Longest Increasing Subsequence (pdf, pptx )
Visualization from Data Structures Visualization: Longest Common Subsequence (give BDCABA and ABCBDAB) - only the Table (bottom-up DP) is required, but see recursive and memoized as well. (For memoized you can see that not all cells are computed).
-
Knapsack, Job Scheduling, Fibonacci, Stair Climbing (pdf, pptx )
Visualization from Data Structures Visualization :
Fibonacci - for memoized you can see how it looks back the cells and fills them out.
- DP-General ( pptx)
-
More examples of dynamic programming (pdf, pptx) - Extra, harder examples
- leetcode resources:
Categorization of Dynamic Programing Problems in leetcode post. (It has more categories than what we cover in class)
List of DP problems on LeetCode (recommended by Dikshit): https://leetcode.com/discuss/general-discussion/491522/dynamic-programming-questions-thread
-
Graphs (pdf , pptx ) - CLRS Chapter 22.
Links to resources on Depth-First Search (DFS), Breadth-First Search (BFS) and other topics:
- CLRS
- BFS and DFS,( with subtitles)
- VisualAlgo Legend of node coloring: full orange node - currently working on, empty orange node: finished (black in the white-gray-black color scheme), empty blue nodes: discovered nodes (gray in white-gray-black). Check the explanations in the pink bar.
- MIT OpenCourseWare: BFS, DFS
- Tricolor graph algorithm (white-gray-black) by Andrew Myers. Good brief notes. Note that on this page, in the Edge Classification section, the example of a forward edge from D to C is wrong. That is a cross edge.
-
Minimum-cost Spanning Trees - Prim's algorithm (pdf , pptx) - CLRS Chapter 23
If time permits: Kruskal's algorithm for MST (pptx)
(
Union_Find (CLSR: Chapter 21: Data Structures for Disjoint Sets) (Sedgewick: Chapter 1))
-
Shortest Paths (pdf , pptx) - CLRS Section 24.3 (Dijkstra's algorithm)
-
Graph Summary (pdf , pptx)