Skip to content

Problem in QuickSort function #14

Description

@zxrobin01

Their is a mistake in QuickSort function.
You should store the key in the middle to some variable, and compare all key values to the variable but not the key in the arrKeys. The problem will cause dictionary not sort as you expect. And also, you can remove the equal from the comparison to reduce useless swap of keys and values.
Do While newLB < ub
If arrKeys(newLB) >= arrKeys(p) Then Exit Do
newLB = newLB + 1
Loop
Do While newUB > lb
If arrKeys(p) >= arrKeys(newUB) Then Exit Do
newUB = newUB - 1
Loop

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions