answersLogoWhite

0

Traversing a doubly linked list is generally faster than traversing a singly linked list, but the speedup depends on how you do the traversal:

  • Traversing from first to last node: No difference.
  • Random access: Doubly linked list is faster, the difference is a fixed factor. (Like twice as fast. Which makes it still very slow for random access compared to arrays.)
  • Reverse order: Doubly linked list is just as fast traversing "backwards" as "forwards", while a singly linked list traversing in reverse order needs to traverse the entire list once for every element in the list - it is a LOT slower. (Time complexity O(n) for doubly linked list, O(n*n) for singly linked, if you are familiar with the notation.)
If you are talking about the computer science "big O notation", doubly linked and singly liked lists are the same. This is because the Big O notation ignores fixed factors and only looks at how time increases with the length of the list, and in this respect the two are the same. (Except for the special case of traversing the list in reverse order. Even here a singly linked list could do it in O(n) time - same as a doubly linked list - by reversing the list (O(n)) before traversing it (O(n)) for a total time of 2*O(n), which by the rules of Big O is the same as O(n).)
User Avatar

Wiki User

15y ago

What else can I help you with?

Continue Learning about Engineering

How do you overcome drawbacks of linked list?

Overcoming the "drawbacks" of a linked list requires knowing what drawback is at stack. If you need to iterate backwards as well as forwards, then you could create a doubly linked list. If you need to search for elements quickly, then you could implement a binary tree. If you have a static size, then you could implement an array. It's all a matter of tradeoff, and of what your particular issue is... Its badsector... According to my self disadvantage of link list that searching in link list is sequential if you compare it with arrays its very slow. Because in link list we have to search every node for that. if any one uses binary tree that is in some cases more faster than arrays.


Which is faster binary tree or binary search tree?

A tree doesn't do anything so it has no speed...


What are the Advantages of linked list over stack and queue?

A linked list is a data structure in which each node has a pointer to the next node, and thus the whole list is linked. Some advantages are: * Easy traversal of the whole list (simply follow the pointers) * Easy insertion and deletion of nodes (don't need to move all the other nodes around)


What is faster access the element in an array or in a list?

Array is always faster to read from disk/access any element in the array is quicker since elements in a array are stored in contiguous location in the memory, you need the pointer to the head or 0th element in the array and then it much quick to navigate to the next on index based. But you need to know INDEX of the element for best results List (say linked list) will be slower since not always elements are stored in contiguous location in the memory as well it involves a function call which is can be assembler/cpu expensive. However getting an individual object from an array is faster if you know the index of the object. Walking through a linked list is faster than walking through an array, if you use a non-recursive algorithm. --Vinay Solanki


How do you improve insertion sort algorithm?

If there was a way, it would be the new insertion sort! Theoretically you could reduce the time by using a linked list and searching to the position it needs to be inserted and inserting it. In practice however you would be better off simply using a different sort, especially if you don't want your data in a linked list. Selection sort is better when writing is expensive. Quicksort and Mergesort are faster on large data sets.

Related Questions

What are the disadvantageds of linked lists?

ConsAll nodes in a linked list are sequential. To retrieve the Nth element, you must traverse N-1 nodes (for a singly linked list). In other words, O(N).There are better structures that are faster - balanced binary search trees O(log N).Side Remark:But if you always do work on the first node or top node, a linked list will work quite well. But at that point, it's not called a linked list anymore. It would be called a stack or a queue.


What are advantages of traversing over triangulation?

Traversing and triangulation are both methods used in surveying, each with its own advantages:Advantages of traversing:Flexibility: Traversing allows for irregularly shaped boundaries to be surveyed efficiently.Accuracy: With careful measurement and adjustment, traversing can provide highly accurate results.Control: Traversing can establish control points for subsequent surveys or triangulations.Adaptability: It can be employed in various terrains and environments, making it versatile for different surveying tasks.Advantages of triangulation:Speed: Triangulation can be faster than traversing for surveying large, open areas with few obstacles.Simplicity: It requires fewer measurements and calculations compared to traversing, simplifying the survey process.Long distances: Triangulation is well-suited for covering long distances, particularly in flat or open landscapes.Automation: Modern surveying technologies, such as GPS, can automate triangulation processes, further enhancing efficiency.


What are the benefits of using doubly compound interest for long-term investments?

Doubly compound interest can help investments grow faster over time due to the compounding effect on both the principal amount and the accumulated interest. This can lead to higher returns compared to simple or single compound interest, making it advantageous for long-term investments.


What are molecules that are joined in an ordered structure?

When molecules are linked in organized positions has solid results. When heat is absorbed by a solid the molecules vibrate faster and faster.


What are the advantages of computer link?

you can go to what ever u linked faster than if u didnt link it


How do you overcome drawbacks of linked list?

Overcoming the "drawbacks" of a linked list requires knowing what drawback is at stack. If you need to iterate backwards as well as forwards, then you could create a doubly linked list. If you need to search for elements quickly, then you could implement a binary tree. If you have a static size, then you could implement an array. It's all a matter of tradeoff, and of what your particular issue is... Its badsector... According to my self disadvantage of link list that searching in link list is sequential if you compare it with arrays its very slow. Because in link list we have to search every node for that. if any one uses binary tree that is in some cases more faster than arrays.


What is the musical term for 'faster'?

there are Several depending on context: piu mosso = more motion. gen. interpreted as being 'faster' accelerando = getting faster (but gradually) doppio movimento = doubly fast. a change in metronome marking from a slower M.M to a faster M.M. or simply, "Faster". Also, a sudden jump to another tempo can be denoted with either a simple tempo direction (allegro or sub. allegro meaning "suddenly faster", etc.) or just a metronome marking indicating the new tempo. It depends on whether you want a specific tempo or for the player (or conductor) to feel a faster tempo by virtue of what was just happening.


How does the presence of doubly-ionized oxygen affect the chemical reactions in a given system?

The presence of doubly-ionized oxygen can increase the reactivity of a system by providing additional electrons for chemical reactions. This can lead to faster reaction rates and potentially different reaction pathways compared to systems without doubly-ionized oxygen.


Which is faster binary tree or binary search tree?

A tree doesn't do anything so it has no speed...


Advantage and disadvantage of sparse index over the dence index?

Sparse advantage, less storage space required Dense advantage faster since each index key is directly linked to a record key


Can light waves or sound waves travel at different speeds under different conditions?

Definitely. The "conditions" are the characteristics of the 'medium' they happen to be traversing at the moment. Sound generally travels faster in more dense substances. The speed of electromagnetic radiation depends on the electrical 'density' of the medium, which doesn't necessarily correspond with its physical density, and is expressed in the number called the 'index of refraction' of the substance.


Can you get Halo 3 armor easily?

You can unlock all the armor by competing Halo 3 achievements. The achievements linked to the downloadable map packs are generally easier to complete and give more gamerscore, therefore giving the armour faster.