Category Archives: Linked List

Given a singly linked list, write a function to swap elements pairwise. Input: 1->2->3->4->5->6->NULL  Output: 2->1->4->3->6->5->NULL Input: 1->2->3->4->5->NULL  Output: 2->1->4->3->5->NULL Input: 1->NULL  Output: 1->NULL  For… Read More
Given a singly linked list, write a function to swap elements pairwise. Input: 1->2->3->4->5->6->NULL Output: 2->1->4->3->6->5->NULL Input: 1->2->3->4->5->NULL Output: 2->1->4->3->5->NULL Input: 1->NULL Output: 1->NULL For example, if the… Read More
Given a singly linked list, write a function to swap elements pairwise. Input: 1->2->3->4->5->6->NULL  Output: 2->1->4->3->6->5->NULL Input: 1->2->3->4->5->NULL  Output: 2->1->4->3->5->NULL Input: 1->NULL  Output: 1->NULL For… Read More
Given a singly linked list, write a function to swap elements pairwise. Input: 1->2->3->4->5->6->NULL Output: 2->1->4->3->6->5->NULL Input: 1->2->3->4->5->NULL Output: 2->1->4->3->5->NULL Input: 1->NULL Output: 1->NULL  For example, if the… Read More
QuickSort on Doubly Linked List is discussed here. QuickSort on Singly linked list was given as an exercise. The important things about implementation are, it… Read More
QuickSort on Doubly Linked List is discussed here. QuickSort on Singly linked list was given as an exercise. The important things about implementation are, it… Read More
QuickSort on Doubly Linked List is discussed here. QuickSort on Singly linked list was given as an exercise. The important things about implementation are, it… Read More
Write a function that searches a given key ‘x’ in a given singly linked list. The function should return true if x is present in… Read More
Write a function that searches a given key ‘x’ in a given singly linked list. The function should return true if x is present in… Read More
Write a function that searches a given key ‘x’ in a given singly linked list. The function should return true if x is present in… Read More
Write a function that searches a given key ‘x’ in a given singly linked list. The function should return true if x is present in… Read More
Write a function that searches a given key ‘x’ in a given singly linked list. The function should return true if x is present in… Read More
Write a function to count the number of nodes in a given singly linked list. For example, the function should return 5 for linked list… Read More
Write a function to count the number of nodes in a given singly linked list. For example, the function should return 5 for linked list… Read More
Write a function to count the number of nodes in a given singly linked list. For example, the function should return 5 for linked list… Read More