difference between double-ended linked lists and doubly-linked list

≯℡__Kan透↙ 提交于 2019-12-21 08:16:25

问题


I don't understand difference between a double-ended and doubly-linked list.

What is the major difference between the two?


回答1:


In a doubly linked list, each node has two pointers. One towards its next node and another one towards its previous node.

In a double-ended linked list, each node has just one pointer which points to its next node. Its difference from the single-ended linked list is that instead of just one "head" node, it contains two pointers of this kind ("first" and "last"), so someone is able to insert elements to list from both ends of it.

(Last picture isn't that clear, but it catches the point of the two ends.)




回答2:


A doubly linked list is a list where the elements have pointers to both the element before and after in the list.

A double ended list is from my understanding the same as a deque. That is a queue from which you can add and remove items from both the top and the bottom.




回答3:


A double ended list is similar to an ordinary linked list, but it has one additional features: a reference to the last link as well as to the first. In a doubly linked list each link has two references to other links instead of one. The first is to the next link, as in ordinary lists. The second is to the previous link.




回答4:


Single linked it's one way direction and it uses less memory and the complexity of insertion is O(n). While the double linked is a two way direction (next and previous), it uses more memory than the single list and the complexity of insertion and deletion is O(n).



来源:https://stackoverflow.com/questions/28329680/difference-between-double-ended-linked-lists-and-doubly-linked-list

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!