19. Binary Search Trees - 11 Questions


19. Binary Search Trees

19. Binary Search Trees

11 Questions
Created by Y. Daniel Liang - http://www.cs.armstrong.edu/liang/index.html
Free
This Python quiz is aimed at students, enthusiasts and job seekers with little or no programming experience. It aims to provide them with an understanding of the role of computers and python programming language.
  1. A __________ (with no duplicate elements) has the property that for every node in the tree the value of any node in its left subtree is less than the value of the node and the value of any node in its right subtree is greater than the value of the node.



    binary tree
    binary search tree
    list
    linked list

    View Answer | Discuss in forum
  2. The ________ of a path is the number of the edges in the path.



    length
    depth
    height
    degree

    View Answer | Discuss in forum
  3. The _______ of a node is the length of the path from the root to the node. 



    length
    depth
    height
    degree

    View Answer | Discuss in forum
  4. The _______ of a nonempty tree is the length of the path from the root node to its furthest leaf + 1.



    length
    depth
    height
    degree

    View Answer | Discuss in forum
  5. The ________ is to visit the left subtree of the current node first, then the current node itself, and finally the right subtree of the current node. 



    inorder traversal
    preorder traversal
    postorder traversal
    breadth-first traversal

    View Answer | Discuss in forum
  6. The _________ is to visit the left subtree of the current node first, then the right subtree of the current node, and finally the current node itself.



    inorder traversal
    preorder traversal
    postorder traversal
    breadth-first traversal

    View Answer | Discuss in forum
  7. The _________ is to visit the current node first, then the left subtree of the current node, and finally the right subtree of the current node. 



    inorder traversal
    preorder traversal
    postorder traversal
    breadth-first traversal

    View Answer | Discuss in forum
  8. The _________ is to visit the nodes level by level. First visit the root, then all children of the root from left to right, then grandchildren of the root from left to right, and so on.



    inorder traversal
    preorder traversal
    postorder traversal
    breadth-first traversal

    View Answer | Discuss in forum
  9. The time complexity for searching an element in a binary search tree is _______.



    O(n)
    O(logn)
    O(nlogn)
    O(n^2)

    View Answer | Discuss in forum
  10. The time complexity for inserting an element into a binary search tree is _______.



    O(n)
    O(logn)
    O(nlogn)
    O(n^2)

    View Answer | Discuss in forum
  11. The time complexity for deleting an element into a binary search tree is _______.



    O(n)
    O(logn)
    O(nlogn)
    O(n^2)

    View Answer | Discuss in forum