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): 19, 11, 6, 4, 15, 23, 20
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: "19, 11, 23, 6, 15, 20, 4". Chèn lần lượt: 19 làm gốc; 11 nhỏ hơn 19 nên sang trái; 6 nhỏ hơn cả 19 và 11 nên thành con trái của 11; 4 nhỏ hơn 6 nên thành con trái của 6; 15 nhỏ hơn 19 nhưng lớn hơn 11 nên thành con phải của 11; 23 lớn hơn 19 nên sang phải; 20 lớn hơn 19 và nhỏ hơn 23 nên thành con trái của 23. Duyệt theo bề rộng đọc từng mức: 19, rồi 11 và 23, rồi 6, 15, 20, cuối cùng 4 nằm một mình ở mức bốn. "19, 11, 23, 6, 15, 4, 20" sai vì nó in 4 trước 20, trong khi 4 sâu hơn 20 đúng một mức. "19, 11, 23, 6, 20, 4, 15" sai vì nó đẩy 15 xuống sau 4, dù 15 là con của 11 nên cùng mức với 20. "19, 11, 23, 6, 3, 15, 20" sai vì nó chứa khoá 3 không có trong dãy chèn và làm mất khoá 4.
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