Skip to content
This repository has been archived by the owner on Jul 10, 2024. It is now read-only.

Write a F# program to implement linear search #5295

Closed
harshraj8843 opened this issue Jan 15, 2024 · 2 comments · Fixed by #5585
Closed

Write a F# program to implement linear search #5295

harshraj8843 opened this issue Jan 15, 2024 · 2 comments · Fixed by #5585
Assignees
Labels
closed closed issues/PRs F# f-sharp related good first issue Good for newcomers program

Comments

@harshraj8843
Copy link
Contributor

Description

Write a F# 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.fs
  • Commit the changes
  • Create a pull request
@harshraj8843 harshraj8843 added F# f-sharp related good first issue Good for newcomers program labels Jan 15, 2024
@codinasion-bot
Copy link

👋🏻 Hey @harshraj8843

💖 Thanks for opening this issue 💖

A team member should be by to give feedback soon.

@codinasion-bot codinasion-bot bot added the triage Waiting for review label Jan 15, 2024
@David-FR
Copy link
Contributor

!assign

David-FR pushed a commit to David-FR/codinasion that referenced this issue Mar 25, 2024
harshraj8843 added a commit that referenced this issue Mar 28, 2024
* Solves issue with swift not finding the largest two elements correctly

* Solves  #5560 Write a Scala program to convert temperature from celsius to kelvin

* Removes #5560 changes

* F# program to implement linear search (#5295)

---------

Co-authored-by: David Fernandez <david@Davids-MacBook-Pro.local>
Co-authored-by: Harsh Raj <harshraj8843@gmail.com>
@codinasion-bot codinasion-bot bot added closed closed issues/PRs and removed triage Waiting for review labels Mar 28, 2024
RiteshK-611 pushed a commit that referenced this issue Apr 4, 2024
#5173  (#5606)

* Solves issue with swift not finding the largest two elements correctly

* Solves  #5560 Write a Scala program to convert temperature from celsius to kelvin

* Removes #5560 changes

* F# program to implement linear search (#5295)

* Solves 5173: Write a Haskell program to find the largest three elements in an array

---------

Co-authored-by: David Fernandez <david@Davids-MacBook-Pro.local>
Co-authored-by: Harsh Raj <harshraj8843@gmail.com>
Co-authored-by: Anandha Krishnan S <anandajith@gmail.com>
victoriacheng15 pushed a commit that referenced this issue Apr 8, 2024
* Solves issue with swift not finding the largest two elements correctly

* Solves  #5560 Write a Scala program to convert temperature from celsius to kelvin

* Removes #5560 changes

* F# program to implement linear search (#5295)

* Solves 5173: Write a Haskell program to find the largest three elements in an array

* Create implement_ternary_search.dart

This Dart program defines a function ternarySearch that implements the ternary search algorithm as described in your pseudocode. The main function demonstrates how to use ternarySearch by searching for the value 4 in the list [1, 2, 3, 4, 5]. The expected output is "Element found at index: 3" since the value 4 is located at the index 3 in the list (considering 0-based indexing).

---------

Co-authored-by: David Fernandez <david@Davids-MacBook-Pro.local>
Co-authored-by: Harsh Raj <harshraj8843@gmail.com>
Co-authored-by: Anandha Krishnan S <anandajith@gmail.com>
anandfresh added a commit that referenced this issue Apr 11, 2024
* Solves issue with swift not finding the largest two elements correctly

* Solves  #5560 Write a Scala program to convert temperature from celsius to kelvin

* Removes #5560 changes

* F# program to implement linear search (#5295)

* Solves 5173: Write a Haskell program to find the largest three elements in an array

* Create implement_ternary_search.hs

Defines a function 'ternarySearch' that implements the ternary search algorithm.

---------

Co-authored-by: David Fernandez <david@Davids-MacBook-Pro.local>
Co-authored-by: Harsh Raj <harshraj8843@gmail.com>
Co-authored-by: Anandha Krishnan S <anandajith@gmail.com>
Co-authored-by: Yuri Cunha <isyuricunha@duck.com>
RiteshK-611 added a commit that referenced this issue Apr 13, 2024
* Solves issue with swift not finding the largest two elements correctly

* Solves  #5560 Write a Scala program to convert temperature from celsius to kelvin

* Removes #5560 changes

* F# program to implement linear search (#5295)

* Solves 5173: Write a Haskell program to find the largest three elements in an array

* Create ConvertDecimalToHexadecimal.swift

Converts a decimal number to its hexadecimal representation.a

---------

Co-authored-by: David Fernandez <david@Davids-MacBook-Pro.local>
Co-authored-by: Harsh Raj <harshraj8843@gmail.com>
Co-authored-by: Anandha Krishnan S <anandajith@gmail.com>
Co-authored-by: Ritesh Kokam <61982298+RiteshK-611@users.noreply.github.com>
RiteshK-611 added a commit that referenced this issue Apr 15, 2024
* Solves issue with swift not finding the largest two elements correctly

* Solves  #5560 Write a Scala program to convert temperature from celsius to kelvin

* Removes #5560 changes

* F# program to implement linear search (#5295)

* Solves 5173: Write a Haskell program to find the largest three elements in an array

* Create implement-ternary-search.jl

Defines a function ternary_search that takes a sorted array and a value to search for within the array. It then applies the ternary search algorithm.

---------

Co-authored-by: David Fernandez <david@Davids-MacBook-Pro.local>
Co-authored-by: Harsh Raj <harshraj8843@gmail.com>
Co-authored-by: Anandha Krishnan S <anandajith@gmail.com>
Co-authored-by: Ritesh Kokam <61982298+RiteshK-611@users.noreply.github.com>
RiteshK-611 pushed a commit that referenced this issue Apr 23, 2024
* Solves issue with swift not finding the largest two elements correctly

* Solves  #5560 Write a Scala program to convert temperature from celsius to kelvin

* Removes #5560 changes

* F# program to implement linear search (#5295)

* Solves 5173: Write a Haskell program to find the largest three elements in an array

* Create FindTheAdjointOfAMatrix.swift

Defines helper functions to compute the determinant, cofactor, and transpose of a matrix.

---------

Co-authored-by: David Fernandez <david@Davids-MacBook-Pro.local>
Co-authored-by: Harsh Raj <harshraj8843@gmail.com>
Co-authored-by: Anandha Krishnan S <anandajith@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
closed closed issues/PRs F# f-sharp related good first issue Good for newcomers program
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants