Skip to content

Conversation

itadder
Copy link
Contributor

@itadder itadder commented May 18, 2017

First Commit of a PowerShell version of Binary Search. Please let me how it can be improved.
This is my first attempt to port the algorithms in the book to Powershell. Hope this helps others, I will on the others as I go on in the book in Powershell. Since PowerShell is now open source, and available to others in Linux, mac, and windows it should work cross platform.

First Commit of a powershell version of Bianry Search. Please let me how it can be improved.
@egonSchiele
Copy link
Owner

Hi,
I don't know powershell, but I'm happy to merge this. I did catch an error in the code (added a comment).


while ($low -lt $high) {

$mid = ($low + $high);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be $mid = ($low + $high) / 2;. The code is wrong in the book (it is a known bug).

Instead of $mid = ($low + $high);
I made the change as requested to $mid = ($low + $high) / 2;
@itadder
Copy link
Contributor Author

itadder commented May 19, 2017

I made the change to to reflect $mid = ($low + $high) / 2;.

Copy link
Contributor Author

@itadder itadder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made the change to $mid = ($low + $high) / 2;

@egonSchiele egonSchiele merged commit c5c2563 into egonSchiele:master May 19, 2017
@egonSchiele
Copy link
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants