Question: Sequential Search For Array Write a java program that store the following array: char x[20]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t'}; Then enter the following to search for : A c
Sequential Search For Array
Write a java program that store the following array:
char x[20]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t'};
Then enter the following to search for :
A
c
by using this code:
int SequentialSearch( int key, int x[]) {
int index;
for( index=0; index<6; index++ ) {
if( x[index]==key )
return index;
}
return 1;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
