100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

CSC148 section 8 Study Questions with Complete solutions

Rating
-
Sold
-
Pages
7
Grade
A+
Uploaded on
07-09-2024
Written in
2024/2025

CSC148 section 8 Study Questions with Complete solutions

Institution
CSC148
Course
CSC148









Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
CSC148
Course
CSC148

Document information

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

Subjects

Content preview

CSC148 section 8 Study Questions with
Complete solutions

what is the drawback of the 'looping-through-all-items' search algorithm?

note: this drawback is shared with the tree.__contains__ method - ANSWER in the case of an
unsuccesful search, every item of the list is checked



this is a linear time operation: the time taken for an unsuccessful search grows
proportionally with the length of the list!



what is the efficient search algorithm that can be implemented on sorted lists? - ANSWER
binary search



what is the drawback of binary search due to the fact that it is based on Python's array-
based lists? - ANSWER insertion and deletion still has problems



the following still happens when adding/removing elements that are NOT at the end of sorted
lists:

, - shifting of elements during insertion
- shifting of elements during deletion


binary tree - ANSWER tree in which every item has at most two subtrees / children


an item in a binary tree satisfies the binary search tree property if... - ANSWER its value is
(1) greater than or equal to all items in its left subtree
(2) less than or equal to all items in its right subtree



a binary tree is a binary search tree (BST) if... - ANSWER every item in the tree satisfies the BST
property



state an advantageous inherent property of BSTs - ANSWER natural sorting: BSTs
inherently organize data in a sorted manner, even if input data was not sorted


BSTs are extremely efficient in __________ AND __________ AND __________ - ANSWER
searching AND insertion AND deletion


in the BinarySearchTree class, which 3 attributes are set to None if a BST is empty? - ANSWER
(1) _root
(2) _left
(3) _right



in the BinarySearchTree class, what is the ONLY case where any of the attributes of a BST
can be set to None? - ANSWER in the case that the BST is empty


a NON-EMPTY BST can have its _left and _right attributes refer to __________ (which is
different from these attributes being set to None) - ANSWER empty BSTs

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.
KenAli West Virginia University
Follow You need to be logged in order to follow users or courses
Sold
84
Member since
1 year
Number of followers
5
Documents
17177
Last sold
3 weeks ago

2.9

19 reviews

5
4
4
4
3
4
2
0
1
7

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

Frequently asked questions