public void reverse(int k) throws Exception{
// Write your code here
int l=0;
int s=k-1;
while(s<this.size){
int left =l;
int right=s;
while(left<right){
Node nl = this.getNodeAt(left);
Node ns = this.getNodeAt(right);
int temp = nl.data;
nl.data=ns.data;
ns.data=temp;
left++;
right--;
}
l=l+k;
s=s+k;
}
}
first i divide list int k elements list then i revese them simultaneously