CodeSolved

Solved Programming Questions & Exercises

Binary search algorithm implementation

Practice Hard 1637/ Download 32 Views New

Write a program that takes an array of integers and a number as an input and the position (index) finds that number with the help of a binary search algorithm in the array. If there was no number in the array, it will show a good message.


Input sample:

List numbers:
1 3 5 7 11 11 13 15
The desired number:
7


Output sample:

. The number 7 is in position (index) 3

1 Answers

This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.

Submit answer

Submitting answers is currently unavailable.

×
×
Close