Midterm Review

Midterm Review

Assessment

Flashcard

Engineering

University

Hard

Created by

Wayground Content

FREE Resource

Student preview

quiz-placeholder

25 questions

Show all answers

1.

FLASHCARD QUESTION

Front

Insert the following numbers into a binary search tree in order: 9, 20, 7, 8, 10, 22, 21. Where will the number 10 be located?

Back

As the right child of 8.

2.

FLASHCARD QUESTION

Front

Insert the numbers 15, 10, 20, 5, 12, 17, 25 into a BST. What is the in-order traversal of the tree?

Back

5, 10, 12, 15, 17, 20, 25

3.

FLASHCARD QUESTION

Front

What is the time complexity of merge sort?

Back

O(nlogn)

4.

FLASHCARD QUESTION

Front

Which of the following correctly describes a stack and a queue?
Stack: Last In, First Out (LIFO);
Queue: First In, First Out (FIFO).

Back

Stack: Last In, First Out (LIFO);
Queue: First In, First Out (FIFO).

5.

FLASHCARD QUESTION

Front

Write a recursive method to count the total number of leaf nodes in a binary tree. What is the base case for this recursive function?

Back

When the node has no children.

6.

FLASHCARD QUESTION

Front

What is the height of the following binary tree?
10
/ \
5 15
/ \
3 7

Back

3

7.

FLASHCARD QUESTION

Front

Which of the following is true for a binary search tree (BST)?
Options:
All left children are greater than the parent node.
All right children are smaller than the parent node.
All left children are smaller and all right children are greater than the parent node.
It is not necessary for a BST to have ordered nodes.

Back

All left children are smaller and all right children are greater than the parent node.

Create a free account and access millions of resources

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

By signing up, you agree to our Terms of Service & Privacy Policy

Already have an account?