Loading
Home › Computer Science Help › Hash table using chaining with singly-linked lists for co...
Status: Completed

Hash table using chaining with singly-linked lists for collision resolution (Python)

Date Posted: 01/02/2021
Category: Computer Science
Due Date: 02/02/2021
Instruction
- You must use a Python built-in list (which is an array) for the table. The table array should never change its length after it's initialized. - Each table slot should contain a linked list of Node objects. The Node class is provided in the starter code. If a slot is empty, its value should be None, representing an empty linked list. You must use only the Node class for your linked lists - you may not create a wrapper linked list class. You may not modify the Node class. - Your HashTable class should have these methods: - __init__(n, hash_func): The constructor should take the table size and a hash function as arguments. It should initialize the table as a Python built-in list with n empty slots. The hash function will take two arguments - the key to be hashed and the table size - and will return the hashed value of the key. - get(key): Takes a key as an argument. It should return its associated value in the hash table, or None if it's not in the table. insert(key, value): Takes a key and a value as arguments. It should call hash_func on the key to get its table slot, then insert the key and the value into the linked list at that slot. If the key is already in the table, it should overwrite the value at the existing key. This means that your table shouldn't contain any duplicate keys. You'll need to store the value and the key in the linked list. Otherwise, you won't know which value is associated with which key if a slot contains multiple nodes. - remove(key): Takes a key as an argument. It should remove the Node with that key and return its value. If the key isn't in the table, it should return None. Here's an example of how your HashTable should work: hash_mod = lambda key, n: key % n # simple hash function for testing n = 3 # table size table = HashTable(n, hash_mod) table.insert(0, 'a') # slot 0 table.insert(3, 'b') # slot 0 - collision table.insert(2, 'c') # slot 2 table.insert(0, 'aa') # overwrite previous value for key 0 table.insert(6, 'd') # slot 0 - collision # table now looks something like this # (order of elements in linked lists doesn't matter): # slot 0: (6, 'd') -> (3, 'b') -> (0, 'aa') -> None # slot 1: None # slot 2: (2, 'c') -> None print(table.get(2)) # prints 'c' print(table.remove(0)) # prints 'aa', deletes Node with key 0
Bidders
Respectwriter 5 years, 8 months ago
Rated 9.03 earned 26253.25 around 814 assignments.
I have previously completed similar assignments, and am sure I will timely deliver quality work for you. Please consider my bid.
$25.00
  • {$ item.message_content $}
    {$ item.sender_username $} | {$ item.date_entered $}
 
 
BrazehVick 5 years, 8 months ago
Rated 9.46 earned 8054.16 around 279 assignments.
Hello there, do you need help with assignment? I offer quality, timely, well researched, original and free from plagiarism, essays, Dissertations, Matlab, Statistics, Article Review, Computer Science, FULL ONLINE COURSES and EXAMS, full project work among others at your price. Kindly ping me for a friendly deal. Thanks.
$250.00
  • {$ item.message_content $}
    {$ item.sender_username $} | {$ item.date_entered $}
 
 
kingz 5 years, 8 months ago
Rated 9.4 earned 52183.12 around 1434 assignments.
Hello kindly assign this to me i can guarantee timely and an A grade work
$250.00
  • {$ item.message_content $}
    {$ item.sender_username $} | {$ item.date_entered $}
 
 
truewriter 5 years, 8 months ago
Rated 9.26 earned 20430.87 around 562 assignments.
Greetings buddy! I am a professional writer, trainer, programmer, and editor with over five years of experience. Have my assurance that this assignment will be delivered EVEN BEFORE THE DUE TIME.NO PLAGIARISM AT ALL. I follow instructions as outlined. I never disappoint. You can trust me to provide a well-researched and scholarly assignment to you.
$250.00
  • python professional here
    truewriter | Feb 01, 2021, 20:02 PM
  • {$ item.message_content $}
    {$ item.sender_username $} | {$ item.date_entered $}
 
 
funwriter 5 years, 8 months ago
Rated 9.44 earned 21955.32 around 740 assignments.
Will provide quality work within stipulated time. Kindly, assign. Thanks
$250.00
  • {$ item.message_content $}
    {$ item.sender_username $} | {$ item.date_entered $}
 
 
