Open In App
Related Articles

Can we reverse a linked list in less than O(n)?

Improve Article
Improve
Save Article
Save
Like Article
Like

It is not possible to reverse a simple singly linked list in less than O(n). A simple singly linked list can only be reversed in O(n) time using recursive and iterative methods. 

A doubly linked list with head and tail pointers while only requiring swapping the head and tail pointers which require lesser operations than a singly linked list can also not be done in less than O(n) since we need to traverse till the end of the list anyway to find the tail node.

This article is contributed by Abhishek and moharibishal Please write comments if you find anything incorrect, or if you want to share more information about the topic discussed above.
 

Feeling lost in the world of random DSA topics, wasting time without progress? It's time for a change! Join our DSA course, where we'll guide you on an exciting journey to master DSA efficiently and on schedule.
Ready to dive in? Explore our Free Demo Content and join our DSA course, trusted by over 100,000 geeks!

Last Updated : 10 Jan, 2023
Like Article
Save Article
Similar Reads
Related Tutorials