learnMore-algorithm/src/main/java/com/learn/leetcode/LinkedlistIS.java
/* 
	* function to insert a new_node in a list. Note that 
	* this function expects a pointer to head_ref as this 
	* can modify the head of the input linked list 
	* (similar to push()) 
	*/
function to insert a new_node in a list. Note that
this function expects a pointer to head_ref as this
can modify the head of the input linked list
(similar to push())
function to insert a new_node in a list . Note that this function expects a pointer to head_ref as this can modify the head of the input linked list ( similar to push () )
void sortedInsert(Node newnode)
	{ 
		/* Special case for the head end */
		if (sorted == null || sorted.val >= newnode.val) 
		{ 
			newnode.next = sorted; 
			sorted = newnode; 
		} 
		else
		{ 
			Node current = sorted;
			/* Locate the node before the point of insertion */
			while (current.next != null && current.next.val < newnode.val) 
			{ 
				current = current.next; 
			} 
			newnode.next = current.next; 
			current.next = newnode; 
		} 
	}
void sortedInsert ( Node newnode ) { /* Special case for the head end */ if ( sorted == null || sorted . val >= newnode . val ) { newnode . next = sorted ; sorted = newnode ; } else { Node current = sorted ; /* Locate the node before the point of insertion */ while ( current . next != null && current . next . val < newnode . val ) { current = current . next ; } newnode . next = current . next ; current . next = newnode ; } }
function to insert a new_node in a list.
function to insert a new_node in a list .