Skip to content

Added rust version of bogo sort #143

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
Jun 28, 2018

Conversation

Jess3Jane
Copy link
Contributor

No description provided.

true
}

fn bogo_sort(arr : &mut Vec<i32>) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This should take a &mut [i32] instead since you don't need any of the Vec functionality.

}

fn main() {
let mut v = vec!(1,2,3,4,5);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think most everyone uses let mut v = vec![1, 2, 3, 4, 5] instead of the regular parens. Also make sure to have spaces after the commas to conform to the style guide (or you can just run rustfmt)


extern crate rand;

fn shuffle(arr : &mut Vec<i32>) {
Copy link
Contributor

Choose a reason for hiding this comment

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

rand already has a shuffle function, just use that and delete this one

@zsparal
Copy link
Contributor

zsparal commented Jun 28, 2018

You were faster the slice changes than I was with the review :)

Edit: sorry, accidentally pushed the wrong button, didn't mean to close the PR

@zsparal zsparal closed this Jun 28, 2018
@zsparal zsparal reopened this Jun 28, 2018

extern crate rand;

fn shuffle(arr : &mut [i32]) {
Copy link
Contributor

Choose a reason for hiding this comment

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

You still don't really need this function, just use the one that rand provides.

Copy link
Contributor

@zsparal zsparal left a comment

Choose a reason for hiding this comment

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

Thanks for the changes, looks good to me. I'll wait a bit with the merge in case anyone else wants to comment

@Butt4cak3
Copy link
Contributor

@Gustorn Pretty sure you're the only active contributor who knows Rust well enough.

@zsparal
Copy link
Contributor

zsparal commented Jun 28, 2018

Fair enough

@zsparal zsparal merged commit 548a33c into algorithm-archivists:master Jun 28, 2018
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.

3 participants