Exercises
-
21.6 (Concatenating Lists) Write a program that concatenates two linked-list objects of characters. Class
ListConcatenate
should include astatic
methodconcatenate
that takes references to both list objects as arguments and concatenates the second list to the first list. -
21.7 (Inserting into an Ordered List) Write a program that inserts 25 random integers from 0 to 100 in order into a linked-list object. For this exercise, you’ll need to modify the
List<E>
class (Fig. 21.3) to maintain an ordered list. Name the new version of the classSortedList
. -
21.8 (Merging Ordered Lists) Modify the
SortedList
class from Exercise 21.7 to include amerge
method that can merge theSortedList
it receives as an argument with theSortedList
that ...
Get Java How To Program, Late Objects, 11th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.