Tagged articles

O(log n)

3 articles · Page 1 of 1
Nullbody Notes
Nullbody Notes
Nov 15, 2023 · Fundamentals

Binary Search Solution for LeetCode 162: Find Peak Element

This article explains how to solve LeetCode problem 162 (Find Peak Element) in O(log n) time using a binary‑search approach, detailing the three possible cases, providing pseudocode, and presenting a complete Go implementation that handles boundary conditions as negative infinity.

AlgorithmGoLeetCode
0 likes · 4 min read
Binary Search Solution for LeetCode 162: Find Peak Element
php Courses
php Courses
Sep 4, 2023 · Fundamentals

Binary Search: Explanation and PHP Implementations

Binary search is an efficient O(log n) algorithm for locating a target value in a sorted array, and this article explains its step-by-step process, provides iterative and recursive PHP code examples, and discusses their usage and performance considerations.

AlgorithmO(log n)PHP
0 likes · 6 min read
Binary Search: Explanation and PHP Implementations
Programmer DD
Programmer DD
Jan 4, 2019 · Fundamentals

How to Build an O(log n) Priority Queue with a Binary Heap in JavaScript

This article explains the concept of a priority queue, presents a interview‑style problem requiring O(log n) enqueue and dequeue operations, and shows how to implement the solution efficiently using a binary heap with detailed step‑by‑step illustrations and a complete JavaScript code example.

AlgorithmData StructuresO(log n)
0 likes · 8 min read
How to Build an O(log n) Priority Queue with a Binary Heap in JavaScript