id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

simona1@sfusd.edu searching > binarySearchList
prev  |  next  |  chance

Returns the index of the target value in a sorted ArrayList using binary search. Returns -1 if the target value is not in the ArrayList. The ArrayList will have a size >= 1 and does not contain any duplicate values.


binarySearchList([1, 3, 5, 7], 7) → 3
binarySearchList([1, 3, 5, 7], 1) → 0
binarySearchList([1, 3, 5, 7], 2) → -1

...Save, Compile, Run (ctrl-enter)

public int binarySearchList(ArrayList <Integer> list, int target){ }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 330

Copyright Nick Parlante 2017 - privacy