Skip to content

Commit d1d353c

Browse files
author
Joseph Luce
authored
Update 437_path_sum_III.md
1 parent d7dc6fb commit d1d353c

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

leetcode/easy/437_path_sum_III.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@ This is similar to a DFS implementation.
1313

1414
The runtime can be calculated in this way.
1515
For each recursive call, we want to traverse the left and right children down to the leaf nodes, this is O(N) runtime.
16-
Since we would have to do this again but for the left and right children, it about O(log(N)) for each.
17-
So we basically have O(N), O(log(N)), O(log(N)).
18-
The two O(log(N)) can be simplified to O(N-1).
19-
So O(N) and O(N-1) per call = O(2^N).
16+
Since we would have to do this again but for the left and right children, both could be combined to be O(N-1).
17+
So O(N) and O(N-1) = O(2^N).
2018

2119
Remember the formula for recursion, (Number of calls ^ (Big O per call))
2220

0 commit comments

Comments
 (0)