Overview
Implement Ternary Search in the searching engine. Ternary Search divides a sorted array into three equal segments using two midpoints (mid1, mid2), offering a visual contrast to Binary Search with O(log3 N) time complexity.
Implementation Details & File Reference
- Algorithm Model: Create
backend/src/main/java/com/algorithmrace/visualizer/algorithms/searching/TernarySearchModel.java extending SearchModel.
- Record frame states with left bound (
lo), right bound (hi), mid1, and mid2 highlights per iteration step.
- Factory Registration: Register
"Ternary Search" in SearchingAlgorithmFactory.java.
- Complexity Catalog: Add entry (
O(log3 N) time complexity) in ComplexityCatalog.java.
- Frontend Metadata: Add entry in
frontend/src/data/algorithmMetadata.ts.
Definition of Done
- Ternary Search appears in the Searching Arena dropdown.
- Visualizer highlights
mid1 and mid2 bounds during search steps.
- Search metrics accurately record comparison counts.
Skill Level
Medium — requires three-way boundary partitioning and frame state recording.
Overview
Implement Ternary Search in the searching engine. Ternary Search divides a sorted array into three equal segments using two midpoints (
mid1,mid2), offering a visual contrast to Binary Search withO(log3 N)time complexity.Implementation Details & File Reference
backend/src/main/java/com/algorithmrace/visualizer/algorithms/searching/TernarySearchModel.javaextendingSearchModel.lo), right bound (hi),mid1, andmid2highlights per iteration step."Ternary Search"inSearchingAlgorithmFactory.java.O(log3 N)time complexity) inComplexityCatalog.java.frontend/src/data/algorithmMetadata.ts.Definition of Done
mid1andmid2bounds during search steps.Skill Level
Medium — requires three-way boundary partitioning and frame state recording.