Geschrieben von Student*innen, die bestanden haben Sofort verfügbar nach Zahlung Online lesen oder als PDF Falsches Dokument? Kostenlos tauschen 4,6 TrustPilot
logo-home
Document preview thumbnail
Vorschau 2 aus 10 Seiten
Prüfung

EECS 281 FINAL QUESTIONS WITH CORRECT ANSWERS

Document preview thumbnail
Vorschau 2 aus 10 Seiten

EECS 281 FINAL QUESTIONS WITH CORRECT ANSWERS

Inhaltsvorschau

EECS 281 FINAL QUESTIONS WITH CORRECT
ANSWERS



Hashing Basic Functionality Complexity - ans-
xz xz xz xz xzxz




Efficient: Insert O(1), Search O(1), Remove O(1)
xz xz xz xz xz xz




Inefficient: Sort, Kth largest, Joint/Merge xz xz xz xz




Hashing Load Factor - ans-Alpha = α = N/M xz xz xz xzxz xz xz xz xz




N is number of keys in table
xz xz xz xz xz xz




M is size of table
xz xz xz xz




Need to keep below 0.5 so functions are efficient.
xz xz xz xz xz xz xz xz




Hashing Load Factor - Separate Chaining - ans-
xz xz xz xz xz xz xzxz




Load factor, α, is average number of items per table entry
xz xz xz xz xz xz xz xz xz xz




Hashing Load Factor - Open Addressing - ans-Load factor, α, is percent of table filled
xz xz xz xz xz xz xzxz xz xz xz xz xz xz xz




Hashing Insert Complexity - ans-O(1) if duplicates are allowed
xz xz xz xzxz xz xz xz xz




O(α) if no duplicates allowed.
xz xz xz xz




Reasoning: Need to search for item to see if it already exists. Search is expensive.
xz xz xz xz xz xz xz xz xz xz xz xz xz xz




Hashing Search Complexity - ans-O(α) xz xz xz xzxz




Need to hash for the key but then need to linear search table if rehashing or chain if separat
xz xz xz xz xz xz xz xz xz xz xz xz xz xz xz xz xz xz




e chaining
xz




Hashing Remove Complexity - ans- xz xz xz xzxz




O(α). Need to search for item before removing it. Could be even worse depending on separ
xz xz xz xz xz xz xz xz xz xz xz xz xz xz xz




ate chaining container.
xz xz




Hashing Complexity - Normal Vector - ans-Insert and Search both O(α)
xz xz xz xz xz xzxz xz xz xz xz




Hashing Complexity - Sorted Vector - ans-Insert is O(α) and Search is O(log α)
xz xz xz xz xz xzxz xz xz xz xz xz xz xz




Hashing Complexity - Binary Tree - ans-Insert and search O(log a).
xz xz xz xz xz xzxz xz xz xz xz




Large memory over head to maintain tree.
xz xz xz xz xz xz




Hashing Linear vs Quadratic Probing Complexity - ans-
xz xz xz xz xz xz xzxz




Number of probes for hit and for miss grow exponentially with α for both.
xz xz xz xz xz xz xz xz xz xz xz xz xz

, Quadratic has slightly slower growth for both hit and miss. xz xz xz xz xz xz xz xz xz




Number of probes for hit < number of probes for miss
xz xz xz xz xz xz xz xz xz xz




Dynamic Hashing Summary - ans-When α ≥ 0.5, grow table size (M) and rehash.
xz xz xz xzxz xz xz xz xz xz xz xz xz xz




Keeps load factor α low, but occasional expensive regrow operation
xz xz xz xz xz xz xz xz xz




Dynamic Hashing Amortized Complexity - ans-O(M) - Linear
xz xz xz xz xzxz xz xz




1) Initial inserts have cost until α ≥ 0.5
xz xz xz xz xz xz xz xz




=> Max 2.5 probes for insertion hit/miss if α ≤ 0.5
xz xz xz xz xz xz xz xz xz xz




=> Insert M/α -1 keys before α exceeds 0.5
xz xz xz xz xz xz xz xz




=> 2.5 * (M/α -1) = O(M)
xz xz xz xz xz xz




