Skip to content

Commit 06da82c

Browse files
committed
fix solution: Construct Binary Tree from Preorder and Inorder Traversal
1 parent b8ae18e commit 06da82c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

binary-tree-level-order-traversal/Gotprgmer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
// 시간복잡도 : O(N^2) -> 한쪽으로 치우친 트리일 경우 O(N)(index of) + T(N-1)이 될 수 있다.
2525
// 위 식을 전개해보면 N + N-1 + N-2 + ... + 1 = N(N+1)/2 = O(N^2)
26-
// 공간복잡도 : O(N) -> N길이의 리스트 크기
26+
// 공간복잡도 : O(N) ->리트코드 but N길이의 리스트 크기*N번의 재귀호출이 일어날 수 있다. 따라서 O(N^2)가 아닌가...?
2727
class SolutionGotprgmer {
2828
public TreeNode buildTree(int[] preorder, int[] inorder) {
2929

0 commit comments

Comments
 (0)