Section6Key 1 - Sol-ution 1 . One possible public if to...

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: Sol-ution 1 . One possible public if to CSE143 Section below. #6 problems solut j-on appears int min ( ) t (front nut-l) throw new IllegalstateException else I int min = front.data; ListNode current front. next; r: nul-1) { whil-e (current (current. data if min = current.data; current current. next; l return min; ) O rx ) 2. One possible public if solution appears below. boolean hasTwoConsecutive ( ) { (f ront null- | | f ront. next =: nul_l-) return false; ListNode current front; whi 1e (current . next ! = nul l-) { (current. data + 1 :: if current. next. data) return true i : current.next; current I return ) 3. One possibl-e false; sol_ution appears below. pubJ_ic boolean isSorted O { r: null-) { (front if = front; ListNode current whil-e (current.next !: nu11) (current.data if return false; current current. next; ) ) return true; 4. One possible { solution appears below. public int t-astfndexOf (int n) { j-nt resul-t -L; : 0; int index : this.front; ListNode current (current while !: null) { (current. data if n) { resu.l_L: index; ) inQex++; current current. next; l_ return resu.l_t; ...
View Full Document

Ask a homework question - tutors are online