2) Grow and rebuild table
xz xz xz xz




=> Max 1.5 probes for insertion hit/miss if α ≤ 0.25
xz xz xz xz xz xz xz xz xz xz




=> 1.5 * M/2 = O(M)
xz xz xz xz xz




Thus 2O(M) = O(M) = Linear amortized cost.... O(1)!
xz xz xz xz xz xz xz xz




Simple Tree - ans-Acyclic, connected graph.
xz xz xzxz xz xz xz




Undirected.

Rooted Tree - ans-Simple Tree w/ selected vertex as root.
xz xz xzxz xz xz xz xz xz xz




Edges directed AWAY from root. xz xz xz xz




Internal Node - ans-A node with children xz xz xzxz xz xz xz




ordered tree - ans-A rooted tree in which all children of each vertex are ordered left to right.
xz xz xzxz xz xz xz xz xz xz xz xz xz xz xz xz xz xz




Binary Tree - ans-a tree in which each node has at most 2 children.
xz xz xzxz xz xz xz xz xz xz xz xz xz xz




Complete Binary Tree - ans-A binary tree with depth d where: xz xz xz xzxz xz xz xz xz xz xz




1) Depths 1,...,d-1 are all full
xz xz xz xz xz xz




(each level of the tree except the last is full)
xz xz xz xz xz xz xz xz xz




2) All internal nodes are to the left of external nodes at depth d-1
xz xz xz xz xz xz xz xz xz xz xz xz xz




(All leaves are at the second to last level or left most at the last level)
xz xz xz xz xz xz xz xz xz xz xz xz xz xz xz




Complete Binary Tree Implementation - ans-Root: Index 1 xz xz xz xz xzxz xz xz




Left Child of node i = 2*i
xz xz xz xz xz xz




Right child of node i = 2*i+1
xz xz xz xz xz xz




Inefficient use of space for sparse trees xz xz xz xz xz xz




Binary Tree Insert Complexity - ans-Best: O(1)
xz xz xz xz xzxz xz




Worst: O(n) xz

Dokument Information

Hochgeladen auf
22. juni 2026
Anzahl der Seiten
10
geschrieben in
2025/2026
Typ
Prüfung
Enthält
Fragen & antworten
11,13 €

Falsches Dokument? Kostenlos tauschen Innerhalb von 14 Tagen nach dem Kauf und vor dem Herunterladen kannst du ein anderes Dokument wählen. Du kannst den Betrag einfach neu ausgeben.
Geschrieben von Student*innen, die bestanden haben
Sofort verfügbar nach Zahlung
Online lesen oder als PDF

Seller avatar
Bewertungen des Ansehens basieren auf der Anzahl der Dokumente, die ein Verkäufer gegen eine Gebühr verkauft hat, und den Bewertungen, die er für diese Dokumente erhalten hat. Es gibt drei Stufen: Bronze, Silber und Gold. Je besser das Ansehen eines Verkäufers ist, desto mehr kannst du dich auf die Qualität der Arbeiten verlassen.
VICTORYSUCCESS
3,0
(2)
Verkauft
16
Anhänger
0
Sachen
2227
Zuletzt verkauft
4 Jahren vor



Warum sich Studierende für Stuvia entscheiden

on Mitstudent*innen erstellt, durch Bewertungen verifiziert

Geschrieben von Student*innen, die bestanden haben und bewertet von anderen, die diese Studiendokumente verwendet haben.

Nicht zufrieden? Wähle ein anderes Dokument

Kein Problem! Du kannst direkt ein anderes Dokument wählen, das besser zu dem passt, was du suchst.

Bezahle wie du möchtest, fange sofort an zu lernen

Kein Abonnement, keine Verpflichtungen. Bezahle wie gewohnt per Kreditkarte oder Sofort und lade dein PDF-Dokument sofort herunter.

Student with book image

“Gekauft, heruntergeladen und bestanden. So einfach kann es sein.”

Alisha Student

Arbeitest du an deiner Quellenangabe?

Erstelle korrekte Quellenangaben in APA, MLA und Harvard mit unserem kostenlosen Zitiergenerator.

Arbeitest du an deiner Quellenangabe?

Häufig gestellte Fragen