Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write a F# program to implement selection sort #5333

Closed
Tracked by #5327
harshraj8843 opened this issue Jan 16, 2024 · 2 comments · Fixed by #5754
Closed
Tracked by #5327

Write a F# program to implement selection sort #5333

harshraj8843 opened this issue Jan 16, 2024 · 2 comments · Fixed by #5754
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 selection sort

Selection sort is a sorting algorithm that selects the smallest element from an unsorted list in each iteration and places that element at the beginning of the unsorted list.

Pseudocode

procedure selection sort 
   list  : array of items
   n     : size of list

   for i = 1 to n - 1
   /* set current element as minimum*/
      min = i    
   
      /* check the element to be minimum */

      for j = i+1 to n 
         if list[j] < list[min] then
            min = j;
         end if
      end for

      /* swap the minimum element with the current element*/
      if indexMin != i  then
         swap list[min] and list[i]
      end if
   end for
    
end procedure

Example

Input  : [8, 5, 2, 6, 9, 3, 1, 4, 0, 7]
Output : [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
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-selection-sort/ImplementSelectionSort.fs
  • Commit the changes
  • Create a pull request
@harshraj8843 harshraj8843 added F# f-sharp related good first issue Good for newcomers program labels Jan 16, 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 16, 2024
@Parvezkhan0
Copy link
Contributor

!assign

@codinasion-bot codinasion-bot bot added closed closed issues/PRs and removed triage Waiting for review labels Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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