What is the result of the breadth first traverse of the binary search tree T, after inserting the following keys into the tree sequentially (suppose T is empty before insertion): 15, 7, 3, 0, 12, 20, 17
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: "15, 7, 20, 3, 12, 17, 0". Chèn lần lượt 15, 7, 3, 0, 12, 20, 17: 15 là gốc; 7 nhỏ hơn 15 nên là con trái; 3 nhỏ hơn 15 rồi nhỏ hơn 7 nên là con trái của 7; 0 đi tiếp xuống làm con trái của 3; 12 nhỏ hơn 15 nhưng lớn hơn 7 nên là con phải của 7; 20 lớn hơn 15 nên là con phải của gốc; 17 lớn hơn 15 nhưng nhỏ hơn 20 nên là con trái của 20. Đọc theo mức: 15, rồi 7 và 20, rồi 3, 12 và 17, rồi 0 ở mức bốn. "15, 7, 20, 3, 12, 0, 17" kéo 0 lên trước 17, nhưng 0 ở mức bốn còn 17 vẫn ở mức ba. "15, 7, 20, 3, 17, 12, 0" đọc 17 trước 12 trong cùng mức ba, trái với chiều từ trái sang phải vì 12 thuộc nhánh trái của gốc. "15, 7, 20, 3, 17, 0, 12" vừa đảo 12 với 17 vừa đưa 0 lên mức ba.
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