Driver code
int main ( ) { ios_base :: sync_with_stdio ( false ) ; string arr [ ] = { " for " , " geeks " , " " , " " , " " , " " , " ide " , " practice " , " " , " " , " " , " quiz " } ; string x = " geeks " ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; int index = sparseSearch ( arr , x , n ) ; if ( index != -1 ) cout << x << " ▁ found ▁ at ▁ index ▁ " << index << " STRNEWLINE " ; else cout << x << " ▁ not ▁ found STRNEWLINE " ; return 0 ; }