Technique: break problem into smaller parts, solve recursively, combine results, Divide & Conquer, Split the problem into smaller subproblems, Divide, Recursively solve each subproblem, Conquer, Merge subproblem results into the final solution, Combine, Divide-and-conquer sort; always O(n log n) for all cases, Merge Sort, Search by halving sorted array; requires sorted input; O(log n), Binary Search, Find maximum and minimum in array; O(n) using divide and conquer, Max-Min Problem, Time complexity common to divide and conquer sorting algorithms, O(n log n), A function that calls itself to solve smaller versions of the same problem, Recursion, DIVIDE → CONQUER → COMBINE, 3 Phases of Divide & Conquer, Binary Search, Merge Sort, Quick Sort, Max-Min, Strassen, 5 Common D&C Algorithms, Find mid → Compare → Narrow half → Repeat, Binary Search Steps, O(n log n) for ALL cases (best, average, worst), Merge Sort Time Complexity, Best O(1) | Average O(log n) | Worst O(log n), Binary Search Cases, D&C matrix multiplication using 7 multiplications instead of 8; introduced 1969, Strassen's Algorithm, Strassen's 7 pre-computed products used to derive the result matrix, M1–M7, Makes the locally optimal choice at each step hoping for global optimum, Greedy Algorithm, Best choice at the current step without considering future consequences, Locally Optimal, Best overall solution across all possible choices, Globally Optimal, The condition where a greedy approach is guaranteed to give the correct answer, Greedy Property, Choose largest coin denomination first; works only with standard coin systems, Coin Change (Greedy), Classic greedy problem: select maximum activities that don't overlap, Activity Selection, Greedy algorithm for lossless data compression, Huffman Coding, 8 multiplications + 4 additions, Standard Matrix Multiplication, 7 multiplications (saves 1 multiplication at cost of more additions), Strassen's Method, Define problem → Choose best immediate option → Repeat, 3 Greedy Strategy Steps, Activity Selection, Fractional Knapsack, Huffman Coding, Prim's, Kruskal's, Dijkstra's, 6 Classic Greedy Problems, More additions, not efficient for small matrices, higher memory, Strassen Disadvantages, Greedy optimization: take fractions of items to maximize value within weight limit, Fractional Knapsack, Key metric in fractional knapsack; sort items by this in descending order, Value/Weight Ratio, Schedule jobs to maximize profit; assign each job to latest slot ≤ its deadline, Job Sequencing, The last time slot a job can be completed to count for profit, Deadline (Job Seq.), A unit of time period used in job scheduling; one job per slot, Time Slot, DP version: items CANNOT be split; requires dynamic programming, 0/1 Knapsack, Value/Weight Ratio — higher ratio = take first, Greedy Basis (Knapsack), Profit — higher profit job is scheduled first, Greedy Basis (Jobs), Compute ratios → Sort descending → Take full/partial items, Fractional Knapsack Steps, Sort by profit → Create slots → Assign to LATEST available slot ≤ deadline, Job Sequencing Steps, O(n log n) due to sorting, Fractional Knapsack Time Complexity, Sorting O(n log n) + Scheduling O(n²), Job Sequencing Time Complexity, Fractional Knapsack allows splitting; Job Sequencing does NOT, Key Difference, Technique: solve subproblems once, store results, reuse to avoid recomputation, Dynamic Programming (DP), Same subproblems appear multiple times — DP stores results to avoid repeat work, Overlapping Subproblems, Optimal solution can be built from optimal solutions of smaller subproblems, Optimal Substructure, Recursive DP; cache results in dict/array; solve only needed subproblems, Memoization (Top-Down), Iterative DP; fill table from base case upward; preferred in production, Tabulation (Bottom-Up), Formula that defines DP solution in terms of smaller subproblem solutions, Recurrence Relation, Smallest subproblem with a known answer (e.g., fib(0)=0, fib(1)=1), Base Case, Longest Common Subsequence — longest shared sequence in two strings, LCS, Items cannot be split; DP builds table of max values per weight, 0/1 Knapsack, Minimum coins for a target; DP required when denominations are irregular, Coin Change (DP), Optimal order of matrix multiplications to minimize total operations, Matrix Chain Mult., Cut rod to maximize revenue; similar to Unbounded Knapsack, Rod Cutting, Overlapping Subproblems + Optimal Substructure, 2 Key DP Requirements, Top-Down (Memoization) vs Bottom-Up (Tabulation), 2 DP Approaches, Without DP = O(2ⁿ) | With DP = O(n), Fibonacci Complexity, Identify subproblems → Check overlap → Define recurrence → Choose approach → Store results, 5 Steps to Solve DP, Fibonacci, 0/1 Knapsack, LCS, Coin Change, Matrix Chain, Rod Cutting, 6 Common DP Problems, Brute Force (all possibilities) | Greedy (local optimal) | DP (store & reuse), 3 Technique Comparison, Data structure representing relationships: set of vertices and edges, Graph, An entity or object in a graph, Vertex / Node, A connection between two vertices, Edge / Link, Edges have direction (u → v only), Directed Graph (Digraph), Edges have no direction (u ↔ v), Undirected Graph, Edges carry a cost or weight value, Weighted Graph, Directed Acyclic Graph — no cycles, edges go one direction, DAG, 2D array to represent graph; O(V²) space; fast lookup, Adjacency Matrix, Array of neighbor lists; O(V+E) space; space efficient, Adjacency List, Breadth-First Search — level-by-level traversal using a Queue, BFS, Depth-First Search — deep traversal using Stack or recursion, DFS, Subgraph with all vertices, no cycles, exactly V-1 edges, Spanning Tree, Minimum Spanning Tree — spanning tree with smallest total weight, MST, MST: edge-based, sort edges by weight, use Union-Find; best for sparse graphs, Kruskal's Algorithm, MST: vertex-based, grow tree from any node, use Priority Queue; best for dense graphs, Prim's Algorithm, Shortest path: non-negative weights only; greedy; O((V+E) log V), Dijkstra's Algorithm, Shortest path: handles negative weights; detects negative cycles; O(VE), Bellman-Ford, All-pairs shortest path; check all intermediate nodes; O(V³), Floyd-Warshall, Layered DAG; solved with backward DP; no priority queue needed; O(E), Multistage Graph, Data structure used in Kruskal's to detect cycles efficiently, Union-Find, Undirected, Directed, Unweighted, Weighted, Cyclic, Acyclic (DAG), Connected, Disconnected, 8 Types of Graphs, Adjacency Matrix (O(V²)) vs Adjacency List (O(V+E)), 2 Graph Representation Methods, BFS (Queue, level-by-level) | DFS (Stack, deep-first), 2 Traversal Algorithms, All vertices included + No cycles + Exactly V-1 edges, 3 Properties of Spanning Tree, Kruskal's (edge-based, sparse) | Prim's (vertex-based, dense), 2 MST Algorithms, Dijkstra (no negatives) | Bellman-Ford (negatives OK) | Floyd-Warshall (all-pairs), 3 Shortest Path Algorithms, Layered DAG + Backward DP + O(E) time + No priority queue needed, Multistage Graph, Complexity = O((V+E)logV) | O(VE) | O(V³), Dijkstra vs Bellman-Ford vs Floyd
0%
AC
共享
共享
由
Plandezagelyn
编辑内容
保存
喜欢
打印
嵌入
更多
需要登录
视觉风格
显示所有
字体
活动设置
排行榜
作业
需要订阅
活动设置
排行榜
此排行榜当前是私人享有。单击
,共享
使其公开。
资源所有者已禁用此排行榜。
此排行榜被禁用,因为您的选择与资源所有者不同。
还原选项
显示更多
显示更少
闪存卡
是一个开放式模板。它不会为排行榜生成分数。
作业
您尚未与学生分享任何活动。
要开始收集结果,请转到任何活动页面,然后选择
Set assignment(设置分配
)。
确认您的设置并与学生共享生成的链接。
设置作业
更像是这样
Match the problems to the solutions
由
Esoffar0210
匹配游戏
2
Time Management Questions
由
Bkoch
随机轮盘
33
Basic Operations - Day 5 - Match the following
由
Ajithrajesh786
匹配游戏
3
Integer Operations Maze
由
Mmosqueda2
迷宫追逐
14
Multiplication Match up drill
由
Deepauneel
匹配游戏
6
Questions - March Binary Game
由
Senizkarakis
随机轮盘
2
Assignment:Math 5:Solving Routine and Non-routine word Problems
由
Janecancejo
匹配游戏
2
Greenman - Unit 4 - Jobs - matching pairs
由
Luckyteachrdebs
配对游戏
3
切换模板
显示所有
打开成绩
复制链接
QR 代码
删除
恢复自动保存:
?