COEN 12 MIDTERM 1
Save
ADT56-56answer--Encapsulate56Data56and56Operations56on56Data,56static
ADTs56so56far?56-56answer--Set56&56Bag
Big56O56-56answer--analyzes56the56complexity56of56the56code
Big56O56rules56-56answer--
Take56the56highest56growing56factor56and56drop56everything56else.
sequential56search56algorithm56-56answer--
loop56through56the56whole56set56and56search56for56element
sequential56search56big56o56-56answer--O(n)
Binary56Search56Algorithm56-56answer--
takes56mid56point56and56compares56and56then56cuts56search56in56half56from56the56and56
so56on56until56found56or56lo56>=56hi
binary56search56big56O56-56answer--O(log56n)
binary56search56requirements56-56answer--sorted56set
Hashing56concept56-56answer--Key56to56address56mapping
Hash56table56-56answer--Where56we56put56elements56while56assigning56hash
Perfect56hash56function56-56answer--
A56theoretical56hash56function56that56maps56keys56uniformly56and56randomly56into56a56h
ash56table56without56any56collisions.
Direct56hash56-56answer--
Elements56have56predetermined56keys56and56fit56perfectly56(perfect)
Save
ADT56-56answer--Encapsulate56Data56and56Operations56on56Data,56static
ADTs56so56far?56-56answer--Set56&56Bag
Big56O56-56answer--analyzes56the56complexity56of56the56code
Big56O56rules56-56answer--
Take56the56highest56growing56factor56and56drop56everything56else.
sequential56search56algorithm56-56answer--
loop56through56the56whole56set56and56search56for56element
sequential56search56big56o56-56answer--O(n)
Binary56Search56Algorithm56-56answer--
takes56mid56point56and56compares56and56then56cuts56search56in56half56from56the56and56
so56on56until56found56or56lo56>=56hi
binary56search56big56O56-56answer--O(log56n)
binary56search56requirements56-56answer--sorted56set
Hashing56concept56-56answer--Key56to56address56mapping
Hash56table56-56answer--Where56we56put56elements56while56assigning56hash
Perfect56hash56function56-56answer--
A56theoretical56hash56function56that56maps56keys56uniformly56and56randomly56into56a56h
ash56table56without56any56collisions.
Direct56hash56-56answer--
Elements56have56predetermined56keys56and56fit56perfectly56(perfect)