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

 

simona1@sfusd.edu > recursiveBinarySearch
prev  |  next  |  chance

Returns the index of the target value in a sorted array using recursive binary search (no loops!). Returns -1 if the target value is not in the array. The array will have a length >= 1 and does not contain any duplicate values.


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

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

public int recursiveBinarySearch(int [] a, int target, int low, int high){ }

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: 340 Post-solution available

Copyright Nick Parlante 2017 - privacy