Skip to main content

LinkedList Interview Questions


1) Print Elements of Linked List


2) Reverse LinkedList



3) Delete a given Element of a LinkedList



4) Delete kth Element from headNode of  a LinkedList



5) Delete kth Element from tailNode of  a LinkedList



6) Detect if a LinkedList contains a Cycle



7) Remove an Element from a DoublyLinkedList



8) Merge Elements of a DoublyLinkedList



9) Create a Cache such that the Elements can be added at Head and removed from Tail, in O(1)



10) Merge K Sorted Lists

K Sorted Linked Lists cab be merged using MinHeap. All the elements from all the K Linked Lists are added to the MinHeap one by one. Create a Dummy LinkedList Node and add all the nodes from the Min Heap to the LinkedList node. Return the Next Node of the dummy Node which becomes the head for the combined LinkedList.


Comments

Popular posts from this blog

Design Patterns using Java

According to Gang of Four(GOF) any software is classified in to one of the three categories. I read so many books about design patterns which provide a lot of information about Design Patterns in a language neutral way or related to a particular programming language. I am trying to complement the great books by providing the precise and concise information that is required in the day to day programming of a Java Developer. Any software can be classified into one of the three categories -Framework, Toolkit, Application. Framework - Framework defines a set of steps to create an application. Framework provides design reuse. Toolkit - Toolkit provides some utility functions to an existing application. Toolkit provides code reuse. Application - Application is some thing that is specific to the project, and is not useful outside the context of the current application. Gang of Four divided the Design Patterns in to 3 types based on their usage. There are 3 types of Gang of Fo