CS214 theory must know questions

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/10

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 11:59 AM on 5/30/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

11 Terms

1
New cards

Python makes use of duck typing. Explain what type hints are in Python, and what shortcoming of duck typing they attempt to alleviate.

Type hints are optional annotations that indicate the expected types of variables, function parameters, and return values. They help alleviate the drawback of duck typing that type errors are often only detected at runtime by allowing static analysis tools to catch type related errors before runtime

2
New cards

Explain why we must use an immutable type for a symbol table's keys.

Keys must be immutable so their hash value and equality do not change after insertion. If a key changes, it may no longer be found in the symbol table.

3
New cards

Advantages and Disadvantages of Immutability

adv: Immutability provides safety & predictability as the objects cannot change unexpectedly.

disadv: Immutability leads to an increase in memory usage and slower performance.

4
New cards

magnitude formula

math.sqrt(self.dot(self))

5
New cards

plotting formula

log(T) = mlog(N) + c

6
New cards

6 dunder methods

gt,ge,eq,ne,lt,le

7
New cards

recursion relation formula

T(N) = 2T(N/2) + O(N)

8
New cards

best complexity for merge sort

O(N log N)

9
New cards

BST rule

smaller: left, bigger: right

10
New cards

OOP principle of encapsulation naming convention

leading underscore: indicates that the field is meant to be private. Signals to the developer that the field is internal to the class and must be treated as private

11
New cards

advantages of OOP principle of encapsulation

improved code maintainability and enhanced data integrity