We use privacy-friendly product analytics (no session recording, PII masked) to improve OpenStem. Load analytics? Privacy Policy
Software: explore STEM content (page 12 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.
Every element is a box composed of content, padding, border, and margin (inner to outer). `box-sizing: border-box` makes width/height include padding and border — the common modern default that avoids surprising sizing.
Multiple components share implicit state via Context rather than explicit prop drilling. E.g. `<Select>` + `<Select.Option>` communicate via a shared context, giving consumers a composable API without complex prop hierarchies.
Go interfaces are satisfied implicitly — a type implements an interface simply by having the required methods, with no `implements` keyword. This enables structural typing and decoupling. The empty interface `interface{}` (or `any`) matches every type.
What is a graceful shutdown and how do you implement it in Node?1 / 10
Graceful shutdown stops accepting new connections, waits for in-flight requests to complete, and then exits cleanly. Implement by listening for SIGTERM/SIGINT, calling `server.close()` to stop accepting connections, and waiting for the close callback before calling `process.exit(0)`.
Topics, Partitions, and Ordering A Kafka topic is a named stream, physically split into partitions — each partition is an append-only, immutable log that new messages are appended to and consumers read sequentially. Kafka only guarantees or
Styling a Single Widget Most visual widgets accept a `style` parameter. `Text('Hi', style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold, color: Colors.blue))` controls that one piece of text directly. This works, but repeating the sa
What problem does useCallback solve, and when is it pointless?1 / 10
It memoizes a function identity across renders so memo-wrapped children or effect dependencies don't trigger unnecessarily. Pointless if the consumer isn't memoized — you pay the memoization cost for no benefit.
A data structure where at least one thread is guaranteed to make progress in a finite number of steps, even if other threads are suspended. Uses CAS loops rather than locks — no thread can be deadlocked. Wait-free is stronger: every thread completes in a bounded number of steps.
What is the greedy algorithm paradigm and when does it guarantee optimality?1 / 9
Greedy makes the locally optimal choice at each step hoping it leads to a global optimum. Guaranteed optimal when a greedy-choice property holds (provable by exchange argument) and optimal substructure exists. Examples: activity selection, Huffman coding, Kruskal's MST.
Define a deterministic finite automaton (DFA) as a 5-tuple.1 / 8
A DFA is M = (Q, Σ, δ, q₀, F) where Q is a finite set of states, Σ is a finite alphabet, δ: Q × Σ → Q is the (total) transition function, q₀ ∈ Q is the start state, and F ⊆ Q is the set of accepting states. M accepts w ∈ Σ* iff the extended transition function δ̂(q₀, w) ∈ F.
Software
Software · L5 · Automata Theory & Formal Languages