Unlike C++ and Java, C doesn’t support generics. How to create a linked list in C that can be used for any data type? In C, we can use void pointer and functio...
Share
There are two singly linked lists in a system. By some programming error, the end node of one of the linked list got linked to the second list, forming an inverted Y...
Share
Write a function that moves last element to front in a given Singly Linked List. For example, if the given Linked List is 1->2->3->4->5, then the functio...
Share
Given two numbers represented by two linked lists, write a function that returns sum list. The sum list is linked list representation of addition of two input numbers...
Share
Given a singly linked list, swap kth node from beginning with kth node from end. Swapping of data is not allowed, only pointers should be changed. This requirement m...
Share
Given a linked list of 0s, 1s and 2s, sort it.
Source: Microsoft Interview | Set 1
Recommended: Please solve it on “PRACTICE” first, before moving on t...
Share
Given a Binary Tree (BT), convert it to a Doubly Linked List(DLL). The left and right pointers in nodes are to be used as previous and next pointers respectively in...
Share
Initializer List is used to initialize data members of a class. The list of members to be initialized is indicated with constructor as a comma separated list followe...
Share
Lists are sequence containers that allow non-contiguous memory allocation. As compared to vector, list has slow traversal, but once a position has been found, inserti...
Share
We recommend to read following two posts as a prerequisite of this post.
1. Greedy Algorithms | Set 5 (Prim’s Minimum Spanning Tree (MST))
2. Graph and its rep...
Share