Skip to content

wiggle sort seems incorrect #988

Closed

Description

@BranAndSceolan

Hello!
From the comments on the wiggle sort code I got that it is intended to sort an array arr like this:
a[0] <= a[1] >= a[2] <= a[3] >= a[4] <=...

I tested the code using an array [3, 5, 6, 1].
I got [3, 6, 5, 1], which is not fulfilling the condition stated above.

There are possible solutions for this case, for example [3, 5, 1, 6].

If this is an error I would like to try and fix it. If it is not, please reply, so I might learn what I misinterpreted.

Activity

  1. appgurueu commented on Apr 20, 2022

    @appgurueu
    Collaborator

    You're right, this is a bug. Feel free to fix it.

  2. BranAndSceolan commented on Apr 20, 2022

    @BranAndSceolan
    ContributorAuthor

    I am already working on a wriggle sort in java, therefore I would be happy to be assigned to this issue too.

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

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions