l Logical Data Structures Linear list Linear structures

  • Slides: 19
Download presentation
트리 l (Logical) Data Structures Linear list Linear structures Tree Non-linear structures Graph

트리 l (Logical) Data Structures Linear list Linear structures Tree Non-linear structures Graph

이진 검색 트리 이진검색트리의 예 Which is/are binary search tree(s)? 30 20 12 5

이진 검색 트리 이진검색트리의 예 Which is/are binary search tree(s)? 30 20 12 5 25 15 10 22 2 60 40 70 55 80 Page 4

이진 검색 트리 l Balance Factor n n n : the height of the

이진 검색 트리 l Balance Factor n n n : the height of the left subtree : the height of the right subtree Balance Factor l Balanced Binary (Search) Tree n A tree with |B| 1 for all nodes HL HR Page 5

최적 이진검색 트리 문제 - 동적 계획법: 알고리 즘 [알고리즘 3. 9] 최적 이진검색

최적 이진검색 트리 문제 - 동적 계획법: 알고리 즘 [알고리즘 3. 9] 최적 이진검색 트리 float optsearchtree (int n, float[] p, index[][] R) { int i, j, k, diagonal; float minavg; float[][] A = new float[1 … n+1][0 … n]; for (i=1; i<=n; i++) { A[i][i-1] = 0; A[i][i] = p[i]; R[i][i-1] = 0; R[i][i] = i; } A[n+1][n] = 0; R[n+1][n] = 0; for (diagonal=1; diagonal <= n - 1; diagonal++) for (i=1; i <= n - diagonal; i++) { j = i + diagonal; } } return (A[1][n]); Page 18