Section6Key 5 - 16. One possibLe public if solution appears...

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: 16. One possibLe public if solution appears below. void rotate ( ) i (front !: null && front.next !: ListNode front; temp front front. next; ListNode current front; | : null- ) (current . next while current current. next; current. next temp; temp. next nu11; nuII) { ) ) I-7. One possibl-e public if solution appears befow. void shift ( ) { (front !: null- && front.next !- nulf) i = front.next; ListNode otherFront front . next front. next. next; : front; Li-stNode currentl : otherFront,' ListNode current2 (currentl.next while !: null) t : currentl.next; currentl (currentl.next if !: nuLl) { : currentl.next; current2.next currentl . next currentl . next . next; : current2.next; current2 i ) current2.next null; currentl.next otherFront; ) ) 18. One possible solution appears below. public void reverse ( ) t ListNode front; current : null; Lj-stNode previous r: nulI) whil-e (current { ListNode nextNode current : previousl current.next prevJ.ous current; current nextNode; ) : previous; front ) . next; ...
View Full Document

Ask a homework question - tutors are online