In C language, string library has a function strcmp that takes two arguments and return -1, 0 or 1 depending on whether first string is less than equal-to or greater than the second string. int strcmp(const char *str1, const char *str2); Write similar function that compare strings given in the form of linked list, For […]
Given a large number represented in the form of a linked list, Write code to increment the number in-place. For example:
In a general Queue (at any office or bank or any other place), people join the queue at the end and are removed from the front of queue. Similarly Queue data structure is a linear list of elements where element is always inserted at the end and deleted from the front.
Given a Singly linked list. Write functions to insert at different positions in the list: At start of the linked list. At end of the linked list. After k nodes from the start of list. After k nodes from the end of linked list. Insert in a sorted linked list.
We have seen a question to rotate an array around a pivot earlier. Now write similar code for linked list. Given a linked list and an integer value ‘k’. Write a code to rotate linked list by k nodes from the end, as shown in the below diagram for k=2 Note that k nodes are counted […]