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

quick_sort returns incorrect results #705

Closed
brson opened this issue Jul 17, 2011 · 1 comment
Closed

quick_sort returns incorrect results #705

brson opened this issue Jul 17, 2011 · 1 comment

Comments

@brson
Copy link
Contributor

brson commented Jul 17, 2011

std::sort::quick_sort sorts [2, 1, 3] as [1, 3, 2], for both the vec and ivec versions.

fn test_qsort() {
    auto names = ~[mutable 2, 1, 3];

    auto expected = ~[1, 2, 3];

    fn lteq(&int a, &int b) -> bool { int::le(a, b) }
    iqsort(lteq, names);

    auto pairs = ivec::zip(expected, ivec::from_mut(names));
    for (tup(int, int) p in pairs) {
        log_err #fmt("%d %d", p._0, p._1);
        assert p._0 == p._1;
    }
}
@ghost ghost assigned msullivan Jul 18, 2011
@msullivan
Copy link
Contributor

The problem is that if the pivot element winds up at spot zero, we return early, without sorting the right side. Fix incoming.

keeperofdakeys pushed a commit to keeperofdakeys/rust that referenced this issue Dec 12, 2017
Bump to version 0.2.29

Rationale for release: My changes in nix-rust/nix#688 are blocked on getting a libc release out with the missing constant  present.
marysaka pushed a commit to sunriseos/rust that referenced this issue Oct 20, 2019
pdietl pushed a commit to pdietl/rust that referenced this issue Apr 23, 2020
ZuseZ4 pushed a commit to EnzymeAD/rust that referenced this issue Mar 7, 2023
h1467792822 added a commit to h1467792822/rust that referenced this issue Jan 4, 2024
…en symbol names by replacing them with a digest.

Enrich test cases and cover all possible values of new option

update submodule: src/tools/cargo
h1467792822 added a commit to h1467792822/rust that referenced this issue Jan 16, 2024
…ed` to shorten symbol names by replacing them with a digest.

Enrich test cases
h1467792822 added a commit to h1467792822/rust that referenced this issue Jan 16, 2024
…ed` to shorten symbol names by replacing them with a digest.

Enrich test cases
h1467792822 added a commit to h1467792822/rust that referenced this issue Jan 16, 2024
…ed` to shorten symbol names by replacing them with a digest.

Enrich test cases
h1467792822 added a commit to h1467792822/rust that referenced this issue Jan 16, 2024
…ed` to shorten symbol names by replacing them with a digest.

Enrich test cases
h1467792822 added a commit to h1467792822/rust that referenced this issue Jan 22, 2024
…ed` to shorten symbol names by replacing them with a digest.

Enrich test cases
h1467792822 added a commit to h1467792822/rust that referenced this issue Jan 23, 2024
…ed -Z unstable-options` to shorten symbol names by replacing them with a digest.

Enrich test cases
h1467792822 added a commit to h1467792822/rust that referenced this issue Jan 25, 2024
…ed -Z unstable-options` to shorten symbol names by replacing them with a digest.

Enrich test cases
h1467792822 added a commit to h1467792822/rust that referenced this issue Jan 26, 2024
…ed -Z unstable-options` to shorten symbol names by replacing them with a digest.

Enrich test cases
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

No branches or pull requests

2 participants