{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Section6Problems 3

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

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

./. 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 of the nonneoar'i rrpq tror example, if you have a variable called list that stores t.he following sequence of values: [8, 1, -4, l.9, 0, 43, -8, -1, 2] then the calL: Iist. split O ; shoul-d rearrange the list to put the negatives first. One possible arrangement would be as follows: l-4, -8, -7, 8, 1, 19, O, 43, 2l It matters onJ-y that the negatives appear bef ore the nonn€gatives. So thj-s ic nnlrr ^ne possible soluti-on. Another legal solution would be to rearrange the values this way: [-'7, -8, -4, 2, 43, 0, 19, 7, 8] You may not make any assumptions about how many vaLues are in the l-ist and you are not allowed to swap data fields or to create any new nodes to solve this problem. You must rearrange the list by rearranging the l-inks of the list. You also may not use auxiliary structures like arrays, Arrayl.lsts, stacks, queues, etc, to solve this problem, although you may use recursion, 9. Write a method

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

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

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern