Skip to content

Hash-Tables - Scott Bren#159

Open
smbren wants to merge 10 commits into
bloominstituteoftechnology:masterfrom
smbren:master
Open

Hash-Tables - Scott Bren#159
smbren wants to merge 10 commits into
bloominstituteoftechnology:masterfrom
smbren:master

Conversation

@smbren

@smbren smbren commented Feb 27, 2019

Copy link
Copy Markdown

Hash-Tables - Scott Bren
@Tulf


int index = hash(key, (*ht).capacity);

if((*ht).storage[index] != NULL) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice good this will carry over into tomorrows work.

if(strcmp(key, (*current_pair).key) == 0) {

current_pair = (*current_pair).next;
free((*current_pair).value);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're not overwriting the value. You're deleting it. Also You want to do this iteratively since you need to loop over the entire linked list. Try out a for/while loop.
You should set a temp Linkedpair to use with your overwriting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants