Connie Le

Connie Le

  • NA
  • 2
  • 505

Reverse linked list

Mar 4 2018 1:44 PM
Hi everyone,
 
Apologies for this painfully simple question, but I just had a question asking to reverse elements in a linked list based on the code that they provided. I have some experience in linked lists, but I am not too familiar with the syntax in C#.
 
Here's the code they provided:
 
public static void Reverse(List input) {
[enter code here]
}
public class List {
public Node Head { get; set;}
}
public class Node {
public object Value { get; set; }
public Node Next { get; set; }
}
 
How would one write code to reverse this particular list? This is not a question for an assignment, but I would like to make sure I understand the concepts correctly. Thank you very much for your time.

Answers (1)