A utility function to print a given linked list
void printList ( Node ptr ) { while ( ptr != null ) { Console . Write ( ptr . data + " - > " ) ; ptr = ptr . next ; } Console . WriteLine ( " NULL " ) ; }