Tagged “complixity”
-
Understanding Tabulation and Dynamic Programming with the Knapsack Problem in JavaScript
Transitioning from exponential recursion to bottom-up 2D and 1D tabulation arrays for the 0/1 Knapsack optimization problem in JavaScript. -
Building Fast Autocomplete Search with a Prefix Trie in JavaScript
Implementing a character-by-character Prefix Trie in JavaScript for O(L) dictionary lookup and instant typeahead suggestions. -
Resolving Task Dependencies with Topological Sort in JavaScript
Ordering directed acyclic graphs and detecting circular dependencies in build pipelines using Kahns algorithm in JavaScript. -
Designing an O(1) Least Recently Used Cache with JavaScript Map
Leveraging the insertion-order guarantee of ES6 Map to build a constant-time O(1) LRU cache without a separate doubly linked list. -
Finding Shortest Paths in Weighted Graphs with Dijkstras Algorithm in JavaScript
Implementing a priority queue and Dijkstras greedy relaxation algorithm to compute optimal routes in weighted JavaScript graphs. -
Building and Reversing Singly Linked Lists in JavaScript
Implementing pointer-based node insertion deletion cycle detection and in-place reversal for singly linked lists in JavaScript. -
Solving Subarray Problems with the Sliding Window Pattern in JavaScript
Reducing nested O(n^2) array loops to linear O(n) time complexity using fixed and dynamic sliding windows in JavaScript. -
Implementing Quicksort and In-Place Partitioning in JavaScript
Understanding divide-and-conquer sorting pivot selection strategies and O(n log n) average time complexity with Quicksort in JavaScript. -
Graph Traversal with Breadth-First and Depth-First Search in JavaScript
Exploring DOM trees and adjacency graphs in JavaScript with clean iterative and recursive implementations of BFS and DFS. -
Divide and Conquer Sorting with Merge Sort in JavaScript
While elementary sorting algorithms like Bubble Sort degrade to quadratic O(n^2) time on large datasets, Merge Sort uses a recursive divide-and-conquer strategy to guarantee O(n log n) performance across best, average, and worst-case inputs. -
Implementing Binary Search in JavaScript with Logarithmic Complexity
Scanning an unsorted array element by element with indexOf or find takes O(n) linear time. When working with a sorted dataset, Binary Search repeatedly halves the search interval on every comparison to locate any target in O(log n) logarithmic time. -
Optimizing Recursive Functions with Memoization in JavaScript
Naive recursive algorithms like the Fibonacci sequence recalculate the exact same subproblems thousands of times, leading to exponential O(2^n) time complexity. Caching previous results with memoization drops execution time to linear O(n). -
Two sum algorithm in Javascript
Two sum Algorithm will take in an array and a given number and will check of all pairs of number in the array that will adds up and equals the given number, So keep in mind that result will be an array of arrays.
See all tags.








