jwalsh / jwalsh/hy-algorithms

Implement binary search variations

Open
#13 0 comments 0 reactions 0 assignees View on GitHub
array binary-search difficulty:medium
Dominant language
Hy
Stars
2
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Create a collection of binary search algorithm implementations:

## Basic binary search:
- Standard binary search
- First occurrence of element
- Last occurrence of element
- Count of occurrences
- Search in rotated sorted array
- Find peak element

## Advanced applications:
- Binary search on answer (parametric search)
- Search in 2D sorted matrix
- Median of two sorted arrays
- Allocate minimum number of pages
- Aggressive cows problem
- Capacity to ship packages within D days

## Requirements:
- Handle edge cases and empty arrays
- Provide both recursive and iterative implementations
- Document time and space complexity
- Include detailed explanations of boundary conditions

This collection will demonstrate the versatility of binary search beyond simple sorted array lookups.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.