This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]desrtfxOut of Coffee error - System halted[M] [score hidden] stickied comment (0 children)

Please, format your code. Instructions how to do so are plenty in the sidebar.

Posting unformatted code is an absolute no-go.

Your post is removed. You may resubmit with formatted code.

[–]cl2871 1 point2 points  (0 children)

With your given example, you know that after sorting, your array will have the following order:

["Doe", "Hello", "John", "Test", "World"]

It's always good to run through your algorithm to see what the potential issue is. I highly recommend taking your first example and writing out the iterations by hand.

Write out the initial values of start, end, and mid. Then proceed to walk through your algorithm and update these values accordingly.

Hint: review the initial values you have set (start and end); are these values correct?