Two Laptop Bag
The moose likes Beginning Java and the fly likes Need help to code small programme Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Need help to code small programme " Watch "Need help to code small programme " New topic

Need help to code small programme

Zeeshan Paracha

Joined: Oct 14, 2011
Posts: 1
Good Evening Sir,

Sir for this assignment we have to use hashing technique called (Digit Extraction). we have to store data in an array according to the key created by using (Digit Extraction) hashing method. The collision will occur if the multiple data is been stored in a same index to over come with collision we have to implement (Pseudorandom) Collision method to generate new key and stored the data or that new key/index of array.

formula for Pseudorandom Collision Resolution is (ax + c) = new address .. where (a) and (c) is the constant.
and digit extraction is just extract the key(address) from the data for eg;
if user wanna save data (Student ID = 110011) out of this 6-digit ID we can get any 3 digit like (011).

Below are the requirements.

Choose one hashing technique and one hashing resolution technique to demonstrate hashing technique. You are required to use array of objects with minimum two data field for eg (ID and Name). Your program should include the following options:-

1. Add a new record.
2. Search for a record.
3. List all the records. < together with the location where it is stored>

This program should be written in Java Language, Plat form (Jdk) or Blue J software.

Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

Hello, Zeeshan, welcome to the Ranch! That's an excellent description of your requirements... but it isn't a question. Could I ask you to read through some of our FAQ links here: HowToAskQuestionsOnJavaRanch, so you have a better idea of how to ask a good question? I particularly recommend NotACodeMill and ShowSomeEffort and DoYourOwnHomework.
Winston Gutkowski

Joined: Mar 17, 2011
Posts: 8927

Zeeshan Paracha wrote:Good Evening Sir,...

Very polite, but there's no need to call me sir (unless the Queen's around).

As to your problem (and I agree with Paul: very well described), my advice to you is this:
  • (VERY IMPORTANT) Turn off your computer.
  • Forget about Java for the moment, and write out what you think:
    (a) the problem is.
    (b) the steps to solving it (and be specific).
    And write it in English (or your native language).
  • Test your theory on paper. (NOTE: this may take time, patience, and lots of paper.)

  • When you think you have a solution:

  • Turn your computer back on.
  • Start writing a program that follows the steps you've come up with.

  • At any point in this process, feel free to come back with questions or problems; but make sure to show us what you've already done.


    Bats fly at night, 'cause they aren't we. And if we tried, we'd hit a tree -- Ogden Nash (or should've been).
    Articles by Winston can be found here
    I agree. Here's the link:
    subject: Need help to code small programme
    It's not a secret anymore!