i think this can be a another way to go
for(int i=0; i<idx; i++)
temp=temp.next;
return temp.data;
please correct me if i am wrong;
i think this can be a another way to go
for(int i=0; i<idx; i++)
temp=temp.next;
return temp.data;
please correct me if i am wrong;