Skip to content

Problem in QuickSort function #14

@zxrobin01

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

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