Mercurial > repos > pfrommolt > ngsrich
comparison NGSrich_0.5.5/src/datastructures/AVLNode.java @ 0:89ad0a9cca52 default tip
Uploaded
| author | pfrommolt |
|---|---|
| date | Mon, 21 Nov 2011 08:12:19 -0500 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:89ad0a9cca52 |
|---|---|
| 1 package datastructures; | |
| 2 | |
| 3 | |
| 4 // Basic node stored in AVL trees | |
| 5 // Note that this class is not accessible outside | |
| 6 // of package DataStructures | |
| 7 | |
| 8 class AVLNode | |
| 9 { | |
| 10 // Constructors | |
| 11 @SuppressWarnings("unchecked") | |
| 12 AVLNode( Comparable theElement ) | |
| 13 { | |
| 14 this( theElement, null, null ); | |
| 15 } | |
| 16 | |
| 17 @SuppressWarnings("unchecked") | |
| 18 AVLNode( Comparable theElement, AVLNode lt, AVLNode rt ) | |
| 19 { | |
| 20 element = theElement; | |
| 21 left = lt; | |
| 22 right = rt; | |
| 23 height = 0; | |
| 24 } | |
| 25 | |
| 26 // Friendly data; accessible by other package routines | |
| 27 @SuppressWarnings("unchecked") | |
| 28 Comparable element; // The data in the node | |
| 29 AVLNode left; // Left child | |
| 30 AVLNode right; // Right child | |
| 31 int height; // Height | |
| 32 } |
