I need to sort list in descending order. How can I do it ? I've got the following class:
class Node
{
public int data;
public Node next;
}
class List
{
public Node head;
}
So the method has to have the following signature
List Sorted(List x)
So that it returns another List containing x's elements, but sorted in descending order. Head must contain the biggest element. How can I implement that ?