A collection of classic search algorithm implementations in Go (Golang). This repository is part of my journey to learn and practice algorithms daily, starting with fundamental search techniques.
-
Linear Search – Sequentially checks each element (O(n)).
-
Binary Search – Efficient divide & conquer on sorted arrays (O(log n)).
-
Jump Search – Jumps in √n steps, then scans linearly (O(√n)).
-
Exponential Search – Expands range exponentially, then binary search (O(log i)).
-
Ternary Search – Splits range into three sections instead of two (O(log₃ n)).
-
Practice and compare different searching techniques.
-
Understand their time & space complexities.
-
Provide a clean and modular Go implementation for learners.
Algorithm | Best Case | Average Case | Worst Case | Space Complexity |
---|---|---|---|---|
Linear Search | O(1) | O(n) | O(n) | O(1) |
Binary Search | O(1) | O(log n) | O(log n) | O(1) |
Jump Search | O(1) | O(√n) | O(√n) | O(1) |
Exponential Search | O(1) | O(log i) | O(log i) | O(1) |
Ternary Search | O(1) | O(log₃ n) | O(log₃ n) | O(1) |