mirror of
https://github.com/TheAlgorithms/C.git
synced 2026-02-04 05:44:35 +00:00
[PR #1474] [CLOSED] Improved linear search: return index, input validation, multpile queries #2075
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/TheAlgorithms/C/pull/1474
Author: @inesh126
Created: 6/7/2025
Status: ❌ Closed
Base:
master← Head:master📝 Commits (1)
77427ceImproved linear search: return index, input validation, multpile queries📊 Changes
1 file changed (+47 additions, -17 deletions)
View changed files
📝
searching/linear_search.c(+47 -17)📄 Description
This pull request improves the existing linear search implementation by:
Changing the return value to the index of the found element instead of just 1/0, allowing users to know the exact position.
Adding input validation to handle edge cases, such as empty arrays.
Modifying the program to allow multiple search queries without restarting.
Enhancing code readability with comments and cleaner variable names.
These improvements make the linear search function more useful and the program more user-friendly.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.