public void reverse(int k,int N)throws Exception
{
for(int i=0;i<N;i=i+k)
{
int l=i;
int h=k+i-1;
Node low=getNodeAt(i);;
Node high=getNodeAt(h);
while(l<h)
{
int temp=getAt(l);
low.data=high.data;
high.data=temp;
l++;
h–;
low=low.next;
high=getNodeAt(h-1);
}
}