Skip to content

Commit c20f880

Browse files
committed
AVLTree update
1 parent f7a667a commit c20f880

4 files changed

Lines changed: 602 additions & 12 deletions

File tree

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package com.zejian.structures.Tree.AVLTree;
2+
3+
/**
4+
* Created by zejian on 2016/12/25.
5+
* Blog : http://blog.csdn.net/javazejian [原文地址,请尊重原创]
6+
* 平衡二叉搜索树(AVL树)节点
7+
*/
8+
public class AVLNode<T extends Comparable> {
9+
10+
public AVLNode<T> left;//左结点
11+
12+
public AVLNode<T> right;//右结点
13+
14+
public T data;
15+
16+
public int height;//当前结点的高度
17+
18+
public AVLNode(T data) {
19+
this(null,null,data);
20+
}
21+
22+
public AVLNode(AVLNode<T> left, AVLNode<T> right, T data) {
23+
this(left,right,data,0);
24+
}
25+
26+
public AVLNode(AVLNode<T> left, AVLNode<T> right, T data, int height) {
27+
this.left=left;
28+
this.right=right;
29+
this.data=data;
30+
this.height = height;
31+
}
32+
}

0 commit comments

Comments
 (0)