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;}
l=l+k;
s=s+k;
}
exception are thrown for main method …