su11-df-e3 - ECE 3035 5 problems 8 pages Computing Mechanisms Exam Three Summer 2011 Instructions This is a closed book closed note exam Calculators are

# su11-df-e3 - ECE 3035 5 problems 8 pages Computing...

This preview shows page 1 - 4 out of 8 pages.

ECE 3035 Computing Mechanisms Summer 2011 5 problems, 8 pages Exam Three 07/21/11 Instructions: This is a closed book, closed note exam. Calculators are not permitted. If you have a question, raise your hand and I will come to you. Please work the exam in pencil and do not separate the pages of the exam. For maximum credit, show your work. Good Luck! Your Name ( please print ) ________________________________________________ 1 2 3 4 5 a b c d e f g total 17 16 35 13 19 100 1
ECE 3035 Computing Mechanisms Summer 2011 5 problems, 8 pages Exam Three 07/21/11 Problem 1 (1 part, 17 points) Hash Tables Consider an open hash table composed of a four-bucket table, with each bucket containing a variable length list. Each list entry has three slots <key, value, next> corresponding to the three word groupings in the entries section. The hash function is key mod four . Inserted entries are appended to the end of a bucket list. Deallocated entries are maintained on a LIFO free list. When the free list is empty, new entry objects are allocated from heap memory. Accesses are listed as <op, key, [value]>. Simulate the access list below and draw the ending state. Assume the hash table is initially empty, the heap pointer is initially 5016 and the free pointer is initially 0. Heap Pointer 5016 Free List 0000 Buckets 5000 5004 5008 5012 Entries 5016 5040 5064 5088 5020 5044 5068 5092 5024 5048 5072 5096 5028 5052 5076 5100 5032 5056 5080 5104 5036 5060 5084 5108 Hash Table Access Trace # op key value # op key value 1 insert 4002 111 5 remove 4002 n/a 2 insert 4005 222 6 remove 4009 n/a 3 insert 4006 333 7 insert 4007 555 4 insert 4009 444 8 insert 4006 666 2
ECE 3035 Computing Mechanisms Summer 2011 5 problems, 8 pages Exam Three 07/21/11 Problem 2 (3 parts, 16 points) Associative Sets Part A (6 points) Consider a hash table that uses 20 buckets , each containing an unsorted LIFO list of items. Inserted entries are appended to the end of the bucket list. Suppose the hash table contains 220 entries total and the entries are evenly distributed across the hash table buckets. Assume that computing the hash function takes an average of two operations and comparing two keys takes an average of ten operations . Ignore effects of spatial and temporal reference locality. Suppose that 80% of keys looked up are found in the hash table and 20% are not found.

#### You've reached the end of your free preview.

Want to read all 8 pages?

• Fall '08
• Staff
• free list, Insert key, Heap Management, pages Problem