Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Exam (elaborations)

DATA STRUCTURE QUIZ 3 WITH CORRECT ANSWERS

Rating
-
Sold
-
Pages
8
Grade
A+
Uploaded on
28-07-2025
Written in
2024/2025

DATA STRUCTURE QUIZ 3 WITH CORRECT ANSWERS

Institution
DATA STRUCTURES
Course
DATA STRUCTURES

Content preview

DATA STRUCTURE QUIZ 3



Which of the following is an example of a map?
(a) (J, Jane), (B, Bill), (S, Sam), (B1, Bob), (B, Bill)
(b) (J, Jane), (B, Bill), (S, Sam), (B1, Bob), (B2, Bill)
(c) (J, Jane), (B, Bill), (S, Sam), (B1, Bob), (J, Jane)
(d) (S, Sam), (B, Bill), (S, Sam), (B1, Bob), (B2, Bill) - Correct Answers -(b) (J, Jane), (B,
Bill), (S, Sam), (B1, Bob), (B2, Bill)

Because Map cannot have a duplicate key

(True/False) Using a hash table enables us to retrieve an item in O(nlog(n)) time. -
Correct Answers -False

Hash table retrival is O(1)

(True/False) Using Huffman codes to encode text files should give you files with more
bits than you would get using other codes. - Correct Answers -False

Huffman codes uses fewer bits for the most common characters and more bits for the
uncommon characters

The following algorithm is a(n) .
if the tree is empty
Return null (target is not found).
else if the target matches the root node's data
Return the data stored at the root node.
else if the target is less than the root node's data
Return the result of searching the left subtree of the root.
else
Return the result of searching the right subtree of the root.

(a) algorithm for removal from a heap
(b) algorithm for insertion into a heap
(c) algoithm for insertion into a a binary tree
(d) recursive algorithm for searching a binary tree - Correct Answers -(d) recursive
algorithm for searching a binary tree

Expanding and contracting arrays are operations.
(a) O(n)

, (b) O(log2 n)
(c) O(√n)
(d) O(n2) - Correct Answers -(a) O(n)

Insertion into and removal from a heap is a operation.
(a) O(n)
(b) O(n2)
(c) O(log2 n)
(d) O(nlog2 n)
(e) O(log10 n) - Correct Answers -(c) O(log2 n)

Complete the following algorithm which recursively inserts an item into a binary search
tree.

if the root is null
Replace empty tree with a new tree with the item at the root and return true.
else if the item is equal to root.data
__________
else if the item is less than root.data
Recursively insert the item in the left subtree.
else
Recursively insert the item in the right subtree.

(a) The item is not in the tree; return false.
(b) The item is already in the tree; return false.
(c) The item is not in the tree; return true.
(d) The item is already in the tree; return true. - Correct Answers -(b) The item is already
in the tree; return false.

(True/False) In Java's PriorityQueue, the poll method first saves the item at the top of
the heap. (Check your answer by consulting the javadoc). - Correct Answers -True

Searching a binary search tree is a process.
(a) O(n)
(b) O(1)
(c) O(logn)
(d) O(n2) - Correct Answers -(c) O(logn)

(True/False) Removal from a heap is always from the bottom. - Correct Answers -False

The _________ of a node is a measure of its distance from the root. - Correct Answers -
Level

The __________ is used to implement a priority queue. - Correct Answers -Heap

Written for

Institution
DATA STRUCTURES
Course
DATA STRUCTURES

Document information

Uploaded on
July 28, 2025
Number of pages
8
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

$12.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
millyphilip West Virginia University
Follow You need to be logged in order to follow users or courses
Sold
2921
Member since
4 year
Number of followers
1958
Documents
44307
Last sold
12 hours ago
white orchid store

EXCELLENCY IN ACCADEMIC MATERIALS ie exams, study guides, testbanks ,case, case study etc

3.6

551 reviews

5
239
4
87
3
104
2
32
1
89

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions