Question: please help me!!! c# language Question 8 17 pts Add code to the following page so that the SortFirstTwoNodes method will rearrange the first two

please help me!!! c# language

please help me!!! c# language Question 8 17 pts Add code to

Question 8 17 pts Add code to the following page so that the SortFirstTwoNodes method will rearrange the first two node objects in a linked list so that the smaller value is first and the larger value is second. If the first node is already smaller than the second node then this method should do nothing. Note that this method must rearrange the node objects themselves changing the values that the nodes contain while leaving the nodes in the same order will result in zero points. If there are fewer than 2 nodes your method should do nothing. Your method should never crash. Here is one particular example (but keep in mind that your method should work on any list, as described above). If the list starts out looking like this: Tocal variables Linked List object myFirstList first Then calling myFirstList.SortFirstTwoNodes() should change the list so that it looks like this: Linked List Node object Linked List Node object Linked List Node object key 2 key 1 key 3 next next next null local variables Linked List object myFirstList first Linked List Node object Linked Lis Node object Linked List Node object key 2 key key 3 next next next null Note: You must write this all yourself (you are not allowed to call methods like AddToFront/RemoveFromFront unless you re-create them here, yourself. Please feel free to copy and past this starter code into your answer, and finish the code yourself: class LL { private LinkedListNode first; // you can assume that there are // public 'key' and public 'next' instance variables, as the above // pictures imply. public void SortFirstTwoNodes { } }

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!