Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.50 KB | None | 0 0
  1.  
  2. public class questionOne
  3. {
  4.  
  5.     static int Best(int[]a,int first,int num)
  6.     {  
  7.        
  8.     if(num==0)
  9.         return first;
  10.    
  11.         else
  12.         {
  13.             if((a.length-1)>num)
  14.             {
  15.             int y=a[num];  
  16.             int x=Best(a,first,num-1);
  17.            
  18.             if(x>y)
  19.                 return x;
  20.             else
  21.                 return y;
  22.            
  23.             }
  24.        
  25.             else
  26.             {
  27.             int y=a[num-1];
  28.             int x=Best(a,first,num-1);
  29.            
  30.             if(x>y)
  31.                 return x;
  32.             else
  33.                 return y;
  34.                
  35.             }
  36.            
  37.         }
  38.        
  39.        
  40.     }
  41.    
  42.    
  43.    
  44.    
  45.     public static void main(String[] args)
  46.     {
  47.    
  48.        
  49.  
  50.     }
  51.  
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement