[PR #1474] [CLOSED] Improved linear search: return index, input validation, multpile queries #2075

Open
opened 2026-01-29 15:28:27 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/TheAlgorithms/C/pull/1474
Author: @inesh126
Created: 6/7/2025
Status: Closed

Base: masterHead: master


📝 Commits (1)

  • 77427ce Improved 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.

## 📋 Pull Request Information **Original PR:** https://github.com/TheAlgorithms/C/pull/1474 **Author:** [@inesh126](https://github.com/inesh126) **Created:** 6/7/2025 **Status:** ❌ Closed **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (1) - [`77427ce`](https://github.com/TheAlgorithms/C/commit/77427ce2868e77e7b7dd1bae0d86e33804d9edc1) Improved linear search: return index, input validation, multpile queries ### 📊 Changes **1 file changed** (+47 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `searching/linear_search.c` (+47 -17) </details> ### 📄 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 15:28:27 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/C#2075