Blog Home

General CS Fundamentals

Core Data Structures

ConceptWhat it isHow it works mechanicallyWhen it matters
Array / VectorContiguous memory sequenceAddress = base + index × stride; fast sequential accessNumerical data, tensors, buffers
Dynamic ArrayResizable arrayGrows by allocating larger block and copyingLists, vectors, buffers
Linked ListNodes with pointersO(1) insert/delete given node, O(n) traversalRare in practice; conceptual contrast
Hash MapKey → value storeHash → bucket → resolve collisionsVocabularies, configs, memoization
StackLIFO structurePush/pop at one endFunction calls, DFS
QueueFIFO structureEnqueue back, dequeue frontPipelines, scheduling
DequeDouble-ended queuePush/pop at both endsSliding windows
HeapPartial order treeTop element accessible in O(1), insert/remove O(log n)Priority scheduling, top-k
TreeHierarchical structureParent/child pointers or indicesParsing, indexes
GraphNodes + edgesAdjacency list or matrixDependencies, workflows

Core Algorithms

PatternCore ideaMechanical invariantTypical use
SortingOrder elementsComparison-based lower bound O(n log n)Preprocessing, ranking
Binary SearchHalve search spacePredicate monotonicityThresholds, ranges
Two PointersShrink/expand windowMonotonic pointer movementStreaming, intervals
Sliding WindowMaintain constraintWindow invariant preservedTime series
BFSLevel-wise traversalQueue ensures shortest pathGraph distances
DFSDepth-first traversalStack/recursionReachability
Dynamic ProgrammingCache subproblemsState + transition + baseSequences, decoding
GreedyLocal choiceExchange argument ensures correctnessScheduling

Complexity & Cost

ConceptMeaningWhy it matters
Time ComplexityGrowth of operationsPredict scalability
Space ComplexityPeak memory usagePrevent OOM failures
Big-OAsymptotic upper boundCompare algorithms
Amortized CostAverage over operationsExplains resizing
Quadratic StructuresO(n²) memory/timeAttention, pairwise ops

Memory & Representation

ConceptMechanical meaningCommon failure
Stack MemoryAutomatic, scopedStack overflow
Heap MemoryDynamic allocationLeaks, fragmentation
Cache LocalitySequential faster than randomSlow loops
dtype ChoiceBits per elementMemory blowups
Copy vs ViewNew memory vs sharedSilent mutation bugs

Linux Command Line

Command / PatternWhat it doesTypical use
ls, cd, pwdNavigate filesystemOrientation
cat, lessView file contentsInspection
head, tailFile edgesLogs
grepPattern matchingSearching
| (pipe)Chain commandsData flow
sort, uniqOrdering/countingText analysis
awk, sedTransform textScripting
> / >>Redirect outputSave results
chmod, chownPermissionsAccess issues
ln -sSymbolic linksAliasing paths

Git

ConceptWhat it meansWhy it matters
CommitSnapshot of repoHistory + rollback
BranchIndependent lineParallel work
MergeCombine historiesIntegration
RebaseReplay commitsLinear history
Squash MergeCollapse commitsClean history
ReflogHEAD historyRecovery
ResetMove branch pointerUndo mistakes
Fetch vs PullUpdate refs vs mergeControl updates
Detached HEADCommit not on branchTemporary states
ConflictSame lines changedManual resolution

Build & Compilation

ConceptMechanical roleFailure mode
CompilationSource → objectSyntax, headers
LinkingObjects → executableMissing symbols
Static vs SharedEmbedded vs dynamicRuntime errors
Make / CMakeDependency trackingStale builds

Testing & Debugging

ToolPurposeWhen to use
Unit TestsVerify logicDeterministic code
Integration TestsVerify interactionPipelines
AssertionsEnforce invariantsDebugging
LoggingPersist statePost-mortem
LintersStatic checksEarly errors

Networking & APIs

ConceptMeaningPractical note
HTTP VerbsAction semanticsAPI correctness
JSONData interchangeSchema drift
LatencyTime to first byteInteractive systems
BandwidthThroughputLarge transfers
SocketsNetwork endpointsLow-level comms