Question: Given a Single Linked list list1, whereas 13 is the head and 19 is the tail. 13-->6-->19-->5--> 24--> 29 What is the last value of
Given a Single Linked list list1, whereas 13 is the head and 19 is the tail. 13-->6-->19-->5--> 24--> 29 What is the last value of k after executing the following code? Public void XXX( )
{ if (!isEmpty( ))
{ Node temp = head; int k=1; while(temp.next !=tail){ if( (temp.data +temp.next.data) == temp.next.next.data) k++; else k+=2; temp = temp.next; } } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