financeville 5 years, 8 months ago
Rated 9.22 earned 28485.23 around 697 assignments.
hello friend, let me help you with this assignment. I assure you of high quality assignment. I'm ready to start working in it right now. Your assignment is in the safest hands. I'm a professional tutor who takes nothing less than good grade. I follow all the instructions of the student to ensure i provide high quality work.
$50.00
  • {$ item.message_content $}
    {$ item.sender_username $} | {$ item.date_entered $}
 
 
HavardGraduateWriter 5 years, 8 months ago
Rated 9.42 earned 51369.88 around 1959 assignments.
Hi, Hello, I am well conversant with this subject and at a position of delivering the best results on time. Kindly consider my bid and I will not disappoint.
$25.00
  • {$ item.message_content $}
    {$ item.sender_username $} | {$ item.date_entered $}
 
 
smartestwriter 5 years, 8 months ago
Rated 9.54 earned 25983.04 around 898 assignments.
Hello friend, I promise the best. Kindly allow me to help you. Thank you
$225.00
  • {$ item.message_content $}
    {$ item.sender_username $} | {$ item.date_entered $}
 
 
paulk 5 years, 8 months ago
Rated 9.77 earned 9672.34 around 332 assignments.
After reviewing your instructions, I decided to bid confidently that I will deliver. Thanks
$75.00
  • {$ item.message_content $}
    {$ item.sender_username $} | {$ item.date_entered $}
 
 
drjim 5 years, 8 months ago
Rated 9.55 earned 24203.41 around 648 assignments.
Hello! I can work on this task asap. I can also help you with the whole class at a discount!
$65.00
  • I have attached two files. One is the starter file provided in the class. One is what I had so far, which isn't really functioning correctly.
    User_34351 | Feb 01, 2021, 20:05 PM
  • Okay. Thanks
    drjim | Feb 01, 2021, 20:06 PM
  • Let me start working on it.
    drjim | Feb 01, 2021, 20:07 PM
  • Thank you!
    User_34351 | Feb 01, 2021, 20:08 PM
  • Please re-attch the files. I can't see them.
    drjim | Feb 01, 2021, 20:08 PM
  • I've attached multiple times, and it said upload successfully, but I dont seems to see the attached files either. Can you check if you can see the files on your end?
    User_34351 | Feb 01, 2021, 20:29 PM
  • I think it's because I was attaching it with a .py extension and it does not allow me to do so. I will convert it to pdf then attach.
    User_34351 | Feb 01, 2021, 20:41 PM
  • Thank you
    drjim | Feb 02, 2021, 00:55 AM
  • Hey friend. I'm requesting for more time with this task. Atleast an extra 1 day. Thanks
    drjim | Feb 02, 2021, 17:59 PM
  • sure. Just make sure the code works fine.
    User_34351 | Feb 02, 2021, 19:10 PM
  • just one extra day
    User_34351 | Feb 02, 2021, 19:10 PM
  • If you can't finish it please let me know, because it's already late for me.
    User_34351 | Feb 02, 2021, 19:17 PM
  • Hey friend. Thank you so much. I will upload it tomorrow during the day.
    drjim | Feb 02, 2021, 23:56 PM
  • Hey friend. As promised, I'm done and uploaded. Kindly check and release the funds. Thank you
    drjim | Feb 03, 2021, 14:58 PM
  • {$ item.message_content $}
    {$ item.sender_username $} | {$ item.date_entered $}
 
 
drjim 5 years, 8 months ago
Rated 9.55 earned 24203.41 around 648 assignments.
Hello! I can work on this task asap. I can also help you with the whole class at a discount!
$25.00
  • Hey. I was in the middle of changing my bid but it's okay.
    drjim | Feb 01, 2021, 20:05 PM
  • {$ item.message_content $}
    {$ item.sender_username $} | {$ item.date_entered $}
 
 
richwhite 5 years, 8 months ago
Rated 9.35 earned 20716.09 around 553 assignments.
Hello
$300.00
  • {$ item.message_content $}
    {$ item.sender_username $} | {$ item.date_entered $}