array
public class ps16 { public static String substring(String str,int r,int l){ if(str.length()==0){ return str; } // for(i=r;i<=l;i++) System.out.println(substring(str,r,l-1)); System.out.println( substring(str, r+1, l)); return str; } public static void linearsearch(int arr[],int key,int n){ if(n<0) { return ; } linearsearch(arr, key, n-1); if (arr[n]==key) { System.out.println(n); } // System.out.println(); return ; } public static void main(String[] args) { int arr[]={10,20,30,40,20,20}; int key=20; // linearsearch(arr,key,arr.length-1); String str="abac"; System.out.println(str); substring(str,0,str.length()-1); } }
Leave a Comment