Question: Note: you must use ONLY the LinearNode file defined in the textbook. You may create/use ONLY the linked lists described below in the solution of

Note: you must use ONLY the LinearNode file defined in the textbook. You may create/use ONLY the linked lists described below in the solution of this problem (no arrays, etc allowed)

Seminar Activity

At the beginning of the seminar I will do this problem with you:

  • create a LinearNode reference variable called reverse, which will be a pointer to the first node in a linked list of LinearNode objects
  • use a random number generator to add 10 numbers between 1 and 100 inclusive to reverse
  • add the numbers so that the first number is at the end of the list
  • after each number is placed in list write out the entire contents of list to verify that list has the numbers in reverse order

Your assignment is as follows:

  • create 2 LinearNode reference variables called list and sortedList, which will be pointers to the first node in 2 linked lists of LinearNode objects
  • you will need other LinearNode reference variables (you figure out which ones)
  • use a random number generator to add (the same) 10 numbers between 1 and 100 inclusive to list and sortedList
  • for list - add the numbers so that the first number is at the beginning of the list, the second number is second in the list, the last number generated is at the end of the list
  • for sortedList - you must add the numbers so that the numbers in the list are always sorted from lowest at the beginning to highest at the end
  • after each number is placed in the 2 lists write out the entire contents of each list to verify that each list is correct

For example, heres what the output of sortedList might look like:

sortedList contents: 50

sortedList contents: 50 70

sortedList contents: 30 50 70 (numbers should always be sorted

etc until 10 numbers have been added to sortedList

#Java should be used for the language. and i need it asap. thank you

don't have either of them

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!