Program 1 linear and binary search by user choice
Search #include <iostream> using namespace std ; template < class T > void lsearch ( T a , T arr [ 20 ]) { T search , count = 0 ; T n = a ; cout << "Enter the element to be searched" << endl ; cin >> search ; //int abc[5]; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] == search ) { cout << search << " found at location " << ( i + 1 ) << endl ; count ++ ; } /* code */ } if ( count == 0 ) { cout << search << " not found" << endl ; /* code */ } } template < class R > void bsearch ( R b , R abc [ 20 ]) { R search , n , last = 0 , mid , first = 0 ; n = b ; cout << "Enter the element to be searched: " << endl ; cin >> search ; last = n - 1 ; while ( first <= last ) { mid