I am using C#, and I wanted to sort a linked list without using extra memory.
Input: listptr→ 11 → 8 → 2→ 4 → 5
Output: listptr→ 2 → 4 → 5 → 8 → 11
This is my class:
public class SNode
{
public int data;
public SNode next;
}
Should I create a new temp
variable to store the temp list?
Like SNode temp = new SNode(2,NULL);
?
This is a homework assignment.