Reference Resources

Data Structure Operation Complexity Quick Reference

Data StructureInsertDeleteSearchTraverse
ArrayO(n) middle / O(1) endO(n) middle / O(1) endO(1) by index / O(n) by valueO(n)
Singly Linked ListO(1) head / O(n) tailO(1) head / O(n) specified positionO(n)O(n)
Doubly Linked ListO(1) (known position)O(1) (known position)O(n)O(n)
StackO(1)O(1)——
QueueO(1)O(1)——
Priority Queue (Heap)O(log n)O(log n)——
Binary Tree (BST)O(log n)~O(n)O(log n)~O(n)O(log n)~O(n)O(n)
Hash TableO(1) averageO(1) averageO(1) average—
HeapO(log n)O(log n)O(1) heap top—
GraphO(1) adjacency listO(E)O(V+E) DFS/BFSO(V+E)

Sorting Algorithm Quick Reference

AlgorithmAverage ComplexityWorst-case ComplexitySpaceStableOne-liner
BubbleO(n²)O(n²)O(1)YesSimple but slow, suitable for teaching
SelectionO(n²)O(n²)O(1)noFewest swaps
InsertionO(n²)O(n²)O(1)YesOptimal for small-scale or nearly sorted data
QuickO(n log n)O(n²)O(log n)noUniversal first choice, clever partitioning idea
MergeO(n log n)O(n log n)O(n)YesStable performance but requires extra space
Heap SortO(n log n)O(n log n)O(1)noIn-place sorting, optimal space
ShellO(n^1.3)O(n²)O(1)noImproved version of insertion sort

Big O Complexity Ranking

Complexityn=10n=1000n=1000000Rating
O(1)111Optimal
O(log n)~3~10~20Excellent
O(n)1010001000000Acceptable
O(n log n)~30~10000~20000000Fair
O(n²)100100000010¹²Be wary
O(2ⁿ)1024Astronomical numberImpossibleUnusable

Recommended Learning Resources

TypeNameDescription
Classic Textbook"Data Structures (C Language Edition)" by Yan WeiminStandard textbook for domestic universities, comprehensive system
Classic Textbook"Introduction to Algorithms" (CLRS)Authoritative reference in the algorithm field, in-depth and systematic
Online PracticeLeetCode (leetcode.com)Massive algorithm problems, top choice for interview practice
Online PracticeNowcoder (nowcoder.com)Domestic interview practice platform, suitable for campus recruitment preparation
Visualization ToolVisualgo (visualgo.net)Algorithm visualization, helps understand execution process
Online CompilerCompiler Explorer (godbolt.org)View assembly after C code compilation, understand underlying details
Other Extensions