Sandbox

  • 홈
  • 태그
  • 방명록

inorder traversal 2

[LeetCode] Construct Binary Tree from Preorder and Inorder Traversal

Problem Solution First element of preorder will always be the root of the tree. Inorder traversal searches left tree and then right tree, so we can find the root element in the list and divide the list up into left and right side(trees). Now we can build those trees. Repeat this process with the root of left tree, which is the second element in the preorder list. Then use the third element as th..

CODE/Algorithms & Data Structures 2021.10.29

[LeetCode] Binary Tree Inorder Traversal

Problem Recursive Solution Time Complexity O(N) Space Complexity O(N) worst case, O(logN) average case (recursive space of tree height) # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution(object): def inorderTraversal(self, root): """ :type root: TreeNode :rtype:..

CODE/Algorithms & Data Structures 2021.10.21
이전
1
다음
더보기
프로필사진

Sandbox

  • 분류 전체보기 (48)
    • CODE (2)
      • Algorithms & Data Structure.. (43)
      • React (0)
    • READ (3)

Tag

java, array, hackerrank, binary search tree, Linked List, python3, LeetCode, string, LinkedList, preorder traversal, algorithm, depth first search, inorder traversal, Binary Tree, Merge Sort, Binary Search, level order traversal, Coderust, dynamic programming, Implementation,

최근글과 인기글

  • 최근글
  • 인기글

최근댓글

공지사항

페이스북 트위터 플러그인

  • Facebook
  • Twitter

Archives

Calendar

«   2025/05   »
일 월 화 수 목 금 토
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31

방문자수Total

  • Today :
  • Yesterday :

Copyright © Kakao Corp. All rights reserved.

티스토리툴바