codinasion-archive / codinasion-monorepo

Community Monorepo
https://codinasion.org
MIT License
52 stars 167 forks source link

Write a JavaScript program to implement linear search #5299

Closed harshraj8843 closed 9 months ago

harshraj8843 commented 10 months ago

Description

Write a JavaScript program to implement linear search

Linear search is a very simple search algorithm. In this type of search, a sequential search is made over all items one by one. Every item is checked and if a match is found then that particular item is returned, otherwise the search continues till the end of the data collection.

Linear search is the simplest search algorithm. For this reason, it is often called sequential search.

Pseudocode

procedure linear_search (list, value)

   for each item in the list
      if match item == value
         return the item's location
      end if
   end for

end procedure

Example

list = [1,2,3,4,5]
value = 4

Output : 3
How to contribute - Comment `!assign` to assign this issue to yourself - Fork this repository - Create a new branch - Save the solution in `program/program/implement-linear-search/ImplementLinearSearch.js` - Commit the changes - Create a pull request
codinasion-bot[bot] commented 10 months ago

👋🏻 Hey @harshraj8843

💖 Thanks for opening this issue 💖

A team member should be by to give feedback soon.

Amedi-Imbira commented 10 months ago

!assign

aaryan-sharmaa commented 9 months ago

!assign

codinasion-bot[bot] commented 9 months ago

Hey @aaryan-sharmaa, this issue is already assigned to @Amedi-Imbira! cc/ @codinasion/codinasion