Select the most correct definition of a binary tree:
3 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: "A binary tree T is a set of nodes such that either
• T is empty, or
• T is partitioned into 3 disjoint subsets:
- A single node r, the root, and
- Two binary trees, called left subtree and right subtree of r.". Định nghĩa đệ quy của cây nhị phân phải nhận trường hợp rỗng, bởi nhánh trái lẫn nhánh phải của một nút lá đều là cây rỗng; thiếu mệnh đề rỗng thì phép phân rã không có điểm dừng. Cách viết "A binary tree T is a set of one or more nodes such that
T is partitioned into 3 disjoint subsets:
• A single node r, the root
• Two sets that are binary trees, called left subtree and right subtree of r." khởi đầu bằng tập hợp có một nút trở lên, tức không nhận cây rỗng, nên khi phân rã tới một lá thì hai cây con của lá ấy chẳng thuộc lớp vừa định nghĩa và dây đệ quy treo lại. Cách viết "A binary tree T is a set of nodes such that either
• T is empty, or
• T is partitioned into 3 disjoint subsets:
- A single node r, the root, and
- Two non-empty binary trees, called left subtree and right subtree of r." có mệnh đề rỗng nhưng lại đòi hai cây con khác rỗng, kéo theo mọi nút đã có con thì phải có đủ hai con khác rỗng, nên cây một nút hay cây lệch hẳn về một bên đều bị loại oan dù chúng vẫn là cây nhị phân.
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