Advertisement
Guest User

Untitled

a guest
Jan 21st, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.62 KB | None | 0 0
  1.  public static void add2list(node n, node item, int index)
  2.         {
  3.             if (n == null || index < 0)
  4.                 return;
  5.             if (index == 0)
  6.             {
  7.                 node r = n.next;
  8.                 n.next = item;
  9.                 item.next = r;
  10.                 return;
  11.             }
  12.             add2list(n.next,item,index-1);
  13.         }
  14.  public class node
  15.     {
  16.         public node next { get; set; }
  17.         public int value { get; set; }
  18.  
  19.         public node(int value ,node next)
  20.         {
  21.             this.next = next;
  22.             this.value = value;
  23.            
  24.         }
  25.      
  26.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement