Question: Please use skeleton code for .cpp and .h Given a sorted array of String and a String x, find index of x if it is

Please use skeleton code for .cpp and .h

Given a sorted array of String and a String x, find index of x if it is present in the array using binary search. Input : arr[] -{ "contribute", "9eeks", "ide", "practice"}, x-"ide" Output 2 The String x is present at index 2. Input : arr [] = { "contribute", "geeks", "ide", "practice"}, x = "zz" Output 1 The String "zz" is not present. 11 lines (8 sloc) 184 Bytes 1 # include "problem2.h" 3 // Returns index of x if it is present in arr[l, 0) else return -1 5 int binarySearch (char* arrll, char* x, int n) //your code here return -1; 10 5 lines (4 sloc) 88 Bytes 1 #ifndef PROBLEM2 2 #define PROBLEM2 3 int binarySearch (char* arrl, char* x, int n); 4 #endif
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
