public SLL joinLists(SLL in) { //SLL<e> res = new SLL<e>(); SLLNode<e> tmp1=this.getFirst(); SLLNode<e> tmp2= in.getFirst(); while(tmp1.succ!=null && tmp2.succ!=null){ tmp1 = tmp1.succ; this.insertAfter(tmp2.element,tmp1); tmp1=tmp1.succ; if(tmp2.succ!=null){ tmp2 = tmp2.succ; this.insertAfter(tmp2.element,tmp1); tmp1=tmp1.succ; } if(tmp1.succ!=null) tmp1=tmp1.succ; } while(tmp2!=null){ this.insertAfter(tmp2.element,tmp1); tmp1=tmp1.succ; } return this; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)