Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
docs: add simple example and beginner-friendly explanation to JumpSearch
  • Loading branch information
prashantpiyush1111 committed Apr 14, 2026
commit 56a087d5d7cc28aa42f459dee613eb4bf5fa7c55
11 changes: 11 additions & 0 deletions src/main/java/com/thealgorithms/searches/JumpSearch.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@
* Result: Index = 4
*
* <p>
* <b>Example (Simple):</b><br>
* Input: arr = [2, 4, 6, 8, 10], key = 8<br>
* Output: 3
*
* <p>
* <b>Explanation (Easy):</b><br>
* Instead of checking every element one by one, Jump Search skips elements
* by jumping ahead fixed steps (√n). Once it finds a range where the element
* might exist, it performs a linear search in that smaller block.
*
* <p>
* <b>Time Complexity:</b><br>
* - Best-case: O(1) - element found at first position<br>
* - Average: O(√n) - optimal block size reduces jumps<br>
Expand Down
Loading