Does python have built-in linkedList data structure?

后端 未结 5 2038
情深已故
情深已故 2021-02-07 05:05

Does anyone know if Python (maybe 2.7) has a built-in linkedList data structure? I know the queue is implemented using list, and there is no stack (there is LIFO qu

5条回答
  •  故里飘歌
    2021-02-07 05:19

    I believe the deque class in the collections package is implemented as a doubly linked list, with head and tail guards. It supports all the usual API of the default list. To append to the head, use leftappend function.

    from collections import deque
    

提交回复
热议问题