public void XXXX() { if (tail == null) { System.out.print…
public void XXXX() { if (tail == null) { System.out.println(“List is empty delete.”); return; } if (head == tail) head = tail = null; else { Node temp = head; while (temp.next != tail) temp = temp.next; temp.next = null; tail = temp; } } Consider the following linked list , if the above function XXXX is applied on the list The number of elements in the list would be _________________________
Read DetailsWhat is the output of following function where start pointin…
What is the output of following function where start pointing to first node of following linked list? 1->2->3->4->5->6 void fun (Node start) { if(start == NULL) return; System.out.println(start.data); if(start->next != NULL ) fun(start->next->next); System.out.println(start.data); }
Read Details