From 879e3d1c5717f94cd357cc482c768663a6be4f3a Mon Sep 17 00:00:00 2001 From: sanjanavermaa <166320207+sanjanavermaa@users.noreply.github.com> Date: Mon, 28 Oct 2024 15:19:38 +0530 Subject: [PATCH] SelectionSort.python --- Algorithms/selectionSort.python | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 Algorithms/selectionSort.python diff --git a/Algorithms/selectionSort.python b/Algorithms/selectionSort.python new file mode 100644 index 0000000..012790b --- /dev/null +++ b/Algorithms/selectionSort.python @@ -0,0 +1,12 @@ +#python program for selection Sort +def SelectonSort(l): + n=len(l) + #loop to fix element + for i in range(0,n): + #loop to compare elements after ith index + for j in rangfe(i+l,n): + if(l[i]>l[j]): + l[i],l[j]=l[j],l[i] + print(l) + l=[4,9,5,1,0] + SelectionSort(l)