Does Dart provide an easy-to-use Linked List? -
i have algorithm that, performance reasons, should use linked list. want constant time appending , removal of elements list, , i'll never need find specific element index.
i see dart has linkedlist
(api docs) in dart:collection
, requires entries subclass linkedlistentry
. don't control elements need put list, , don't want create wrappers.
what options in core dart sdk?
if want add , remove @ both ends, want queue
. can either use listqueue
(which default when using new queue()
) or doublelinkedqueue
. former guarantees amortized constant time operations adding , removing @ ends, while latter has absolute guarantees. listqueue
need grow backing-store on add, takes linear time, happens when list full, , traditional growing-by-doubling guarantee amortized constant operation.
if want add , remove @ end (a stack, basically), normal list should fine.
Comments
Post a Comment