본문 바로가기

binary search tree4

[LEET CODE] 105. Construct Binary Tree from Preorder and Inorder Traversal # Problem Given two integer arrays preorder and inorder where preorder is the preorder traversal of a binary tree and inorder is the inorder traversal of the same tree, construct and return the binary tree. Constraints: 1 2021. 5. 24.
[LEET CODE] 938. Range Sum of BST # Problem Given the root node of a binary search tree and two integers low and high, return the sum of values of all nodes with a value in the inclusive range [low, high]. Constraints: The number of nodes in the tree is in the range [1, 2 * 104]. 1 L: stack.append(node.left) if node.val < R: stack.append(node.right) if L L: stack.append(node.left) if node.val < R: stack.append(node.right) if L O.. 2021. 5. 24.
[LEET CODE] 108. Convert Sorted Array to Binary Search Tree # Problem Given an integer array nums where the elements are sorted in ascending order, convert it to a height-balanced binary search tree. A height-balanced binary tree is a binary tree in which the depth of the two subtrees of every node never differs by more than one. Constraints: 1 2021. 5. 19.
[코딩 + 알고리즘 완주반] 14일차. 트리 # 트리 구조 트리 : Node 와 Branch를 이용해서 사이클을 이루지 않도록 구성한 데이터 구조 이진트리형태의 구조로 탐색 알고리즘 구현을 위해 많이 사용 # 알아둘 용어 Node : 트리에서 데이터를 저장하는 기본 요소( 데이터와 다른 연결된 노드에 대한 branch 정보 포함) Root Node : 트리 맨 위에 있는 노드 Level : 최상위 노드를 level 0으로 하였을 때, 하위 branch로 연결된 노드의 깊이 Parent Node : 어떤 노드의 다음 레벨에 연결된 노드 Child Node : 어떤 노드의 상위 레벨에 연결된 노드 Leaf Node(Terminal Node) : Child Node가 하나도 없는 노드 Silbinng(Brother node) : 동일한 Parent No.. 2021. 3. 28.
반응형