![]() |
VOOZH | about |
Pre-requisite: Convert an Array to a Circular Doubly Linked List, Doubly Circular Linked List
Given a doubly circular linked list. The task is to find the position of an element in the list.
Image Representation:
Algorithm:
The below program illustrates the above approach:
Created circular doubly linked list is: 4 5 7 8 6 5 found at location 2
Time Complexity: O(n), as we are using a loop to traverse n times. Where n is the number of nodes in the linked list.
Auxiliary Space: O(1), as we are not using any extra space.