Toggle navigation
Jasper Blog
Home
life
tech
ABOUT
Jasper Blog
千里之行,始於足下
Leet Code Array-PrefixSums
Prefix Sum
Tips: Prefix sum 又可以稱為 cumulative sum 或是 inclusive scan,核心的概念其實蠻直覺簡單,就是將陣列中每個元素的位置上,儲存該位置之前所有元素、或是特定條件下的總和。 const
Posted by Jasper Wednesday, October 23, 2024
Leet Code BFS / DFS
BFS vs. DFS in Flood Fill Algorithm
BFS vs. DFS in Flood Fill Algorithm Breadth-First Search (BFS) Approach: BFS uses a queue and explores all neighbors at the present depth level before moving on to nodes at the next depth level. Advantages: Can be more memory-efficient if the tree/graph is very deep but not very wide. Guarantees the shortest path in an unweighted graph. Disadvantages: Can consume more memory if the graph is very wide.
Posted by Jasper Wednesday, October 23, 2024
Leet Code Binary Search
堆疊 vs 遞迴
遞迴和堆疊的關係 在演算法中,使用堆疊(stack)和使用遞迴(recursion)有著密切的關聯,因為遞迴本質上是使用系統堆疊來管理函數調用
Posted by Jasper Wednesday, October 23, 2024
Leet Code BinarySearch Follow up
Follow up questions on interview
LeetCode 110. 平衡二叉樹的後續問題 時間複雜度分析: 你的解決方案的時間複雜度是多少?你能解釋一下為什麼嗎? 答:時間複雜度是 O(n),其中 n 是樹中節點的數
Posted by Jasper Wednesday, October 23, 2024
FEATURED TAGS
book
camping
csharp
django
docker
hugo
leetcode
python
ABOUT ME
Software Developer, Data lover
FRIENDS