Graph BFS Shortest Path Unweighted (JavaScript)
Find the shortest path in an unweighted graph using breadth first search with a predecessor map for path reconstruction.
Page 2 of 14
Find the shortest path in an unweighted graph using breadth first search with a predecessor map for path reconstruction.
Perform topological sort on a directed acyclic graph using depth first search with cycle detection via a tri-color marking scheme.
Implement a hash table with open addressing and double hashing for collision resolution supporting insert, lookup, and delete.
Sort an array by building a max heap in place then repeatedly extracting the maximum element to the end of the array.
Match a pattern in text using the Knuth Morris Pratt algorithm with a precomputed failure function for linear time matching.
Solve the 0-1 knapsack problem using dynamic programming with a one dimensional rolling array to reduce space complexity.
Compute the longest common subsequence of two strings using dynamic programming with full table reconstruction.
Count the number of inversions in an array using a modified mergesort that counts crossings during the merge step in O(n log n) time.
Generate all primes up to n using a segmented sieve of Eratosthenes for memory efficiency on large ranges.
Sort an array in place using quicksort with median-of-three pivot selection to avoid worst-case behavior on already sorted or reverse sorted input.
Find all occurrences of a pattern in text using the Rabin Karp algorithm with a rolling hash for O(n+m) average time complexity.
Implement a skip list supporting insert, delete, and search with probabilistic level assignment using geometric distribution.
Build a trie from a word list supporting prefix search and autocomplete suggestions ranked by word frequency.
Implement a disjoint set union find structure with path compression and union by rank for near constant amortized time.
Evaluate attribute-based access control policies over subject resource and action attributes for fine-grained authorization.
Configure an Apollo Client with in-memory cache error handling and typed queries for GraphQL data fetching.
Hash passwords with Argon2id using explicit memory time and parallelism parameters and verify with constant-time comparison.
Compose async generators into a pipeline for lazy streaming transformation with backpressure.
Implement an async mutex with FIFO fairness for exclusive access to shared resources without priority inversion.
Limit concurrent access to a resource with an async semaphore supporting acquire release and run helpers.
Add a response cache interceptor to Axios with TTL and cache key normalization for idempotent GET requests.
Apply exponential backoff retry to async methods via a decorator with per-method configuration and error filtering.
Collect items into a batch and flush by size threshold or timer whichever fires first for efficient bulk API submission.
Configure a BullMQ job queue on Redis with retry backoff concurrency and dead letter handling.
Create a generator that yields fixed-size chunks from an array for memory-efficient batch processing.
Implement a circuit breaker with closed open and half-open states that probes recovery with a single trial call before full traffic.
Parse CLI arguments with subcommands flags and positional args using a declarative spec for consistent tooling.
Build a consistent hash ring with virtual nodes for even key distribution and minimal remapping when nodes join or leave.
Configure CORS with explicit origin allowlist credential support and preflight caching for safe cross-origin API access.
Build Content-Security-Policy headers with nonces for inline scripts and strict directives to prevent XSS and data exfiltration.
Parse and transform CSV streams with header mapping type coercion and column selection for data pipelines.
Implement debounce firing on leading edge then trailing edge with cancel and flush for async event streams.
Deep clone objects using structuredClone with fallback for older runtimes handling cycles and typed arrays.
Compare nested objects for deep equality handling arrays dates maps and circular references without stack overflow.
Resolve configuration from defaults file environment and CLI args with explicit precedence and type coercion.
Create a typed event emitter supporting on once off and emit with listener count introspection for decoupled communication.
Evaluate feature flags with user segment rules percentage rollout and dependency checks for safe progressive delivery.
Stream uploaded files to disk with size limit magic byte validation and temp directory cleanup for safe multipart handling.
Validate form fields with composable rule functions that return typed errors and support async dependency checks.
Handle shutdown signals by draining in-flight connections with a timeout before force closing for zero-downtime deploys.
Group array items by a key function and count occurrences for aggregation summaries and frequency analysis.
Implement liveness and readiness probes with dependency checks and timeout for Kubernetes orchestration integration.
Compute HMAC signatures and verify with constant-time comparison to prevent timing attacks on webhook authentication.
Escape HTML special characters and strip dangerous tags from user input to prevent XSS in server-rendered templates.
Parse and verify a JWT signature expiry and custom claims with explicit clock tolerance and audience validation.
Emit structured JSON logs with levels context binding and sampling for production observability without blocking the event loop.
Implement an LRU cache using Map insertion order for O(1) get set and eviction with optional TTL expiry.
Create a memoizing wrapper with LRU cache bounded by max size and per-entry TTL eviction for caching expensive pure functions.
Build a Merkle tree from leaf hashes for tamper-evident integrity verification with efficient root comparison.
Build MongoDB aggregation pipelines with typed stages for filtering grouping and projection.
Parse multipart form data with per-field size limits field count cap and content type validation for safe uploads.
Parse newline-delimited JSON from a stream line by line with error recovery and batch emission for large files.
Safely omit or pick keys from objects returning typed results for immutable data transformation.
Create an observable from DOM events with takeUntil teardown for reactive stream composition and automatic unsubscription.
Resolve file paths within a base directory and reject traversal attempts using dot segments and symlink escape detection.
Use pg Pool for parameterized queries with connection pooling transaction support and error handling.
Implement a binary heap priority queue with push pop and peek supporting custom comparators for scheduling.
Run async tasks through a fixed concurrency pool with backpressure collecting results in order while limiting outstanding promises.
Implement a pub/sub channel with topic subscriptions message filtering and async event delivery for decoupled services.
Implement role-based access control with role hierarchy inheritance and permission resolution for authorization decisions.
Implement a read-write lock allowing concurrent readers or a single writer with upgrade support for shared state.
Create a Node.js Readable stream from an async generator with backpressure and cancellation support.
Acquire distributed locks across multiple Redis instances using the Redlock algorithm with quorum and TTL.
Retry an async function with exponential backoff full jitter and max attempts cap to handle transient errors without thundering herd.
Validate form input with Zod schemas using safeParse for typed error collection and automatic type narrowing.
Deduplicate concurrent identical calls to an async function so only one execution runs and all callers share its result.
Generate 64-bit Snowflake IDs with timestamp worker ID and sequence for sortable numeric unique IDs without coordination.
Build parameterized SQL queries with explicit placeholders to prevent injection while supporting dynamic WHERE and ORDER BY.
Compose Node.js streams with pipe and backpressure handling for memory-efficient data transformation.
Build a fixed-window throttle limiting calls per interval with trailing invocation for bounded request rates.
Cache with time-based invalidation supporting stale-while-revalidate for fresh data with background refresh.
Implement an async token bucket rate limiter that refills tokens at a fixed rate and awaits when empty to enforce sustained throughput.
Generate TOTP codes from a shared secret with time step and digit parameters and verify with window tolerance for clock skew.
Generate RFC 9562 UUIDv7 with Unix timestamp random counter and trailing randomness for time-ordered sortable identifiers.
Implement a WebSocket server with heartbeat ping pong timeout and broadcast for real-time communication.
Use contextvars for request-scoped correlation IDs in async code without parameter passing.
Run coroutines with a semaphore-limited gather for bounded concurrency in async data fetching pipelines.
Compose async generators into a pipeline for lazy streaming with backpressure.
Propagate cancellation through async tasks with cleanup for graceful shutdown.
Build an event-driven state machine with asyncio for protocol parsing and workflow orchestration.
Run a pool of workers consuming from an asyncio Queue for producer-consumer patterns.
Throttle API calls with asyncio.Semaphore for bounded concurrency in web scraping.
Protect critical sections from cancellation with asyncio.shield for atomic operations.
Use asyncio.TaskGroup with timeout for structured concurrency and automatic cancellation on failure.
Wait for the first of multiple tasks to complete with asyncio.wait for competitive fetching.
Detect negative cycles in weighted graphs using Bellman-Ford for arbitrage detection.
Implement binary search with lower and upper bound variants for sorted array queries.
Implement a bloom filter using hashlib for probabilistic membership testing with false positive control.
Estimate confidence intervals using bootstrap resampling for robust statistical inference.
Configure Celery tasks with retry backoff jitter and max attempts for resilient async jobs.
Validate nested dictionaries with Cerberus schemas for flexible form input validation.
Build a CLI tool with Click subcommands options and help for consistent command interfaces.
Build a consistent hash ring with virtual nodes for distributed cache routing.
Parse Content-Disposition headers for safe filename extraction with RFC 5987 support.
Implement a context manager for deterministic resource cleanup with exception safety.
Measure function execution time with a context manager and decorator for performance profiling.
Implement cursor-based pagination with SQLAlchemy for stable large dataset traversal.
Use Dask for parallel aggregation across partitions with lazy evaluation for large datasets.
Define a dataclass with Pydantic for runtime validation type coercion and JSON serialization.
Apply retry with exponential backoff via a decorator for resilient function calls.