Section6Problems 3 - that rearranges Write a method split...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
./. Write a method split that rearranges the elements of a list of int.egers so ,/ t.hat al-l- of the negative val-ues appear before aII nonneoar'i rrpq tror example, if you have a variable called list stores t.he following sequence values: [8, 1, -4, l.9, 0, 43, -8, -1, 2] then calL: Iist. split O ; shoul-d rearrange to put negatives first. One possible arrangement would be as follows: l-4, -7, 8, 1, 19, O, 43, 2l It matters onJ-y that appear bef ore the nonn€gatives. So thj-s ic nnlrr ^ne possible soluti-on. Another legal solution would be to rearrange values this way: [-'7, 2, 43, 0, 19, 7, 8] You may not make any assumptions about how many vaLues are in l-ist and you are not allowed to swap data fields or to create any new nodes to solve problem. You must rearrange by rearranging l-inks the list. You also may not use auxiliary structures like arrays, Arrayl.lsts, stacks, queues, etc, solve problem, although you may use recursion, 9. Write a method transferFrom takes a second list as a parameter and that moves values from the second list First
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

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

{[ snackBarMessage ]}

Page1 / 2

Section6Problems 3 - that rearranges Write a method split...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online