V

Algorithm Visualizer

ZHEN
Share on WeiboShare on XGitHub repositoryAuthor website
Learning ToolsAlgorithm Complexity ReferenceAlgorithm Learning Paths
Data StructuresArrayLinked ListStackQueue and DequeBinary Search TreeBinary HeapHash TableGraphTrieDisjoint Set UnionLRU CacheSkip ListSegment TreeB+ TreeBloom FilterFenwick Tree
SortingBubble SortCocktail Shaker SortBitonic SortSelection SortInsertion SortBinary Insertion SortShell SortMerge SortTop-Down Merge SortQuick SortThree-Way Quick SortDual-Pivot Quick SortHeap SortCounting SortRadix SortBucket Sort
Graph AlgorithmsDijkstra's Shortest PathKruskal's Minimum Spanning TreePrim's Minimum Spanning TreeBellman-Ford Shortest PathsTopological SortFloyd-WarshallStrongly Connected Components2-SATMaximum FlowBipartite MatchingLowest Common AncestorEulerian Path
Dynamic ProgrammingEdit Distance0/1 KnapsackUnbounded KnapsackLongest Common SubsequenceLongest Increasing SubsequenceCoin ChangeStone MergingTraveling Salesperson DPTree Dynamic ProgrammingDigit DPRerooting DP
Backtracking and SearchN-QueensSubsetsPermutationsCombination SumMaze Solving with DFSNumber of IslandsWord SearchSudoku SolverA* Search
StringsKMP String MatchingRabin-Karp String MatchingBoyer-Moore String MatchingManacher's Longest Palindromic SubstringSuffix ArrayLCP ArrayAho-Corasick AutomatonZ Function
Math and Number TheorySieve of EratosthenesLinear SieveEuclidean AlgorithmBinary ExponentiationExtended Euclidean AlgorithmChinese Remainder TheoremEuler's Totient FunctionMiller-Rabin Primality TestFast Fourier TransformPollard's Rho Factorization
Computational GeometryConvex HullRotating CalipersClosest Pair of PointsLine Segment IntersectionBentley-Ottmann Sweep Line
SearchingBinary SearchLower and Upper BoundSearch in a Rotated Sorted ArrayBinary Search on the AnswerTernary Search

Linked List

Nodes connected by references instead of contiguous addresses

Follow links to reach data

A singly linked list stores a value and a reference to the next node in each node. The nodes may live anywhere in memory, so the list can grow without relocating all existing values. The tradeoff is traversal: reaching index i requires following every preceding link, which takes O(i) time.

Try it
head
→
1
→
2
→
3
→
∅

Select a node, then choose an operation above.

Once a node is known, inserting or removing its successor only rewires a constant number of references. Finding that position may still cost O(n), so linked lists are most useful when an algorithm already holds the relevant node.

Doubly linked lists move both ways

Adding a previous reference enables backward traversal and constant-time removal of a known node. It also increases memory use and makes every update responsible for two directions. Move the cursor and watch both neighbor links remain consistent.

Try it
∅
→←
head
10
→←
20
→←
30
→←
tail
40
→←
∅

Each node has prev and next links. Traverse backward, or select a node to delete it.

Invariant: for every adjacent pair a and b, a.next === b and b.prev === a. A partial update can silently split the list.

Linked nodes are the building blocks behind the stack, queues, and the recency order in an LRU cache.