Skip to content

Conversation

@therexdy
Copy link
Contributor

@therexdy therexdy commented Jan 5, 2026

Added file search/linearSearch.zig:

  • search function takes a slice and the key value as arguments
  • returns an error union !usize
  • returns usize index if key is found
  • if not found returns KeyNotFound error from the Error-Set searchErrors

Included test cases to test off-by-one, empty array, single element, duplicate key values in array etc.

zig version 0.15.2

@kassane kassane merged commit 0a0da29 into TheAlgorithms:main Jan 5, 2026
5 checks passed
@kassane
Copy link
Member

kassane commented Jan 5, 2026

@therexdy , nice contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants