Question: (c) On the RUKindergarten assignment there are two linked lists of SNode: . studentsInLine: a singly linked list . musicalChairs: a circular linked list public

 (c) On the RUKindergarten assignment there are two linked lists of

(c) On the RUKindergarten assignment there are two linked lists of SNode: . studentsInLine: a singly linked list . musicalChairs: a circular linked list public class SNode { public Student student; // the data part of the node public SNode next; // a link to the next student int the linked list public SNode ( Student s, SNode n ) { student = s; next = n; For this question assume that classroom contains the following methods. public class Classroom { private SNode studentsInLine; // reference to the FIRST student in the LL private SNode musicalChairs; // reference to the LAST student in the CLL // Removes and returns the first student in studentsInLine public Student removeFirstStudentFromLine () {} // inserts the argument Student as the last student in musicalChairs public void insertStudentIntoLastChair (Student s) {} public void moveStudentsFromLineIntoChairs () { while ( studentsInLine != null ) { Student s = removeFirstStudentFromLine () ; insertStudent IntoLastChair (s) ; Implement the method insertStudentsIntoLastChair, the method can be used in other methods besides moveStudentsFromLineIntoChairs. public void insertStudentIntoLastChair (Student s) { SNode oldLast = musicalChairs; SNode musicalChairs = SNode (s, null); , if ( oldLast = null ) { // list is empty musicalChairs.next = musicalChairs;, } else { musicalChairs.next = oldLast. next: . oldLast. next = musicalChairs

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 Programming Questions!