> For the complete documentation index, see [llms.txt](https://ondrej-kvasnovsky-2.gitbook.io/algorithms/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ondrej-kvasnovsky-2.gitbook.io/algorithms/finding.md).

# Searching

- [Union-Find Algorithms](https://ondrej-kvasnovsky-2.gitbook.io/algorithms/finding/union-find-algorithms.md)
- [Finding Peak](https://ondrej-kvasnovsky-2.gitbook.io/algorithms/finding/finding-peak.md)
- [Find Sum in Array](https://ondrej-kvasnovsky-2.gitbook.io/algorithms/finding/find-sum-in-array.md)
- [Binary Search](https://ondrej-kvasnovsky-2.gitbook.io/algorithms/finding/binary-search.md)
- [Find Index Binary Search](https://ondrej-kvasnovsky-2.gitbook.io/algorithms/finding/binary-search/find-index-binary-search.md)
- [Sqrt(x)](https://ondrej-kvasnovsky-2.gitbook.io/algorithms/finding/binary-search/sqrtx.md)
- [Search in Rotated Sorted Array](https://ondrej-kvasnovsky-2.gitbook.io/algorithms/finding/binary-search/search-in-rotated-sorted-array.md)
- [Guess Number Higher or Lower](https://ondrej-kvasnovsky-2.gitbook.io/algorithms/finding/binary-search/guess-number-higher-or-lower.md)
- [First Bad Version](https://ondrej-kvasnovsky-2.gitbook.io/algorithms/finding/binary-search/first-bad-version.md)
- [Find Peak Element](https://ondrej-kvasnovsky-2.gitbook.io/algorithms/finding/binary-search/find-peak-element.md)
- [Find Minimum in Rotated Sorted Array](https://ondrej-kvasnovsky-2.gitbook.io/algorithms/finding/binary-search/find-minimum-in-rotated-sorted-array.md)
- [Find Minimum in Rotated Sorted Array II](https://ondrej-kvasnovsky-2.gitbook.io/algorithms/finding/binary-search/find-minimum-in-rotated-sorted-array-ii.md)
- [Search for a Range](https://ondrej-kvasnovsky-2.gitbook.io/algorithms/finding/binary-search/search-for-a-range.md)
- [Closest Binary Search Tree Value](https://ondrej-kvasnovsky-2.gitbook.io/algorithms/finding/binary-search/closest-binary-search-tree-value.md)
- [Find K Closest Elements](https://ondrej-kvasnovsky-2.gitbook.io/algorithms/finding/binary-search/find-k-closest-elements.md)
- [Search in a Sorted Array of Unknown Size](https://ondrej-kvasnovsky-2.gitbook.io/algorithms/finding/binary-search/search-in-a-sorted-array-of-unknown-size.md)
- [Pow(x, n)](https://ondrej-kvasnovsky-2.gitbook.io/algorithms/finding/binary-search/powx-n.md)
- [Valid Perfect Square](https://ondrej-kvasnovsky-2.gitbook.io/algorithms/finding/binary-search/valid-perfect-square.md)
- [Find Minimum in Rotated Sorted Array II](https://ondrej-kvasnovsky-2.gitbook.io/algorithms/finding/binary-search/find-minimum-in-rotated-sorted-array-ii-1.md)
- [Intersection of Two Arrays](https://ondrej-kvasnovsky-2.gitbook.io/algorithms/finding/binary-search/intersection-of-two-arrays.md)
- [Intersection of Two Arrays II](https://ondrej-kvasnovsky-2.gitbook.io/algorithms/finding/binary-search/intersection-of-two-arrays-ii.md)
- [Two Sum II - Input array is sorted](https://ondrej-kvasnovsky-2.gitbook.io/algorithms/finding/binary-search/two-sum-ii-input-array-is-sorted.md)
- [Find the Duplicate Number](https://ondrej-kvasnovsky-2.gitbook.io/algorithms/finding/binary-search/find-the-duplicate-number.md)
- [Longest Common Prefix](https://ondrej-kvasnovsky-2.gitbook.io/algorithms/finding/longest-common-prefix.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://ondrej-kvasnovsky-2.gitbook.io/algorithms/finding.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
