1
CSE326:DataStructures Lecture#12
BartNiswonger SummerQuarter2001
Today’sOutline
- UnixTutorial
– Whatdoyouwantcovered?
- Midterm
CSE326:DataStructures Lecture#12 BartNiswonger SummerQuarter2001 - - PDF document
CSE326:DataStructures Lecture#12 BartNiswonger SummerQuarter2001 TodaysOutline UnixTutorial Whatdoyouwantcovered? Midterm Amortizedtime ADTvsDataStructure 1
– create – destroy – insert – find – delete
– values maybeany(homogenous)type – keys maybeany(homogenous)comparabletype
– spicycabbage
– tastydoughnut
– Australianfruit
– leafygreen
– breakfastcereal
insert find(kiwi)
– result:canquicklyfind therightspotforagiven entry
– result:cannotefficiently listallentries, – Cannotfindminandmax efficiently, – Cannotfindallitems withinaspecifiedrange efficiently.
Kiwi Kimchi Kale Kohlrabi Kumquat
tableSize
Value&find(Key&key){ intindex=hash(key) %tableSize; returnTable[index]; }
3 2 1 6 5 4
int hash(Strings){ h=0; for(i=s.length()- 1;i>=0;i--){ h=(si +128*h)%tableSize; } returnh; }
low
functionandre-hashthepreviousinputs
r i i i