Section6Key 3 - , /. O n e p o s s i b l e public if solut...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: , /. O n e p o s s i b l e public if solut i-on appears below . other) { void transferFrom(Linkedlntlist :: (front nul-l) front other. front; else { ListNode current front; whil-e (current . next !- nuII ) : current.next; current current. next other. front; ) = nul1; other.front ) lO. One possible public if sol-ution appears below. int deleteBack ( ) { (front nul_I) throw new IllegalStateException ( "empty : 0; int result (front.next if null) { result front. data; front nuLl; ) else { ListNode current front i (current.next.next while | : null-) current current. next; result current. next . data; current . next nul-l-; ) return result; l _i s t " ) ; ) 11. One possible solution appears below. public void removeA-l-l (int value) { r: null := value) whi-l-e (f ront && front.data front front. next; r: nu-l-1) { (front if : front; ListNode current (current.next while !: nuII) :: value) (current.next.data if current . next : current . next . next ; eI se currenE current. next; l i L2. One possible sol-ution appears bel-ow. { null-) public boolean equals (Linkedlntlist other) : front; ListNode currentl : other.front; ListNode current2 (currentl while !: nul1 && current2 !: r: current2.data) (currentl.data if return fal-se; : Currentl.next; currentl { curre5r_!-2 : currentl c uq5ent=2. 4ext i ::-**II && curre*tT:: nsf }'r- return ...
View Full Document

This note was uploaded on 11/03/2009 for the course CSE 143 taught by Professor Sr during the Spring '08 term at University of Washington.

Ask a homework question - tutors are online