Talk:AVL tree/Java: Difference between revisions

Content added Content deleted
No edit summary
No edit summary
Line 40: Line 40:
Present are offsets for the Left, Right and Parent nodes - which are offsets into the node file. Also present is the Key offset, which is an offset into a separate data file. The balance factor is an enum of 4 states. Strictly speaking, when on disk the Header state is not required to identify the header node because it is at offset zero. However, to be consistent with the in-memory calculus, we use a Header state to identify the header node.
Present are offsets for the Left, Right and Parent nodes - which are offsets into the node file. Also present is the Key offset, which is an offset into a separate data file. The balance factor is an enum of 4 states. Strictly speaking, when on disk the Header state is not required to identify the header node because it is at offset zero. However, to be consistent with the in-memory calculus, we use a Header state to identify the header node.


Once the header node is defined, you can go right ahead and produce the AVL Balancing Utilities. For example, a left rotation is as follows.
Once the class node is defined, you can go right ahead and produce the AVL Balancing Utilities. For example, a left rotation is as follows.
<lang java>
<lang java>
static long RotateLeft(NodeFile nf, long node) throws IOException
static long RotateLeft(NodeFile nf, long node) throws IOException