MY MUSIC
Các Thao Tác Trên Cây AVL * Cac thao tac tren cay AVL 1. Them node vao cay AVL 2. Loai node tren cay AVL 3. Tim node tren cay AVL 4. Duyet theo thu tu truoc 5. Duyet theo thu tu giua 6. Duyet theo thu tu sau 7. chieu cao cua cay AVL code : #include <iostream> #include <stdlib.h> using namespace std; // dinh nghia Node typedef int item; typedef struct Node { item data; struct Node *left; struct Node *right; item height; }; void init (Node *T){ T = NULL; } int Max (int a, int b){ return (a>b) ? a : b; } int height (Node *T){ if (T == NULL) return 0; return T->height; } // tao 1 node moi Node *makeNode (int data){ Node *p = new Node; p->data = data; p->left = NULL; p->right = NULL; return p; } //tim n...
Nhận xét
Đăng nhận xét