🔍 LINEAR SEARCH VISUALIZER
User Input • Step-by-Step Animation • Comparisons • Result
```
📥 Enter Your Data
```
```
📊 Array Visualization
```
```
```
📈 Search Statistics
Target
-
Current Position
-
Comparisons
0
```
```
📝 Step-by-Step Explanation
1
Enter the array and the value you want to search.
Click START SEARCH.
```
💡 How Linear Search Works
```
START
↓
Take the first element
↓
Compare element with target
↓
If element == target
→ FOUND
↓
Otherwise move to next element
↓
Repeat until target is found
OR
↓
End of array reached
↓
NOT FOUND
```
```
```
🧮 Comparison Count
Number of comparisons means the number
of times an array element is compared with the target.
Best Case: 1 comparison
Target is the first element.
Worst Case: n comparisons
Target is the last element or does not exist.
Average Case: Approximately (n + 1) / 2 comparisons when successful searches are equally likely.
Time Complexity: O(n)
```
Best Case: 1 comparison
Target is the first element.
Worst Case: n comparisons
Target is the last element or does not exist.
Average Case: Approximately (n + 1) / 2 comparisons when successful searches are equally likely.
Time Complexity: O(n)
No comments:
Post a Comment