Dynamic Programming
✅ Dynamic Programming solve problem by breaking down into simple subproblems solve subproblem once, store the result, avoid redundand computation find a subproblem with repeated caculation ...
✅ Dynamic Programming solve problem by breaking down into simple subproblems solve subproblem once, store the result, avoid redundand computation find a subproblem with repeated caculation ...
✅ Lowest Common Ancestor longest subsequence which is common in input sequences Example: //input S1= "ABC" S2= "ACD" //output 2 //explanation "AC" ✅ Code //depth 0 -> 1 (root) 1 ->...
✅ Longest Increading Sequence in given array, find the longest increasing subsequence(sorted in increasing order) Example: //input arr= {3, 10, 2, 1, 20} //output 3 //explanation {3, 10, 20...
✅ DFS Depth First Search stack, recursion visit all the depth before going onto next branch edge-based technique ⭐️ Keyword subset(부분집합) ✅ Time complexity Adjacency Matrix: O(V^2) ...
✔️ Adjacency Matrix, Adjacency List //input 1 2 1 3 1 4 2 4 3 4 0 1 2 3 4 1 0 1 1 1 2 1 0 0 1 3 1 0 0 1 4 1 1 1 0 time complexity low matrix caculation possible if the graph has node ⬆️...
✅ Hash Table Data structure used to insert, look up, remove key-value pairs operates on hashing concept ✔️ Hash function function to change input into keys ⭐️ Keyword ✅ Code input,...
✅ Counting Sort non-comparison-based sorting algorithm counting: how many times does this element appear in input array? input array get the biggest number max count array size: max +...
✅ Radix Sort sorts elements by processing them digit by digit. ⭐️ Keyword integers, strings with fixed-size keys ⭐️ MSD, LSD MSD Most Significant Digit counting from biggest digit ...
✅ Heap Sort Complete Binary Tree binary tree that adds from left 최댓값부터 또는 최솟값부터 정렬 전체 정렬하기 ❌ 가장 큰 값 몇 개만 필요할 때 Build complete binary tree from array Convert array into heap da...
✅ Merge Sort Divide and Conquer Divide: divide the array into two sub arrays Conquer: each subarray sorted Merge: merge back together when merging, since two sub arrays are sorted, ca...