partition from programming pearls
- by davit-datuashvili
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?