Docsity

Midterm Review for Data Structures Programming Methods | COMPSCI 061BL, Study notes of Computer Science

Toggle sidebar
bg1
1

  


 
  !
" #$ !
% !
& '
 '
( #$)*$
 "

''!!+$'
,-
.'/. 012
3/012
.'/32
')01 2
-.4-$
 %

''!!+$'
,
3/32
3)012
/'2
00.11)%012
-.4-$
-.4.-'5
 &

''!!+
/32
0011'012
$!/32
00.11)%012
-$
--$


6'37,0
',0114'3
!48'
3!
69':4'
)9:'
43
'
pf3
pf4

Partial preview of the text

Download Midterm Review for Data Structures Programming Methods | COMPSCI 061BL and more Study notes Computer Science in PDF only on Docsity!

    

    "

. '/ . 012  3/  012

. '/3 2 ')  - . 4  - $

    %

 3/3 2 3 )

 /' 2 00. 11)%

 - . 4  - $

 - . 4 . -  ' 5

    &

 /3 2 00 11' 012

$ !/3 2 00. 11)%

 -  $

 -  - $     

    (

    @

   '    ' $,  ' -  <= /  <"= 2  <=/  <>= 2  <=<=?/  <"=<= 2



?

    A

?<=/?<= 2

    >

  , ' 3  !      ' -

?<=/?<= 2

?

    

BCD E  4     

 $   $ '  CB

!$ 3 E   0E  1F

G

H

    

public IntList reverse(IntList l) { IntList prev = null; IntList next = l.tail; while (l != null) { next = l.tail; l.tail = prev; prev = l; l = next; } return prev; //once we are done reversing all the pointers //we need to set l's head to the new head }

    A

  , ,8M'

 M0011/F,01- '  !     > $' '

L/,01L/01,N/>   , ,8M   Ω0011/F,01- '  !     >$' ' L/01L/,01,N/>

    >

 M  '  )M0 14 '' 

)M0011I' M0011 ' 

 I$ ,+

    

 '  '  $  08M' 4  8 M  4 8I' 1, ' +

,0 /)2L?2OO1F ,0 7 />27L?27OO1F BB 01 ' H H  -  0?8)10?10     

 E,$   ' ' 4 P $ '  '  ' 3     

Q K ;  J ' !  'J ' !$ 3 

 ,  ! ";  P,   

    "