Skip to content

floating point issue. #5

@3mrotaha

Description

@3mrotaha

I am not sure if it happened to anyone else but the code didn't go as expected on my IDE, the third test case by which I mean (the middle pivot) has a wrong answer for the number of comparisons.
the issue simply is that the function that maps the flag into an index is giving me a floating index which causes a run time error, so I had to convert the answer to an integer value. (denoted by yellow)

the second issue is that the condition in the function that returns the pivot (ChoosePivot) value needs to convert the division result (n/2) to an integer so that the condition goes the right way. (denoted by red)

image

after I edited it, I got the correct answer.
BTW, I am not a python coder but I am happy to help.
Screenshot 2022-11-09 123704

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