Skip to content
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

Added Binary Search Tree [Go] #533

Merged
merged 8 commits into from
Oct 17, 2017
Merged

Added Binary Search Tree [Go] #533

merged 8 commits into from
Oct 17, 2017

Conversation

praffn
Copy link
Contributor

@praffn praffn commented Oct 12, 2017

Fixes #527

By submitting this pull request I confirm I've read and complied with the below declarations.

  • I have read the Contribution guidelines and I am confident that my PR reflects them.
  • I have followed the coding guidelines for this project.
  • My code follows the skeleton code structure.
  • This pull request has a descriptive title. For example, Added {Algorithm/DS name} [{Language}], not Update README.md or Added new code.
  • This pull request will be closed if I fail to update it even once in a continuous time span of 7 days.

@singhpratyush
Copy link
Member

Hi! Thanks for showing interest in contributing to this repository.

Please make sure that you have ticked the points mentioned in PR description correctly.

Thanks again!

Copy link
Member

@mohitkyadav mohitkyadav left a comment

Choose a reason for hiding this comment

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

Make a new entry in README.

@praffn
Copy link
Contributor Author

praffn commented Oct 13, 2017

I've added it to the readme

if ok {
fmt.Println("This shouldn't happen, since key should have been deleted")
} else {
fmt.Println("12 was not found :)")
Copy link
Member

@mohitkyadav mohitkyadav Oct 13, 2017

Choose a reason for hiding this comment

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

Why it's "12 was not found". Use a variable if you want to use it more than once. Avoid hardcoding.

}

// Delet a key
bst.Delete(12)
Copy link
Member

@mohitkyadav mohitkyadav Oct 13, 2017

Choose a reason for hiding this comment

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

Please implement error handling for this function, it falls into a run time error if passed a non existing key.

// Searching for a key. Should return value and whether key was found or not
value, ok := bst.Search(12)
if ok {
fmt.Printf("Key 12 was found! It's value is %d\n", value)
Copy link
Member

Choose a reason for hiding this comment

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

Don't hardcode 12.

Copy link
Member

@mohitkyadav mohitkyadav left a comment

Choose a reason for hiding this comment

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

👍

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

Successfully merging this pull request may close these issues.

Binary Search Tree [Go]
5 participants