After our lecture on hashing, you find yourself really excited about hashing with chaining. Your frien on the other hand thinks that hashing with open addressing is a very neat idea to handle collision So you design a hash table Tc (meaning Table with Chains) which uses chaining to resolve collision Each chain in Tc is a doubly-linked list where insertions are done at the front of the list. Your frien designs a hash table Tp (meaning Table with Probing) which handles collisions using linear probin When deleting items from Tp, the item deleted is replaced with the special "tombstone" marker. F poth tables, you use the same hash function and Tc and Tp have the same number of buckets whic s much larger than the number of items vou wish to hash. Then the two of vou go to a third frien

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

I am having a hard time finding the right approach for the question. I need a justified answer. Could you please help me through?

After our lecture on hashing, you find yourself really excited about hashing with chaining. Your friend
on the other hand thinks that hashing with open addressing is a very neat idea to handle collisions.
So you design a hash table Tc (meaning Table with Chains) which uses chaining to resolve collisions.
Each chain in Tc is a doubly-linked list where insertions are done at the front of the list. Your friend
designs a hash table Tp (meaning Table with Probing) which handles collisions using linear probing.
When deleting items from Tp, the item deleted is replaced with the special "tombstone" marker. For
both tables, you use the same hash function and Tc and Tp have the same umber of buckets which
is much larger than the number of items you wish to hash. Then the two of you go to a third friend
(who now works at a big tech company) to help you decide which is better. She asks you the following
questions which you must answer as your submission for this problem.
(a) If you perform a sequence S of Insert and Delete operations on your tables, which table is
going to require fewer comparisons? Assume that S is comprised of a sequence of n operations
O1, 02, O3, ..., On where 1 < i< n. n is smaller than the number of buckets. Use Kci to refer to
the number of item comparisons made when performing O; on Tc. Similarly, use KP; to refer
to the number of item comparisons made when performing (the same) O; on Tp. For 1 <i<n,
consider the following question: is Kci < Kpi or Kci 2 Kp;? Show your work and explain
your answer with sufficient details. For this question, assume that the parameter to the Delete
operation is a pointer to the item to be deleted.
(b) Suppose that you perform the sequence S (from part a) on both Tc and Tp followed by a
Search operation (where each item in the table is equally likely to be searched for). Let E1
be the expected number of item comparisons made when performing the Search operation on
Tc, and let E2 be the expected number of item comparisons made when performing the Search
operation on Tp. Is E1 < E2 or E1 > E2? Carefully show your work and explain your answer.
Note that citing expected runtimes from lecture is not a sufficient solution.
Transcribed Image Text:After our lecture on hashing, you find yourself really excited about hashing with chaining. Your friend on the other hand thinks that hashing with open addressing is a very neat idea to handle collisions. So you design a hash table Tc (meaning Table with Chains) which uses chaining to resolve collisions. Each chain in Tc is a doubly-linked list where insertions are done at the front of the list. Your friend designs a hash table Tp (meaning Table with Probing) which handles collisions using linear probing. When deleting items from Tp, the item deleted is replaced with the special "tombstone" marker. For both tables, you use the same hash function and Tc and Tp have the same umber of buckets which is much larger than the number of items you wish to hash. Then the two of you go to a third friend (who now works at a big tech company) to help you decide which is better. She asks you the following questions which you must answer as your submission for this problem. (a) If you perform a sequence S of Insert and Delete operations on your tables, which table is going to require fewer comparisons? Assume that S is comprised of a sequence of n operations O1, 02, O3, ..., On where 1 < i< n. n is smaller than the number of buckets. Use Kci to refer to the number of item comparisons made when performing O; on Tc. Similarly, use KP; to refer to the number of item comparisons made when performing (the same) O; on Tp. For 1 <i<n, consider the following question: is Kci < Kpi or Kci 2 Kp;? Show your work and explain your answer with sufficient details. For this question, assume that the parameter to the Delete operation is a pointer to the item to be deleted. (b) Suppose that you perform the sequence S (from part a) on both Tc and Tp followed by a Search operation (where each item in the table is equally likely to be searched for). Let E1 be the expected number of item comparisons made when performing the Search operation on Tc, and let E2 be the expected number of item comparisons made when performing the Search operation on Tp. Is E1 < E2 or E1 > E2? Carefully show your work and explain your answer. Note that citing expected runtimes from lecture is not a sufficient solution.
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY