-
Notifications
You must be signed in to change notification settings - Fork 49
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
Leaves - Cloudy #47
base: master
Are you sure you want to change the base?
Leaves - Cloudy #47
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for submitting this Cloudy. Definitely some work to do here. You were on the right track with all the methods, but they're not quite working.
Suggestion: Skip all the tests but those for 1 method. Then work on that one method to the exclusion of the others until it works, then move to the next. That might help a bit.
high = array.length - 1 | ||
while low <= high | ||
mid = (low + high)/2 | ||
if (array[mid] > value_to_find |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You haven't closed a parentheses
if (array[mid] > value_to_find | |
if (array[mid] > value_to_find) |
puts "#{array[i]}" | ||
i += 1 | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing end
end |
temp = array[min_index] | ||
array[min_index] = array[index] | ||
array[index] = temp | ||
else i += 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Your indentation needs work. Maybe try using the Rufo extension to help with code formatting.
- You are missing an end
- The
.times
loop will incrementi
so you don't need to do that - You should return
false
if you reach the end of the loop and don't find the item you are searching for.
if array[i] > largest | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's bigger... then what?
index += 1 | ||
if array[i] > largest | ||
end | ||
return largest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing an end
return largest | |
end | |
return largest |
end | ||
|
||
if array[low] == value_to_find | ||
return low |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method is stated above to return true if it find the element.
return low | |
return true |
return low | ||
end | ||
|
||
return nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method should return true or false
return nil | |
return false |
top = array[high] | ||
bottom = array[low] | ||
array[high] = bottom | ||
arry[low] = top |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean array
?
smallest = array[i] | ||
while i - 1 > length && | ||
array[i - 1] != kaboom | ||
index += 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are using i
instead of index
in this method. Also this should be at the end of the loop.
while i - 1 > length && | ||
array[i - 1] != kaboom |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two things:
- kaboom?
- Shouldn't this just be
while i < length
No description provided.