Skip to content

Hashing implementation with collision resolution using chaining #92

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 19, 2018

Conversation

vasutomar
Copy link
Contributor

Relates to Issue #24

Copy link
Collaborator

@christianbender christianbender left a comment

Choose a reason for hiding this comment

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

Good Work! I have some requests.

cout<<"5. Exit."<<endl;
cin>>c;
switch(c){
case 1:{
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove the curly braces by the case branches.

cout<<"Element not found";
return;
}
while(1){
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead you can write

while(temp->data != x && temp->next) 
        temp=temp->next;

#include<iostream>
#include<math.h>
using namespace std;
struct node{
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please use upper case.

}

void add(int x,int h){
struct node *temp = new node;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of node write Node

struct node *temp;
int i;
for(i=0;i<mod;i++){
if(head[i]==NULL){
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of if(head[i]==NULL){ write if(head[i]) {

#include<iostream>
#include<math.h>
using namespace std;
struct node{
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please leave a space between the curly brace and node.

@@ -0,0 +1,132 @@
#include<iostream>
#include<math.h>
using namespace std;
Copy link
Collaborator

Choose a reason for hiding this comment

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

After this line write a empty line.

int c,x,mod;
cout<<"Enter the size of Hash Table. = ";
cin>>mod;
while(1){
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of while(1){ write while(loop) . For a boolean variable loop. Then you write bool loop = true;

case 4:{
display(mod);
}
default:{
Copy link
Collaborator

Choose a reason for hiding this comment

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

For the case 5 you turn of the loop flag loop = false

break;
}
}
if(c>4)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Avoid this if . see my comment above.

@christianbender christianbender added the on hold Pull request is temporarily not reviewed label Apr 17, 2018
@vasutomar
Copy link
Contributor Author

Thanks for reviewing my pull request @christianbender :)
I will make the required changes.

@vasutomar
Copy link
Contributor Author

Hello @christianbender,
I have made the necessary changes in the file as requested, can you please review it again to see if any other changes are required or not? Thanks!.

@christianbender christianbender merged commit f949083 into TheAlgorithms:master Apr 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
on hold Pull request is temporarily not reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants