We use privacy-friendly product analytics (no session recording, PII masked) to improve OpenStem. Load analytics? Privacy Policy
Software: explore STEM content (page 23 of 25) · openstem
Explore STEM Content
Search the community's STEM library — free to study, yours to make your own.
Software
Programming, algorithms and systems on openstem — flashcards, notes, quizzes, sketches and flowcharts shared by the community. Study free, or clone anything into your library.
How are generic functions declared in Go (1.18+)?1 / 9
With type parameters in square brackets before the argument list: `func Map[T, U any](s []T, f func(T) U) []U`. Constraints (like `any` or `comparable`) bound what types are allowed.
Not Every Test Runs at Every Gate A mature CI setup doesn't run the entire suite everywhere — it matches test speed to how often the gate fires, so fast feedback stays fast and thorough coverage still happens somewhere. Notice E2E tests run
Software
Software · L2 · Testing: CI Test Execution Strategy
What is the difference between `git merge` and `git rebase`?1 / 10
Merge creates a new merge commit preserving branch history. Rebase replays commits on top of another branch — rewrites commit history for a cleaner linear log. Never rebase shared/published commits.
What is the recurrence relation for merge sort?1 / 8
T(n) = 2T(n/2) + O(n). By the Master Theorem: O(n log n) time. It requires O(n) auxiliary space and is stable (preserves relative order of equal elements).
What five 'superpowers' does an `unsafe` block enable?1 / 10
Dereferencing raw pointers, calling unsafe functions/FFI, accessing/modifying mutable statics, implementing unsafe traits, and accessing union fields. `unsafe` does NOT turn off the borrow checker; it only permits these specific operations.
The Class NP A language L ⊆ {0,1}* is in NP if there exists a polynomial p and a polynomial-time deterministic verifier V such that for every x: NP-Hardness and NP-Completeness L is NP-hard if every language in NP reduces to L under polynom
Trigger, Render, Commit A re-render doesn't touch the screen right away. React first runs your component functions to build a new tree (the render phase), then compares it against the previous tree, and only afterwards mutates the real DOM
From Commit to Production A CI/CD pipeline is a chain of gates: each stage exists to catch a specific class of problem before it reaches the next, more expensive, stage. Test always runs before Package/Publish: it's cheaper to fail the pipe
AThe monetary cost of running infrastructureBThe tradeoff between shipping risky changes and pausing to focus on reliabilityCHow many engineers are on the on-call rotationDThe salary budget for the SRE team
Software
Software · L4 · Site Reliability Engineering — 7 Q
How does a typical backtracking regex engine try to match a pattern?1 / 8
It tries alternatives and quantifier repetitions greedily, and when a later part of the pattern fails to match, it backtracks — undoing the most recent choice and trying the next alternative — until a match is found or all options are exhausted.
Why does the Test stage run before Package/Publish?
ATests run faster after publishingBIt's cheaper to fail fast on broken code than to publish a bad artifact firstCPublishing requires test results as input dataDThere is no required order between the two
Syntax to unpack values from arrays or properties from objects into variables. `const {a, b} = obj` and `const [x, y] = arr`. Supports defaults and renaming: `const {a: renamed = 0} = obj`.
What is a branded type and how do you create one?1 / 10
A branded (nominal) type uses an intersection with a phantom tag to prevent accidental substitution of structurally identical types: `type UserId = string & { readonly _brand: 'UserId' }`. Only created via a factory, not assignable from plain string.
How a Backtracking Engine Matches Most mainstream regex engines (PCRE, Python's re, JavaScript's RegExp) are backtracking engines: they try the pattern against the input greedily, and whenever a later part fails to match, they backtrack to
Software
Software · L3 · Regular Expressions & Text Parsing
How does the cache-aside (lazy loading) pattern work?1 / 8
The application checks the cache first; on a miss, it reads from the database, then writes the result into the cache before returning it. Subsequent reads for the same key hit the cache until it expires or is evicted.
Distinguish data parallelism from model parallelism in distributed training.1 / 7
Data parallelism replicates the full model on every worker; each worker computes gradients on a distinct shard of a mini-batch, and gradients are aggregated (e.g. by summing/averaging) before the shared parameters are updated. Model parallelism instead partitions the model itself across workers — different workers hold different layers or tensor slices — because the model is too large to fit in one device's memory, and activations must be passed between workers as they flow through the partitioned computation graph.
Software
Software · L5 · Distributed Machine Learning Systems
What is time complexity O(log n) and which algorithms exhibit it?1 / 9
O(log n) means the work halves with each step. Binary search, balanced BST operations, and heap insert/extract all run in O(log n). Typically achieved by halving the problem size at each step.
A Turing machine is M = (Q, Σ, Γ, δ, q₀, q_accept, q_reject) where Q is a finite state set, Σ is the input alphabet, Γ ⊇ Σ is the tape alphabet (including a blank symbol ⊔ ∉ Σ), δ: Q × Γ → Q × Γ × {L, R} is the transition function, q₀ is the start state, and q_accept, q_reject ∈ Q are distinguished halting states. M operates on a semi-infinite tape with a read/write head; each step reads the symbol under the head, writes a symbol, moves the head, and changes state.
Sending a Message Across the Internet When you send a message or open a website, your computer breaks the information into small pieces called packets. Each packet travels through a network of routers — special computers that act like post