lab2 - COMPSCI 342-001 Data Structure and Algorithms(Fall...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
COMPSCI 342-001 Data Structure and Algorithms (Fall 2011) Lab Assignment #2, Due on 10/17/2011, Monday (11PM) Introduction: Suppose we are inserting n keys into a hash table of size m . Then the load factor α is defined to be n/m . For open addressing n m , which implies that 0 α 1. In this assignment we will study how the load factor affects the average number of probes required by open addressing while using linear probing and double hashing. Design: Set up the hash table to be an array of HashObject. A HashObject contains a generic object and a frequency count. The HashObject needs to implement Comparable inter- face, it should override the toString method and should also have a getKey method. Also we will use linear probing as well as double hashing. So design the HashTable class by passing in an indicator via constructor so that the appropriate kind of probing will be performed. Choose a value of the table size m to be a prime in the range [95500 . . . 96000]. A good value is to use a prime that is 2 away from another prime. That is, both m and m - 2 are primes. Vary the load factor α as 0.5, 0.6, 0.7, 0.8, 0.9, 0.95, 0.98, 0.99 by setting the value of n appropriately, that is, n = αm . Keep track of the average number of
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern