Skip to content

lib_enum.ks allows the partition indices to walk off the ends in the quicksort routine #140

@mgalyean

Description

@mgalyean

I'm not sure what conditions lead to the i and j indices walking off the ends, but they do sometimes, seemingly randomly but probably not really.
I altered my local copy at line 102 in the sort fn from:
if lo<hi{local p is pt(A, lo, hi). qs(A, lo, p). qs(A, p + 1, hi).}}
to:
if (lo>0 AND hi<A:LENGTH-1) AND lo<hi{local p is pt(A, lo, hi). qs(A, lo, p). qs(A, p + 1, hi).}}
and the issue went away for me. But there is probably a more robust solution

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions