avl tree implementation
1.0.0
C ++ 자체 밸런싱 이진 검색 트리 인 AVL 트리의 구현. 코드에는 다음 기능이 포함되어 있습니다 : 삽입, 삭제, 검색 및 인쇄. 완전히 기능하고 잘 작성되었습니다.
AVL 트리는 모든 노드의 두 아동 하위 트리의 높이가 최대 다른 자체 균형 이진 검색 트리입니다. 이 구현은 트리 내에 요소를 삽입, 삭제, 검색 및 인쇄하는 효율적인 방법을 제공합니다.
insert 기능을 사용하면 균형 잡힌 속성을 유지하면서 AVL 트리에 새 값을 추가 할 수 있습니다.
// Function
Node * insert (Node *node, int key);
// Example
AVLTree.insert(AVLTree.root, 19 ); deleteNode 함수는 AVL 트리에서 값이 존재하는 경우 값을 제거합니다. 이 작업은 또한 나무의 균형을 유지하도록합니다. 값이 발견되고 제거되면 트리의 구조가 그에 따라 조정됩니다.
// Function
Node * deleteNode (Node *root, int key);
// Example
AVLTree.deleteNode(AVLTree.root, 16 ); search 함수는 AVL 트리에서 값을 찾아 현재 위치, 부모 및 어린이 (있는 경우)를 인쇄합니다. 값이 루트에 있으면이를 나타냅니다.
// Function
static void search (Node *root, int key);
// Example
Tree::search (AVLTree.root, 32 );
printTree 함수는 AVL 트리의 요소를 정렬 된 순서로 출력합니다.
// Function
void printTree (Node *root, int space);
// Example
AVLTree.printTree(AVLTree.root, 0 );