# Tag Archives: Linked Lists

Given a singly linked list, write a function to swap elements pairwise. For example, if the linked list is 1->2->3->4->5->6->7 then the function should change… Read More
You are given pointers to first and last nodes of a singly linked list, which of the following operations are dependent on the length of… Read More
Given pointer to a node X in a singly linked list. Only one pointer is given, pointer to head node is not given, can we… Read More
Is it possible to create a doubly linked list using only one pointer with every node. (A) Not Possible (B) Yes, possible by storing XOR… Read More
What are the time complexities of finding 8th element from beginning and 8th element from end in a singly linked list? Let n be the… Read More
A circularly linked list is used to represent a Queue. A single variable p is used to access the Queue. To which node should p… Read More
Consider the function f defined below. struct item  {    int data;    struct item * next;  };     int f(struct item *p)  {    return (           (p… Read More
Suppose each set is represented as a linked list with elements in arbitrary order. Which of the operations among union, intersection, membership, cardinality will be… Read More
In the worst case, the number of comparisons needed to search a singly linked list of length n for a given element is (GATE CS… Read More
The following C function takes a single-linked list of integers as a parameter and rearranges the elements of the list. The function is called with… Read More
The following C function takes a simply-linked list as input argument. It modifies the list by moving the last element to the front of the… Read More
What is the output of following function for start pointing to first node of following linked list? 1->2->3->4->5->6 void fun(struct node* start) {   if(start ==… Read More
The following function reverse() is supposed to reverse a singly linked list. There is one line missing at the end of the function. /* Link… Read More
Which of the following sorting algorithms can be used to sort a random linked list with minimum time complexity? (A) Insertion Sort (B) Quick Sort… Read More
Consider the following function that takes reference to head of a Doubly Linked List as parameter. Assume that a node of doubly linked list has… Read More