public class DoublyLinkedList
private void insertAtPos(int key, int position)
Node newNode = new Node(key);
while(k < position && cur != null)
if(prev.next == null && k!= position)
Console.WriteLine("Position is incorrect");
Console.WriteLine("No linked list exists");
Console.WriteLine();Console.WriteLine();
private void deleteAtPos(int position)
Console.WriteLine("Linked list does not exist");
while(k<position && cur!=null)
Console.WriteLine("Incorrect position to delete");
public static void Main(String[] args)
DoublyLinkedList dll = new DoublyLinkedList();