Specify the correct statement about a binary search tree(select the most suitable one).
4 phương ánCó giải thích
Các phương án trả lời
Chọn một phương ánLời giảiChọn phương án để mở
Đáp án đúng: "It is necessary to build a tree with optimized height to stimulate searching operation.". Trên cây tìm kiếm nhị phân, mỗi phép so sánh đưa ta xuống đúng một tầng, nên chi phí tìm tỉ lệ với chiều cao chứ không với số nút; giữ chiều cao nhỏ nhất có thể, khoảng log2 của n với n nút, chính là điều kiện để phép tìm nhanh. Vì vậy "In a binary search tree, all the nodes that are left descendants of node A have key values greater than A; all the nodes that are A's right descendants have key values less than (or equal to) A." sai vì nó đảo ngược bất biến của cây tìm kiếm: con cháu bên trái phải NHỎ hơn nút, con cháu bên phải mới lớn hơn hoặc bằng. "The main purpose of balancing a tree is to keep the tree in good shape." sai vì dáng cây đẹp chỉ là hệ quả quan sát được, mục đích thật của cân bằng là chặn chiều cao để tìm, chèn, xoá giữ được O(log n). "For better searching performance, a tree should be in back-bone shape." sai vì dạng xương sống là cây suy biến, mỗi nút một con, chiều cao bằng số nút, khiến phép tìm tụt về quét tuyến tính.
Cùng phần 4
What is the minimum number of nodes in a nearly complete binary tree with height 4?
(In a tree the height of root is 1, and a binary tree with height h is called nearly complete if the tree is complete at level d for d = 1, 2, ..., h-1, and the leaves in the last level are all in the leftmost positions).Có lời giảiCâu hỏiTo implement an AVL tree, a concept balance factor is introduced (bal = height(right)-height(left)). Suppose an AVL tree is created by inserting to the tree the following keys sequentially:
6, 3, 7, 2, 5, 1
What is the balance factor of the node 6? (please note that the tree is still AVL)Có lời giảiCâu hỏiSuppose the binary search tree T is made by inserting the following keys consequently: 6, 7, 8, 9, 3, 2, 5, 4
What is the result of breadth-first traverse of T?Có lời giảiCâu hỏiCả 76 câu của chủ đề76 câu
Xuất hiện trong 1 bộ đề
Đi tiếp từ đây