partition from programming pearls
        Posted  
        
            by davit-datuashvili
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by davit-datuashvili
        
        
        
        Published on 2010-05-17T13:16:28Z
        Indexed on 
            2010/05/17
            13:20 UTC
        
        
        Read the original article
        Hit count: 221
        
algorithms
hi suppose i have following array int a[]=new int[]{55,41,59,26,53,58,97,93}; i want to partition it around 55 so new array will be such } 41,26,53,55,59,58,93,93}; i have done such kinds of problems myself but this is from programming pearls and here code is like this we have some array[a..b] and given value t we write code following way
  int m=a-1;
  for i=[a..b]
     if ( array[i]<t)
 swap (++m;i);
where swap function exchange two element in array at indexes ++m and i, i have run this program and it showed me mistake Exception java.lang.NullPointerException can anybody help me?
© Stack Overflow or respective owner