algorithms.tutorialhorizon.com

Front and Back Search in an Array | Algorithms

Given an unsorted array of numbers and a number 'x', write a java program to search the number 'x' in the array and return its index else return -1. Example: Int [] a = {3, 6, 9, 1, 2, 10} Int x = 6, Output: 1 x = 2, Output: 4 x = 7, Output: -1