Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sockets-Bita #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

sockets-Bita #28

wants to merge 1 commit into from

Conversation

Bitaman
Copy link

@Bitaman Bitaman commented Apr 30, 2019

No description provided.

Copy link

@CheezItMan CheezItMan left a comment

Choose a reason for hiding this comment

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

You have a good idea here, but a few bugs in your binary search. Take a look at my inline comments and let me know if you have questions.

return true
elsif array[mid] < value_to_find
i = mid + 1
j = array.length - 1

Choose a reason for hiding this comment

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

You are ending up reseting the top value of your search criteria here! This line shouldn't be here!

end
return intersection
else
array = array2.sort

Choose a reason for hiding this comment

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

In this else you're not setting i to zero.

mid = array.length / 2
i = 0
j = array.length - 1
while i < j

Choose a reason for hiding this comment

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

Is this really what you want for the while loop here? What if the array is 1 element in size?

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.

2 participants