← Back to Games

āš”ļø Best/Average/Worst Case Arena

Compare algorithm performance across different input scenarios!

šŸ“Š Case Comparison
šŸ†
BEST CASE
Input already in ideal state for the algorithm
-
Steps
-
Complexity
šŸ“Š
AVERAGE CASE
Random, typical input distribution
-
Steps
-
Complexity
šŸ’€
WORST CASE
Input that causes maximum operations
-
Steps
-
Complexity
šŸ”¬ Run Experiment
Linear Search
Binary Search
Bubble Sort
Quick Sort
šŸ† Best Case
Target at start
šŸ“Š Average Case
Random position
šŸ’€ Worst Case
Target at end
Array (N = 16) | Target: -
šŸ“ˆ Results Comparison
Steps Comparison
Best
Average
Worst
Algorithm Info

Linear Search:

• Best: O(1) - Found at first position

• Average: O(N/2) ā‰ˆ O(N)

• Worst: O(N) - Found at last or not found

šŸ“š Understanding Best/Average/Worst Cases

The same algorithm can have different performance depending on input:

Algorithm Best Average Worst
Linear Search O(1) O(N) O(N)
Binary Search O(1) O(log N) O(log N)
Bubble Sort O(N) O(N²) O(N²)
Quick Sort O(N log N) O(N log N) O(N²)