public void InsertIntoList(int index, char value) { Node current = head; for (int i = 0; i < index - 1; i++) { current = current.Next; } Node newNode = new Node(); newNode.Next = current.Next; newNode.Data = value; current.Next = newNode; }
public void addNode(char data) { if (head == null) { head = new Node(); head.Data = data; } else { Node toAdd = new Node(); toAdd.Data = data; Node current = head; while (current.Next != null) { current = current.Next; } current.Next = toAdd; } }