Skip to content

sockets-Bita#28

Open
Bitaman wants to merge 1 commit intoAda-C11:masterfrom
Bitaman:master
Open

sockets-Bita#28
Bitaman wants to merge 1 commit intoAda-C11:masterfrom
Bitaman:master

Conversation

@Bitaman
Copy link
Copy Markdown

@Bitaman Bitaman commented Apr 30, 2019

No description provided.

Copy link
Copy Markdown

@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.

Comment thread lib/array_intersection.rb
return true
elsif array[mid] < value_to_find
i = mid + 1
j = array.length - 1
Copy link
Copy Markdown

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!

Comment thread lib/array_intersection.rb
end
return intersection
else
array = array2.sort
Copy link
Copy Markdown

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.

Comment thread lib/array_intersection.rb
mid = array.length / 2
i = 0
j = array.length - 1
while i < j
Copy link
Copy Markdown

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