Data Quiz 4

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

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. a. Inorder traversal b. Preorder traversal c. Postorder traversal d. Breadth-first traversal

a. Inorder traversal

The time complexity for deleting an element into a binary search tree is _______. a. O(n) b. O(logn) c. O(nlogn) d. O(n^2)

a. O(n)

The time complexity for inserting an element into a binary search tree is _______. a. O(n) b. O(logn) c. O(nlogn) d. O(n^2)

a. O(n)

The time complexity for searching an element in a binary search tree is _______. a. O(n) b. O(logn) c. O(nlogn) d. O(n^2)

a. O(n)

What is the worst case time complexity for search, insert and delete operations in a general Binary Search Tree? a. O(n) for all b. O(Logn) for all c. O(Logn) for search and insert, and O(n) for delete d. O(Logn) for search, and O(n) for insert and delete

a. O(n) for all

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. a. Binary tree b. Binary search tree c. List d. Linked list

b. Binary search tree

Which of the following traversal outputs the data in sorted order in a BST? a. Preorder b. Inorder c. Postorder d. Level order

b. Inorder

The _________ is to visit the current node first, then the left subtree of the current node, and finally theright subtree of the current node. a. Inorder traversal b. Preorder traversal c. Postorder traversal d. Breadth-first traversal

b. Preorder traversal

The _________ is to visit the left subtree of the current node first, then the right subtree of the currentnode, and finally the current node itself. a. Inorder traversal b. Preorder traversal c. Postorder traversal d. Breadth-first traversal

c. Postorder traversal

Which of the following is false about a binary search tree? a) The left child is always lesser than its parent b) The right child is always greater than its parent c) The left and right sub-trees should also be binary search trees d) In order sequence gives decreasing order of elements

d) In order sequence gives decreasing order of elements

The preorder traversal sequence of a binary search tree is 30, 20, 10, 15, 25, 23, 39, 35, 42. Which one of the following is the postorder traversal sequence of the same tree? a. 10, 20, 15, 23, 25, 35, 42, 39, 30 b. 15, 10, 25, 23, 20, 42, 35, 39, 30 c. 15, 20, 10, 23, 25, 42, 35, 39, 30

d. 15, 10, 23, 25, 20, 35, 42, 39, 30


Kaugnay na mga set ng pag-aaral

CompTIA Network+ Ch.7: IP Addressing

View Set

AP Psychology Emotion, Motivation & Stress Module 38

View Set

International Marketing chapter 14,15,16,18&19

View Set

Reverse Raffle - AR verb conjugations

View Set