js-code-to-svg-flowchart icon indicating copy to clipboard operation
js-code-to-svg-flowchart copied to clipboard

Small issues with the sample (binary search)

Open fabian20ro opened this issue 7 years ago • 3 comments

First issue is a typo of the algorithm. The line currentIndex = Math.floor((maxIndex + maxIndex) / 2); should be with min instead of max: currentIndex = Math.floor((minIndex + maxIndex) / 2);

Second issue is that the arrow that returns into the while comes from the true branch of the last if statement instead of coming from both branches. It's an obvious mistake for an experienced developer, but it is weird for someone who is learning how to write programs.

fabian20ro avatar Dec 27 '17 15:12 fabian20ro

Sorry I can't understand. It's mean someone spy hacking me???

Yongjin0919 avatar Feb 15 '18 15:02 Yongjin0919

First issue is here https://github.com/Bogdan-Lyashenko/js-code-to-svg-flowchart/blob/685509f11e4a736ae31cb6506d92ab13207b09a8/docs/live-editor/index.html#L86 Definitely looks like a typo.

Second Issue

the arrow that returns into the while

@fabian20ro Do you mean this Less-Equal comparator? https://github.com/Bogdan-Lyashenko/js-code-to-svg-flowchart/blob/685509f11e4a736ae31cb6506d92ab13207b09a8/docs/live-editor/index.html#L85 I do not see any issue here, can you elaborate?

wtho avatar Nov 27 '18 12:11 wtho

@wtho hehe, funny stuff ;) yeah, minIndex + maxIndex obviously

Bogdan-Lyashenko avatar Nov 27 '18 12:11 Bogdan-Lyashenko