<DS/>DS_VISUALIZER
FoundationsOOPArraysLinked ListStacksQueuesTreesGraphsHashingStrings
exploreExplore
homechevron_rightTopicschevron_rightLinked Listchevron_rightDoubly Linked Listchevron_rightInsertion
add_box

DOUBLY LINKED LIST · INSERTION

Insertion

Add a node at the beginning, end, or a given position.

Choose a variant

first_pagearrow_outward

Insert at Begin

Prepend a node — O(1).

O(1)O(1)◍ 0/6
last_pagearrow_outward

Insert at End

Append a node at the tail.

O(n)O(1)◍ 0/6
add_boxarrow_outward

Insert at Position

Splice a node at an index.

O(n)O(1)◍ 0/6