Skip to content

Commit e4aaad0

Browse files
authored
Update Construct Quad Tree
1 parent 3300192 commit e4aaad0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Top Interview 150/Construct Quad Tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
如果上層節點的所有子節點都是葉節點且數值皆相同的話,我們就 free 掉原本記憶體並新增一個合併後的葉節點即可
33

44
Time Complexity : O(n^2) for T(n) = 4 * T(n / 2) + O(1) , by Master Theorem , T(n) = O(n^(log_2(4))) = O(n^2)
5-
(or you can see that every grids only been visited one times)
5+
(or you can see that every grid only been visited one times)
66
Space Complexity : O(n^2) for the tree (recursion depth = O(logn))
77

88
/*

0 commit comments

Comments
 (0)