Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void add2list(node n, node item, int index)
- {
- if (n == null || index < 0)
- return;
- if (index == 0)
- {
- node r = n.next;
- n.next = item;
- item.next = r;
- return;
- }
- add2list(n.next,item,index-1);
- }
- public class node
- {
- public node next { get; set; }
- public int value { get; set; }
- public node(int value ,node next)
- {
- this.next = next;
- this.value = value;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement