SlideShare a Scribd company logo
LIST IN PYTHON
SELECTION SORT
CLASS: XII
COMPUTER SCIENCE(083)
PART-6
WHAT IS SELECTION SORT?
The Selection sort is based on the idea of finding the minimum or maximum
element in an unsorted array and then putting it in its correct position in a sorted
LIST
How Selection Sort Works?
Step 1: Select the first element of the list and set the first element as minimum
Step 2: Compare minimum with the next element. If the next element is smaller than
minimum, assign the next element as minimum. This process goes on until the last
element.
Step 3: After each iteration, minimum is placed in the front of the unsorted list.
Step 4: Step 1 to 3 are repeated until all the elements are placed at their correct
positions.
How Selection Sort Works?
0 1 2 3 4
20 12 10 15 2
Let Us Understand With The Help Of Example:
no=
These are unsorted number and we need to sort them with the help of selection sort
20 12 10 15 2
Step 1: initialize the list with numbers as shown below:
no=[20,12,10,15,2]
Step 2: Declare variable K and store the
length of list.
no=[20,12,10,15,2]
K=len(no)
0 1 2 3 4
20 12 10 15 2
no=
K=5
Step 4: Start the outer loop x from 0 to K-1
for x in range(0,K):
x=0 k
Step 5: Start the inner loop y from 0 to K-1
Step 5: before starting inner loop store minimum =x the index number
min=x
for y in range(x+1,k):
y=x+1=0+1=1
Step 2: Declare variable K and store the length of list.
no=[20,12,10,15,2]
K=len(no)
0 1 2 3 4
20 12 10 15 2
no=
K=5
Step 4: Start the outer loop x from 0 to K-1
for x in range(0,K):
x=0 k
Step 5: Start the inner loop y from 0 to K-1
Step 5: before starting inner loop store minimum =x the index number
min=x
for y in range(0+1,k):
Step 6: Start if condition inside inner loop to check no[min] value is greater than no[y] or
not.
if no[min]> no[y]:
Step 7: if condition TRUE than overwrite the minimum value with y
min=y
Step 2: Declare variable K and store the length of list.
no=[20,12,10,15,2]
K=len(no)
0 1 2 3 4
20 12 10 15 2
no=
K=5
Step 4: Start the outer loop x from 0 to K-1
for x in range(0,K):
x=0 k
Step 5: Start the inner loop y from 0 to K-1
Step 5: before starting inner loop store minimum =x the index number
min=x
for y in range(0+1,k):
Step 6: Start if condition inside inner loop to check no[min] value is greater than no[y] or not.
if no[min]> no[y]:
Step 7: if condition TRUE than overwrite the minimum value with y
min=y
Step 8:Every time when inner loop finished swapping starts before outer loop move to next step
tmp=no[min]
no[min]=no[x]
no[x]=tmp
Step 2: Declare variable K and store the length of list.
no=[20,12,10,15,2]
K=len(no) 0 1 2 3 4
20 12 10 15 2
no=
K=5
Step 4: Start the outer loop x from 0 to K-1
for x in range(0,K):
x=0 k
Step 5: Start the inner loop y from 0 to K-1
Step 5: before starting inner loop store minimum =x the index number
min=x
for y in range(0+1,k):
Step 6: Start if condition inside inner loop to check no[min] value is greater than no[y] or not.
if no[min]> no[y]:
Step 7: if condition TRUE than overwrite the minimum value with y
min=y
Step 8:Every time when inner loop finished swapping starts before outer loop move to next step
tmp=no[min]
no[min]=no[x]
no[x]=tmp
Step 9: Display the final result
print(no)
no=[10,19,5,4,12,3]
K=len(no)
for x in range(0,K):
min = x
for y in range(x + 1, K):
if no[min]> no[y]:
min = y
temp= no[min];
no[min] = no[x]
no[x]=temp
print("Pass: ",x+1,"=",no)
print("Final List:",no)
SELECTION SORT FULL CODE:
Inner loop
Outer loop
Outer loop
10 19 5 4 12 3
PASS 1 started x=0
Unsorted Value
Y=x+1=1 K
X=0
Inner loop
Outer loop
min=0
SELECTION SORT:
no=[10,19,5,4,12,3]
K=len(no)
for x in range(0,K):
min = x
for y in range(x + 1, K):
if no[min]> no[y]:
min = y
temp= no[min];
no[min] = no[x]
no[x]=temp
print("Pass: ",x+1,"=",no)
print("Final List:",no)
10 19 5 4 12 3no=
0 1 2 3 4 5
x=0 min=x
K
Outer loop [this is pass 1]
Inner loop start where y starts from x+1 to K
y=1 10 19 5 4 12 3 min=0x=0
y=1
K=6(less than 6)
if 10>19 FALSE min value remain same
min=0
SELECTION SORT:
no=[10,19,5,4,12,3]
K=len(no)
for x in range(0,K):
min = x
for y in range(x + 1, K):
if no[min]> no[y]:
min = y
temp= no[min];
no[min] = no[x]
no[x]=temp
print("Pass: ",x+1,"=",no)
print("Final List:",no)
10 19 5 4 12 3no=
0 1 2 3 4 5
x=0 min=x
K
Outer loop [this is pass 1]
y=1
y=2
10 19 5 4 12 3
min=0x=0
y=2
K=6(less than 6)
if 10>5 TRUE min value change to 2
min=0
10 19 5 4 12 3
SELECTION SORT:
no=[10,19,5,4,12,3]
K=len(no)
for x in range(0,K):
min = x
for y in range(x + 1, K):
if no[min]> no[y]:
min = y
temp= no[min];
no[min] = no[x]
no[x]=temp
print("Pass: ",x+1,"=",no)
print("Final List:",no)
10 19 5 4 12 3no=
0 1 2 3 4 5
x=0 min=x
K
Outer loop [this is pass 1]
y=1
y=2
y=3
10 19 5 4 12 3
min=2x=0
K=6(less than 6)
if 5>4 TRUE min value change to 3
10 19 5 4 12 3
y=3min=2
10 19 5 4 12 3
SELECTION SORT:
no=[10,19,5,4,12,3]
K=len(no)
for x in range(0,K):
min = x
for y in range(x + 1, K):
if no[min]> no[y]:
min = y
temp= no[min];
no[min] = no[x]
no[x]=temp
print("Pass: ",x+1,"=",no)
print("Final List:",no)
10 19 5 4 12 3no=
0 1 2 3 4 5
x=0 min=x
K
Outer loop [this is pass 1]
y=1
y=2
y=3
y=4
10 19 5 4 12 3
min=3x=0
K=6(less than 6)
if 4>12 FALSE min value remain 3
10 19 5 4 12 3
y=4min=3
10 19 5 4 12 3
10 19 5 4 12 3
SELECTION SORT:
no=[10,19,5,4,12,3]
K=len(no)
for x in range(0,K):
min = x
for y in range(x + 1, K):
if no[min]> no[y]:
min = y
temp= no[min];
no[min] = no[x]
no[x]=temp
print("Pass: ",x+1,"=",no)
print("Final List:",no)
10 19 5 4 12 3no=
0 1 2 3 4 5
x=0 min=x
K
Outer loop [this is pass 1]
y=1
y=2
y=3
y=4
y=5
10 19 5 4 12 3
min=3x=0
K=6(less than 6)
if 4>3 TRUE min value change to 5
10 19 5 4 12 3
y=5min=3
10 19 5 4 12 3
10 19 5 4 12 3
10 19 5 4 12 3
SELECTION SORT:
no=[10,19,5,4,12,3]
K=len(no)
for x in range(0,K):
min = x
for y in range(x + 1, K):
if no[min]> no[y]:
min = y
temp= no[min];
no[min] = no[x]
no[x]=temp
print("Pass: ",x+1,"=",no)
print("Final List:",no)
10 19 5 4 12 3no=
0 1 2 3 4 5
x=0 min=x
K
Outer loop [this is pass 1]
y=1
y=2
y=3
y=4
y=5
10 19 5 4 12 3
min=5x=0
Now Swapping start
tmp= 3 temp=no[min]
10 19 5 4 12 3
min=5
10 19 5 4 12 3
10 19 5 4 12 3
10 19 5 4 12 3
x=0
swap
Inner loop finish
no[min]=no[x]no[5]= 10
no[0]= 3 no[x]=temp1019 5 4 123
Pass 1 Final value:
1019 5 4 123
PASS 1 FINAL VALUE:
Sorted Value
Unsorted Value
1019 5 4 123
PASS 2 STARTS Where X=1
Sorted Value
Y=x+1=1+1=2 K
X=1
Inner loop
Outer loop
min=1
SELECTION SORT:
no=[10,19,5,4,12,3]
K=len(no)
for x in range(0,K):
min = x
for y in range(x + 1, K):
if no[min]> no[y]:
min = y
temp= no[min];
no[min] = no[x]
no[x]=temp
print("Pass: ",x+1,"=",no)
print("Final List:",no)
3 19 5 4 12 10no=
0 1 2 3 4 5
x=1 min=x
K
Outer loop [this is pass 2]
Inner loop start where y starts from x+1 to K
y=2 3 19 5 4 12 10 min=1x=1
y=2
K=6(less than 6)
if 19>5 TRUE min value Change 2
min=1
SELECTION SORT:
no=[10,19,5,4,12,3]
K=len(no)
for x in range(0,K):
min = x
for y in range(x + 1, K):
if no[min]> no[y]:
min = y
temp= no[min];
no[min] = no[x]
no[x]=temp
print("Pass: ",x+1,"=",no)
print("Final List:",no)
3 19 5 4 12 10no=
0 1 2 3 4 5
x=0 min=x
K
Outer loop [this is pass 1]
y=2
y=3
3 19 5 4 12 10
min=2x=1
y=3
K=6(less than 6)
If 5>4 TRUE min value change to 3
min=2
3 19 5 4 12 10
SELECTION SORT:
no=[10,19,5,4,12,3]
K=len(no)
for x in range(0,K):
min = x
for y in range(x + 1, K):
if no[min]> no[y]:
min = y
temp= no[min];
no[min] = no[x]
no[x]=temp
print("Pass: ",x+1,"=",no)
print("Final List:",no)
3 19 5 4 12 10no=
0 1 2 3 4 5
x=0 min=x
K
Outer loop [this is pass 1]
y=2
y=3
y=4
3 19 5 4 12 10
min=3x=1
K=6(less than 6)
if 4>12 FALSE min value remain same
3 19 5 4 12 10
y=4min=3
3 19 5 4 12 10
SELECTION SORT:
no=[10,19,5,4,12,3]
K=len(no)
for x in range(0,K):
min = x
for y in range(x + 1, K):
if no[min]> no[y]:
min = y
temp= no[min];
no[min] = no[x]
no[x]=temp
print("Pass: ",x+1,"=",no)
print("Final List:",no)
3 19 5 4 12 10no=
0 1 2 3 4 5
x=0 min=x
K
Outer loop [this is pass 1]
y=2
y=3
y=4
y=5
3 19 5 4 12 10
min=3x=1
K=6(less than 6)
If 4>10 FALSE min value remain same
3 19 5 4 12 10
y=5min=3
3 19 5 4 12 10
3 19 5 4 12 10
SELECTION SORT:
no=[10,19,5,4,12,3]
K=len(no)
for x in range(0,K):
min = x
for y in range(x + 1, K):
if no[min]> no[y]:
min = y
temp= no[min];
no[min] = no[x]
no[x]=temp
print("Pass: ",x+1,"=",no)
print("Final List:",no)
3 19 5 4 12 10no=
0 1 2 3 4 5
x=0 min=x
K
Outer loop [this is pass 1]
y=2
y=3
y=4
y=5
3 19 5 4 12 10
min=3x=1
Now Swapping start
tmp= 4 temp=no[min]
3 19 5 4 12 10
min=3
3 19 5 4 12 10
3 19 5 4 12 10
x=1
swap
Inner loop finish
no[min]=no[x]no[3]= 19
no[1]= 4 no[x]=temp101954 123
Pass 2 Final value:
101954 123
PASS 2 FINAL VALUE:
Unsorted Value
Sorted Value
101954 123
PASS 3 STARTS Where X=2
Sorted Value
Y=x+1=3 K
X=2
Inner loop
Outer loop
SELECTION SORT:
no=[10,19,5,4,12,3]
K=len(no)
for x in range(0,K):
min = x
for y in range(x + 1, K):
if no[min]> no[y]:
min = y
temp= no[min];
no[min] = no[x]
no[x]=temp
print("Pass: ",x+1,"=",no)
print("Final List:",no)
3 1954 12 10no=
0 1 2 3 4 5
x=2 min=x
K
Outer loop [this is pass 3]
Inner loop start where y starts from x+1 to K
y=3 3 1954 12 10 min=2x=2
y=3
K=6(less than 6)
If 5>19 FALSE min value remain same
min=2
SELECTION SORT:
no=[10,19,5,4,12,3]
K=len(no)
for x in range(0,K):
min = x
for y in range(x + 1, K):
if no[min]> no[y]:
min = y
temp= no[min];
no[min] = no[x]
no[x]=temp
print("Pass: ",x+1,"=",no)
print("Final List:",no)
3 1954 12 10no=
0 1 2 3 4 5
x=0 min=x
K
Outer loop [this is pass 3]
y=3
y=4
3 1954 12 10
min=2x=2
y=4
K=6(less than 6)
If 5>12 FALSE min value remain same
min=2
3 1954 12 10
SELECTION SORT:
no=[10,19,5,4,12,3]
K=len(no)
for x in range(0,K):
min = x
for y in range(x + 1, K):
if no[min]> no[y]:
min = y
temp= no[min];
no[min] = no[x]
no[x]=temp
print("Pass: ",x+1,"=",no)
print("Final List:",no)
3 1954 12 10no=
0 1 2 3 4 5
x=0 min=x
K
Outer loop [this is pass 3]
y=3
y=4
y=5
3 1954 12 10
min=2x=2
K=6(less than 6)
If 5>10 FALSE min value remain same
3 1954 12 10
y=5min=2
3 1954 12 10
SELECTION SORT:
no=[10,19,5,4,12,3]
K=len(no)
for x in range(0,K):
min = x
for y in range(x + 1, K):
if no[min]> no[y]:
min = y
temp= no[min];
no[min] = no[x]
no[x]=temp
print("Pass: ",x+1,"=",no)
print("Final List:",no)
3 1954 12 10no=
0 1 2 3 4 5
x=0 min=x
K
Outer loop [this is pass 3]
y=3
y=4
y=5
min=2x=2
Now Swapping start
tmp= 5 temp=no[min]
3 1954 12 10
min=2
3 1954 12 10
3 1954 12 10
x=2swap
Inner loop finish
no[min]=no[x]no[2]= 5
no[2]= 5 no[x]=temp101954 123
Pass 3 Final value:
101954 123
PASS 3 FINAL VALUE:
Unsorted Value
Sorted Value
101954 123
PASS 4 STARTS Where X=3
Sorted Value
Y=x+1=4 K
X=3
Inner loop
Outer loop
SELECTION SORT:
no=[10,19,5,4,12,3]
K=len(no)
for x in range(0,K):
min = x
for y in range(x + 1, K):
if no[min]> no[y]:
min = y
temp= no[min];
no[min] = no[x]
no[x]=temp
print("Pass: ",x+1,"=",no)
print("Final List:",no)
3 1954 12 10no=
0 1 2 3 4 5
x=3 min=x
K
Outer loop [this is pass 4]
Inner loop start where y starts from x+1 to K
y=4 3 1954 12 10 min=3x=3
y=4
K=6(less than 6)
If 19>12 TRUE min value change to 4
min=3
SELECTION SORT:
no=[10,19,5,4,12,3]
K=len(no)
for x in range(0,K):
min = x
for y in range(x + 1, K):
if no[min]> no[y]:
min = y
temp= no[min];
no[min] = no[x]
no[x]=temp
print("Pass: ",x+1,"=",no)
print("Final List:",no)
3 1954 12 10no=
0 1 2 3 4 5
x=3 min=x
K
Outer loop [this is pass 4]
y=4
y=5
3 1954 12 10
min=4x=3
y=5
K=6(less than 6)
If 12>10 TRUE min value change to 5
min=4
3 1954 12 10
SELECTION SORT:
no=[10,19,5,4,12,3]
K=len(no)
for x in range(0,K):
min = x
for y in range(x + 1, K):
if no[min]> no[y]:
min = y
temp= no[min];
no[min] = no[x]
no[x]=temp
print("Pass: ",x+1,"=",no)
print("Final List:",no)
3 1954 12 10no=
0 1 2 3 4 5
x=3 min=x
K
Outer loop [this is pass 4]
y=4
y=5
min=5
x=3
Now Swapping start
tmp= 10 temp=no[min]
min=5
3 1954 12 10
3 1954 12 10
x=3
swap
Inner loop finish
no[min]=no[x]no[5]= 19
no[3]= 10 no[x]=temp191054 123
Pass 4 Final value:
10 1954 123
PASS 4 FINAL VALUE:
Unsorted Value
Sorted Value
10 1954 123
PASS 5 STARTS Where X=4
Sorted Value
Y=x+1=5
K
x=4
Inner loop
Outer loop
SELECTION SORT:
no=[10,19,5,4,12,3]
K=len(no)
for x in range(0,K):
min = x
for y in range(x + 1, K):
if no[min]> no[y]:
min = y
temp= no[min];
no[min] = no[x]
no[x]=temp
print("Pass: ",x+1,"=",no)
print("Final List:",no)
3 1054 12 19no=
0 1 2 3 4 5
x=4 min=x
K
Outer loop [this is pass 5]
Inner loop start where y starts from x+1 to K
y=5 3 1054 12 19 min=4x=4
y=5
K=6(less than 6)
If 12>19 FALSE min value remain same
min=4
SELECTION SORT:
no=[10,19,5,4,12,3]
K=len(no)
for x in range(0,K):
min = x
for y in range(x + 1, K):
if no[min]> no[y]:
min = y
temp= no[min];
no[min] = no[x]
no[x]=temp
print("Pass: ",x+1,"=",no)
print("Final List:",no)
3 1054 12 19no=
0 1 2 3 4 5
x=3 min=x
K
Outer loop [this is pass 4]
y=5
min=4
x=4
Now Swapping start
tmp= 12 temp=no[min]
min=4
3 1054 12 19
x=4
swap
Inner loop finish
no[min]=no[x]no[4]= 12
no[4]= 12 no[x]=temp191054 123
Pass 5 Final value:
10 1954 123
PASS 5 FINAL VALUE:
Unsorted Value
Sorted Value
10 1954 123
FINAL RESULT OF SELECTION SORT:
Sorted Value

More Related Content

What's hot

Divide and conquer surfing lower bounds
Divide and conquer  surfing lower boundsDivide and conquer  surfing lower bounds
Divide and conquer surfing lower bounds
Rajendran
 
the two phase method - operations research
the two phase method - operations researchthe two phase method - operations research
the two phase method - operations research
2013901097
 
Two phase method lpp
Two phase method lppTwo phase method lpp
Two phase method lpp
Anurag Srivastava
 
Operations Research - The Dual Simplex Method
Operations Research - The Dual Simplex MethodOperations Research - The Dual Simplex Method
Operations Research - The Dual Simplex Method
Hisham Al Kurdi, EAVA, DMC-D-4K, HCCA-P, HCAA-D
 
Ch02
Ch02Ch02
Ch02
waiwai28
 
Lpp simplex method
Lpp simplex methodLpp simplex method
Lpp simplex method
Sneha Malhotra
 
Operations Research - The Two Phase Method
Operations Research - The Two Phase MethodOperations Research - The Two Phase Method
Operations Research - The Two Phase Method
Hisham Al Kurdi, EAVA, DMC-D-4K, HCCA-P, HCAA-D
 
LINEAR PROGRAMMING
LINEAR PROGRAMMINGLINEAR PROGRAMMING
LINEAR PROGRAMMING
Er Ashish Bansode
 
C2 st lecture 4 handout
C2 st lecture 4 handoutC2 st lecture 4 handout
C2 st lecture 4 handout
fatima d
 
Lec16
Lec16Lec16
Differentiation jan 21, 2014
Differentiation jan 21, 2014Differentiation jan 21, 2014
Differentiation jan 21, 2014
Mohammed Ahmed
 
Big-M Method Presentation
Big-M Method PresentationBig-M Method Presentation
Big-M Method Presentation
Nitesh Singh Patel
 
C2 st lecture 3 handout
C2 st lecture 3 handoutC2 st lecture 3 handout
C2 st lecture 3 handout
fatima d
 
Simplex Method
Simplex MethodSimplex Method
Simplex Method
Sachin MK
 
Linear programming ppt
Linear programming pptLinear programming ppt
Linear programming ppt
Meenakshi Tripathi
 
Simplex two phase
Simplex two phaseSimplex two phase
Simplex two phase
Shakti Ranjan
 
Differentiation
DifferentiationDifferentiation
Differentiation
guest39541b
 
Two Phase Method- Linear Programming
Two Phase Method- Linear ProgrammingTwo Phase Method- Linear Programming
Two Phase Method- Linear Programming
Manas Lad
 
Testsol
TestsolTestsol
Testsol
Najmi Madzlan
 
Chapter 6 base_number
Chapter 6 base_numberChapter 6 base_number
Chapter 6 base_number
Nazrul Shah
 

What's hot (20)

Divide and conquer surfing lower bounds
Divide and conquer  surfing lower boundsDivide and conquer  surfing lower bounds
Divide and conquer surfing lower bounds
 
the two phase method - operations research
the two phase method - operations researchthe two phase method - operations research
the two phase method - operations research
 
Two phase method lpp
Two phase method lppTwo phase method lpp
Two phase method lpp
 
Operations Research - The Dual Simplex Method
Operations Research - The Dual Simplex MethodOperations Research - The Dual Simplex Method
Operations Research - The Dual Simplex Method
 
Ch02
Ch02Ch02
Ch02
 
Lpp simplex method
Lpp simplex methodLpp simplex method
Lpp simplex method
 
Operations Research - The Two Phase Method
Operations Research - The Two Phase MethodOperations Research - The Two Phase Method
Operations Research - The Two Phase Method
 
LINEAR PROGRAMMING
LINEAR PROGRAMMINGLINEAR PROGRAMMING
LINEAR PROGRAMMING
 
C2 st lecture 4 handout
C2 st lecture 4 handoutC2 st lecture 4 handout
C2 st lecture 4 handout
 
Lec16
Lec16Lec16
Lec16
 
Differentiation jan 21, 2014
Differentiation jan 21, 2014Differentiation jan 21, 2014
Differentiation jan 21, 2014
 
Big-M Method Presentation
Big-M Method PresentationBig-M Method Presentation
Big-M Method Presentation
 
C2 st lecture 3 handout
C2 st lecture 3 handoutC2 st lecture 3 handout
C2 st lecture 3 handout
 
Simplex Method
Simplex MethodSimplex Method
Simplex Method
 
Linear programming ppt
Linear programming pptLinear programming ppt
Linear programming ppt
 
Simplex two phase
Simplex two phaseSimplex two phase
Simplex two phase
 
Differentiation
DifferentiationDifferentiation
Differentiation
 
Two Phase Method- Linear Programming
Two Phase Method- Linear ProgrammingTwo Phase Method- Linear Programming
Two Phase Method- Linear Programming
 
Testsol
TestsolTestsol
Testsol
 
Chapter 6 base_number
Chapter 6 base_numberChapter 6 base_number
Chapter 6 base_number
 

Similar to LIST IN PYTHON[SELECTION SORT]

LIST IN PYTHON[BUBBLE SORT]
LIST IN PYTHON[BUBBLE SORT]LIST IN PYTHON[BUBBLE SORT]
LIST IN PYTHON[BUBBLE SORT]
vikram mahendra
 
5.2 divede and conquer 03
5.2 divede and conquer 035.2 divede and conquer 03
5.2 divede and conquer 03
Krish_ver2
 
5.2 divede and conquer 03
5.2 divede and conquer 035.2 divede and conquer 03
5.2 divede and conquer 03
Krish_ver2
 
Time complexity
Time complexityTime complexity
Time complexity
Katang Isip
 
Randomized algorithms ver 1.0
Randomized algorithms ver 1.0Randomized algorithms ver 1.0
Randomized algorithms ver 1.0
Dr. C.V. Suresh Babu
 
Palm ch1
Palm ch1Palm ch1
Palm ch1
Heera Rawat
 
ملخص البرمجة المرئية - الوحدة الخامسة
ملخص البرمجة المرئية - الوحدة الخامسةملخص البرمجة المرئية - الوحدة الخامسة
ملخص البرمجة المرئية - الوحدة الخامسة
جامعة القدس المفتوحة
 
OpenOpt の線形計画で圧縮センシング
OpenOpt の線形計画で圧縮センシングOpenOpt の線形計画で圧縮センシング
OpenOpt の線形計画で圧縮センシング
Toshihiro Kamishima
 
Solucionario_de_Chapra_y_Canale_Quinta_E.pdf
Solucionario_de_Chapra_y_Canale_Quinta_E.pdfSolucionario_de_Chapra_y_Canale_Quinta_E.pdf
Solucionario_de_Chapra_y_Canale_Quinta_E.pdf
JeancarlosPatalasanc
 
SG 8 Lecture 15 Simplex - Min - 2 phase.pptx
SG 8 Lecture 15 Simplex - Min - 2 phase.pptxSG 8 Lecture 15 Simplex - Min - 2 phase.pptx
SG 8 Lecture 15 Simplex - Min - 2 phase.pptx
yashchotaliyael21
 
Daa unit iv - problems
Daa   unit  iv - problemsDaa   unit  iv - problems
Gilat_ch03.pdf
Gilat_ch03.pdfGilat_ch03.pdf
Gilat_ch03.pdf
ArhamQadeer
 
Recursion
RecursionRecursion
Recursion
Syed Zaid Irshad
 
module2_dIVIDEncONQUER_2022.pdf
module2_dIVIDEncONQUER_2022.pdfmodule2_dIVIDEncONQUER_2022.pdf
module2_dIVIDEncONQUER_2022.pdf
Shiwani Gupta
 
Unit III Version I.pptx
Unit III Version I.pptxUnit III Version I.pptx
Unit III Version I.pptx
ssuserd602fd
 
Soft Heaps
Soft HeapsSoft Heaps
Mathematical Modelling of Electro-Mechanical System in Matlab
Mathematical Modelling of Electro-Mechanical System in MatlabMathematical Modelling of Electro-Mechanical System in Matlab
Mathematical Modelling of Electro-Mechanical System in Matlab
COMSATS Abbottabad
 
Solutions manual for fundamentals of business math canadian 3rd edition by je...
Solutions manual for fundamentals of business math canadian 3rd edition by je...Solutions manual for fundamentals of business math canadian 3rd edition by je...
Solutions manual for fundamentals of business math canadian 3rd edition by je...
Pollockker
 
Learn Matlab
Learn MatlabLearn Matlab
Learn Matlab
Abd El Kareem Ahmed
 
Unit 7 sorting
Unit 7   sortingUnit 7   sorting
Unit 7 sorting
kalyanineve
 

Similar to LIST IN PYTHON[SELECTION SORT] (20)

LIST IN PYTHON[BUBBLE SORT]
LIST IN PYTHON[BUBBLE SORT]LIST IN PYTHON[BUBBLE SORT]
LIST IN PYTHON[BUBBLE SORT]
 
5.2 divede and conquer 03
5.2 divede and conquer 035.2 divede and conquer 03
5.2 divede and conquer 03
 
5.2 divede and conquer 03
5.2 divede and conquer 035.2 divede and conquer 03
5.2 divede and conquer 03
 
Time complexity
Time complexityTime complexity
Time complexity
 
Randomized algorithms ver 1.0
Randomized algorithms ver 1.0Randomized algorithms ver 1.0
Randomized algorithms ver 1.0
 
Palm ch1
Palm ch1Palm ch1
Palm ch1
 
ملخص البرمجة المرئية - الوحدة الخامسة
ملخص البرمجة المرئية - الوحدة الخامسةملخص البرمجة المرئية - الوحدة الخامسة
ملخص البرمجة المرئية - الوحدة الخامسة
 
OpenOpt の線形計画で圧縮センシング
OpenOpt の線形計画で圧縮センシングOpenOpt の線形計画で圧縮センシング
OpenOpt の線形計画で圧縮センシング
 
Solucionario_de_Chapra_y_Canale_Quinta_E.pdf
Solucionario_de_Chapra_y_Canale_Quinta_E.pdfSolucionario_de_Chapra_y_Canale_Quinta_E.pdf
Solucionario_de_Chapra_y_Canale_Quinta_E.pdf
 
SG 8 Lecture 15 Simplex - Min - 2 phase.pptx
SG 8 Lecture 15 Simplex - Min - 2 phase.pptxSG 8 Lecture 15 Simplex - Min - 2 phase.pptx
SG 8 Lecture 15 Simplex - Min - 2 phase.pptx
 
Daa unit iv - problems
Daa   unit  iv - problemsDaa   unit  iv - problems
Daa unit iv - problems
 
Gilat_ch03.pdf
Gilat_ch03.pdfGilat_ch03.pdf
Gilat_ch03.pdf
 
Recursion
RecursionRecursion
Recursion
 
module2_dIVIDEncONQUER_2022.pdf
module2_dIVIDEncONQUER_2022.pdfmodule2_dIVIDEncONQUER_2022.pdf
module2_dIVIDEncONQUER_2022.pdf
 
Unit III Version I.pptx
Unit III Version I.pptxUnit III Version I.pptx
Unit III Version I.pptx
 
Soft Heaps
Soft HeapsSoft Heaps
Soft Heaps
 
Mathematical Modelling of Electro-Mechanical System in Matlab
Mathematical Modelling of Electro-Mechanical System in MatlabMathematical Modelling of Electro-Mechanical System in Matlab
Mathematical Modelling of Electro-Mechanical System in Matlab
 
Solutions manual for fundamentals of business math canadian 3rd edition by je...
Solutions manual for fundamentals of business math canadian 3rd edition by je...Solutions manual for fundamentals of business math canadian 3rd edition by je...
Solutions manual for fundamentals of business math canadian 3rd edition by je...
 
Learn Matlab
Learn MatlabLearn Matlab
Learn Matlab
 
Unit 7 sorting
Unit 7   sortingUnit 7   sorting
Unit 7 sorting
 

More from vikram mahendra

Communication skill
Communication skillCommunication skill
Communication skill
vikram mahendra
 
Python Project On Cosmetic Shop system
Python Project On Cosmetic Shop systemPython Project On Cosmetic Shop system
Python Project On Cosmetic Shop system
vikram mahendra
 
Python Project on Computer Shop
Python Project on Computer ShopPython Project on Computer Shop
Python Project on Computer Shop
vikram mahendra
 
PYTHON PROJECT ON CARSHOP SYSTEM
PYTHON PROJECT ON CARSHOP SYSTEMPYTHON PROJECT ON CARSHOP SYSTEM
PYTHON PROJECT ON CARSHOP SYSTEM
vikram mahendra
 
BOOK SHOP SYSTEM Project in Python
BOOK SHOP SYSTEM Project in PythonBOOK SHOP SYSTEM Project in Python
BOOK SHOP SYSTEM Project in Python
vikram mahendra
 
FLOW OF CONTROL-NESTED IFS IN PYTHON
FLOW OF CONTROL-NESTED IFS IN PYTHONFLOW OF CONTROL-NESTED IFS IN PYTHON
FLOW OF CONTROL-NESTED IFS IN PYTHON
vikram mahendra
 
FLOWOFCONTROL-IF..ELSE PYTHON
FLOWOFCONTROL-IF..ELSE PYTHONFLOWOFCONTROL-IF..ELSE PYTHON
FLOWOFCONTROL-IF..ELSE PYTHON
vikram mahendra
 
FLOW OF CONTROL-INTRO PYTHON
FLOW OF CONTROL-INTRO PYTHONFLOW OF CONTROL-INTRO PYTHON
FLOW OF CONTROL-INTRO PYTHON
vikram mahendra
 
OPERATOR IN PYTHON-PART1
OPERATOR IN PYTHON-PART1OPERATOR IN PYTHON-PART1
OPERATOR IN PYTHON-PART1
vikram mahendra
 
OPERATOR IN PYTHON-PART2
OPERATOR IN PYTHON-PART2OPERATOR IN PYTHON-PART2
OPERATOR IN PYTHON-PART2
vikram mahendra
 
USE OF PRINT IN PYTHON PART 2
USE OF PRINT IN PYTHON PART 2USE OF PRINT IN PYTHON PART 2
USE OF PRINT IN PYTHON PART 2
vikram mahendra
 
DATA TYPE IN PYTHON
DATA TYPE IN PYTHONDATA TYPE IN PYTHON
DATA TYPE IN PYTHON
vikram mahendra
 
USER DEFINE FUNCTIONS IN PYTHON[WITH PARAMETERS]
USER DEFINE FUNCTIONS IN PYTHON[WITH PARAMETERS]USER DEFINE FUNCTIONS IN PYTHON[WITH PARAMETERS]
USER DEFINE FUNCTIONS IN PYTHON[WITH PARAMETERS]
vikram mahendra
 
USER DEFINE FUNCTIONS IN PYTHON
USER DEFINE FUNCTIONS IN PYTHONUSER DEFINE FUNCTIONS IN PYTHON
USER DEFINE FUNCTIONS IN PYTHON
vikram mahendra
 
FUNCTIONS IN PYTHON[RANDOM FUNCTION]
FUNCTIONS IN PYTHON[RANDOM FUNCTION]FUNCTIONS IN PYTHON[RANDOM FUNCTION]
FUNCTIONS IN PYTHON[RANDOM FUNCTION]
vikram mahendra
 
INTRODUCTION TO FUNCTIONS IN PYTHON
INTRODUCTION TO FUNCTIONS IN PYTHONINTRODUCTION TO FUNCTIONS IN PYTHON
INTRODUCTION TO FUNCTIONS IN PYTHON
vikram mahendra
 
Python Introduction
Python IntroductionPython Introduction
Python Introduction
vikram mahendra
 
GREEN SKILL[PART-2]
GREEN SKILL[PART-2]GREEN SKILL[PART-2]
GREEN SKILL[PART-2]
vikram mahendra
 
GREEN SKILLS[PART-1]
GREEN SKILLS[PART-1]GREEN SKILLS[PART-1]
GREEN SKILLS[PART-1]
vikram mahendra
 
Dictionary in python
Dictionary in pythonDictionary in python
Dictionary in python
vikram mahendra
 

More from vikram mahendra (20)

Communication skill
Communication skillCommunication skill
Communication skill
 
Python Project On Cosmetic Shop system
Python Project On Cosmetic Shop systemPython Project On Cosmetic Shop system
Python Project On Cosmetic Shop system
 
Python Project on Computer Shop
Python Project on Computer ShopPython Project on Computer Shop
Python Project on Computer Shop
 
PYTHON PROJECT ON CARSHOP SYSTEM
PYTHON PROJECT ON CARSHOP SYSTEMPYTHON PROJECT ON CARSHOP SYSTEM
PYTHON PROJECT ON CARSHOP SYSTEM
 
BOOK SHOP SYSTEM Project in Python
BOOK SHOP SYSTEM Project in PythonBOOK SHOP SYSTEM Project in Python
BOOK SHOP SYSTEM Project in Python
 
FLOW OF CONTROL-NESTED IFS IN PYTHON
FLOW OF CONTROL-NESTED IFS IN PYTHONFLOW OF CONTROL-NESTED IFS IN PYTHON
FLOW OF CONTROL-NESTED IFS IN PYTHON
 
FLOWOFCONTROL-IF..ELSE PYTHON
FLOWOFCONTROL-IF..ELSE PYTHONFLOWOFCONTROL-IF..ELSE PYTHON
FLOWOFCONTROL-IF..ELSE PYTHON
 
FLOW OF CONTROL-INTRO PYTHON
FLOW OF CONTROL-INTRO PYTHONFLOW OF CONTROL-INTRO PYTHON
FLOW OF CONTROL-INTRO PYTHON
 
OPERATOR IN PYTHON-PART1
OPERATOR IN PYTHON-PART1OPERATOR IN PYTHON-PART1
OPERATOR IN PYTHON-PART1
 
OPERATOR IN PYTHON-PART2
OPERATOR IN PYTHON-PART2OPERATOR IN PYTHON-PART2
OPERATOR IN PYTHON-PART2
 
USE OF PRINT IN PYTHON PART 2
USE OF PRINT IN PYTHON PART 2USE OF PRINT IN PYTHON PART 2
USE OF PRINT IN PYTHON PART 2
 
DATA TYPE IN PYTHON
DATA TYPE IN PYTHONDATA TYPE IN PYTHON
DATA TYPE IN PYTHON
 
USER DEFINE FUNCTIONS IN PYTHON[WITH PARAMETERS]
USER DEFINE FUNCTIONS IN PYTHON[WITH PARAMETERS]USER DEFINE FUNCTIONS IN PYTHON[WITH PARAMETERS]
USER DEFINE FUNCTIONS IN PYTHON[WITH PARAMETERS]
 
USER DEFINE FUNCTIONS IN PYTHON
USER DEFINE FUNCTIONS IN PYTHONUSER DEFINE FUNCTIONS IN PYTHON
USER DEFINE FUNCTIONS IN PYTHON
 
FUNCTIONS IN PYTHON[RANDOM FUNCTION]
FUNCTIONS IN PYTHON[RANDOM FUNCTION]FUNCTIONS IN PYTHON[RANDOM FUNCTION]
FUNCTIONS IN PYTHON[RANDOM FUNCTION]
 
INTRODUCTION TO FUNCTIONS IN PYTHON
INTRODUCTION TO FUNCTIONS IN PYTHONINTRODUCTION TO FUNCTIONS IN PYTHON
INTRODUCTION TO FUNCTIONS IN PYTHON
 
Python Introduction
Python IntroductionPython Introduction
Python Introduction
 
GREEN SKILL[PART-2]
GREEN SKILL[PART-2]GREEN SKILL[PART-2]
GREEN SKILL[PART-2]
 
GREEN SKILLS[PART-1]
GREEN SKILLS[PART-1]GREEN SKILLS[PART-1]
GREEN SKILLS[PART-1]
 
Dictionary in python
Dictionary in pythonDictionary in python
Dictionary in python
 

Recently uploaded

Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
MJDuyan
 
Lifelines of National Economy chapter for Class 10 STUDY MATERIAL PDF
Lifelines of National Economy chapter for Class 10 STUDY MATERIAL PDFLifelines of National Economy chapter for Class 10 STUDY MATERIAL PDF
Lifelines of National Economy chapter for Class 10 STUDY MATERIAL PDF
Vivekanand Anglo Vedic Academy
 
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching AptitudeUGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
S. Raj Kumar
 
Bonku-Babus-Friend by Sathyajith Ray (9)
Bonku-Babus-Friend by Sathyajith Ray  (9)Bonku-Babus-Friend by Sathyajith Ray  (9)
Bonku-Babus-Friend by Sathyajith Ray (9)
nitinpv4ai
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
Himanshu Rai
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Denish Jangid
 
Benner "Expanding Pathways to Publishing Careers"
Benner "Expanding Pathways to Publishing Careers"Benner "Expanding Pathways to Publishing Careers"
Benner "Expanding Pathways to Publishing Careers"
National Information Standards Organization (NISO)
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
iammrhaywood
 
Standardized tool for Intelligence test.
Standardized tool for Intelligence test.Standardized tool for Intelligence test.
Standardized tool for Intelligence test.
deepaannamalai16
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
MysoreMuleSoftMeetup
 
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.pptLevel 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Henry Hollis
 
SWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptxSWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptx
zuzanka
 
Electric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger HuntElectric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger Hunt
RamseyBerglund
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdfREASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
giancarloi8888
 

Recently uploaded (20)

Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
 
Lifelines of National Economy chapter for Class 10 STUDY MATERIAL PDF
Lifelines of National Economy chapter for Class 10 STUDY MATERIAL PDFLifelines of National Economy chapter for Class 10 STUDY MATERIAL PDF
Lifelines of National Economy chapter for Class 10 STUDY MATERIAL PDF
 
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching AptitudeUGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
 
Bonku-Babus-Friend by Sathyajith Ray (9)
Bonku-Babus-Friend by Sathyajith Ray  (9)Bonku-Babus-Friend by Sathyajith Ray  (9)
Bonku-Babus-Friend by Sathyajith Ray (9)
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
 
Benner "Expanding Pathways to Publishing Careers"
Benner "Expanding Pathways to Publishing Careers"Benner "Expanding Pathways to Publishing Careers"
Benner "Expanding Pathways to Publishing Careers"
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
 
Standardized tool for Intelligence test.
Standardized tool for Intelligence test.Standardized tool for Intelligence test.
Standardized tool for Intelligence test.
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
 
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.pptLevel 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
 
SWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptxSWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptx
 
Electric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger HuntElectric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger Hunt
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdfREASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
 

LIST IN PYTHON[SELECTION SORT]

  • 1. LIST IN PYTHON SELECTION SORT CLASS: XII COMPUTER SCIENCE(083) PART-6
  • 2. WHAT IS SELECTION SORT? The Selection sort is based on the idea of finding the minimum or maximum element in an unsorted array and then putting it in its correct position in a sorted LIST How Selection Sort Works? Step 1: Select the first element of the list and set the first element as minimum Step 2: Compare minimum with the next element. If the next element is smaller than minimum, assign the next element as minimum. This process goes on until the last element. Step 3: After each iteration, minimum is placed in the front of the unsorted list. Step 4: Step 1 to 3 are repeated until all the elements are placed at their correct positions.
  • 3. How Selection Sort Works? 0 1 2 3 4 20 12 10 15 2 Let Us Understand With The Help Of Example: no= These are unsorted number and we need to sort them with the help of selection sort 20 12 10 15 2 Step 1: initialize the list with numbers as shown below: no=[20,12,10,15,2]
  • 4. Step 2: Declare variable K and store the length of list. no=[20,12,10,15,2] K=len(no) 0 1 2 3 4 20 12 10 15 2 no= K=5 Step 4: Start the outer loop x from 0 to K-1 for x in range(0,K): x=0 k Step 5: Start the inner loop y from 0 to K-1 Step 5: before starting inner loop store minimum =x the index number min=x for y in range(x+1,k): y=x+1=0+1=1
  • 5. Step 2: Declare variable K and store the length of list. no=[20,12,10,15,2] K=len(no) 0 1 2 3 4 20 12 10 15 2 no= K=5 Step 4: Start the outer loop x from 0 to K-1 for x in range(0,K): x=0 k Step 5: Start the inner loop y from 0 to K-1 Step 5: before starting inner loop store minimum =x the index number min=x for y in range(0+1,k): Step 6: Start if condition inside inner loop to check no[min] value is greater than no[y] or not. if no[min]> no[y]: Step 7: if condition TRUE than overwrite the minimum value with y min=y
  • 6. Step 2: Declare variable K and store the length of list. no=[20,12,10,15,2] K=len(no) 0 1 2 3 4 20 12 10 15 2 no= K=5 Step 4: Start the outer loop x from 0 to K-1 for x in range(0,K): x=0 k Step 5: Start the inner loop y from 0 to K-1 Step 5: before starting inner loop store minimum =x the index number min=x for y in range(0+1,k): Step 6: Start if condition inside inner loop to check no[min] value is greater than no[y] or not. if no[min]> no[y]: Step 7: if condition TRUE than overwrite the minimum value with y min=y Step 8:Every time when inner loop finished swapping starts before outer loop move to next step tmp=no[min] no[min]=no[x] no[x]=tmp
  • 7. Step 2: Declare variable K and store the length of list. no=[20,12,10,15,2] K=len(no) 0 1 2 3 4 20 12 10 15 2 no= K=5 Step 4: Start the outer loop x from 0 to K-1 for x in range(0,K): x=0 k Step 5: Start the inner loop y from 0 to K-1 Step 5: before starting inner loop store minimum =x the index number min=x for y in range(0+1,k): Step 6: Start if condition inside inner loop to check no[min] value is greater than no[y] or not. if no[min]> no[y]: Step 7: if condition TRUE than overwrite the minimum value with y min=y Step 8:Every time when inner loop finished swapping starts before outer loop move to next step tmp=no[min] no[min]=no[x] no[x]=tmp Step 9: Display the final result print(no)
  • 8. no=[10,19,5,4,12,3] K=len(no) for x in range(0,K): min = x for y in range(x + 1, K): if no[min]> no[y]: min = y temp= no[min]; no[min] = no[x] no[x]=temp print("Pass: ",x+1,"=",no) print("Final List:",no) SELECTION SORT FULL CODE: Inner loop Outer loop Outer loop
  • 9. 10 19 5 4 12 3 PASS 1 started x=0 Unsorted Value Y=x+1=1 K X=0 Inner loop Outer loop min=0
  • 10. SELECTION SORT: no=[10,19,5,4,12,3] K=len(no) for x in range(0,K): min = x for y in range(x + 1, K): if no[min]> no[y]: min = y temp= no[min]; no[min] = no[x] no[x]=temp print("Pass: ",x+1,"=",no) print("Final List:",no) 10 19 5 4 12 3no= 0 1 2 3 4 5 x=0 min=x K Outer loop [this is pass 1] Inner loop start where y starts from x+1 to K y=1 10 19 5 4 12 3 min=0x=0 y=1 K=6(less than 6) if 10>19 FALSE min value remain same min=0
  • 11. SELECTION SORT: no=[10,19,5,4,12,3] K=len(no) for x in range(0,K): min = x for y in range(x + 1, K): if no[min]> no[y]: min = y temp= no[min]; no[min] = no[x] no[x]=temp print("Pass: ",x+1,"=",no) print("Final List:",no) 10 19 5 4 12 3no= 0 1 2 3 4 5 x=0 min=x K Outer loop [this is pass 1] y=1 y=2 10 19 5 4 12 3 min=0x=0 y=2 K=6(less than 6) if 10>5 TRUE min value change to 2 min=0 10 19 5 4 12 3
  • 12. SELECTION SORT: no=[10,19,5,4,12,3] K=len(no) for x in range(0,K): min = x for y in range(x + 1, K): if no[min]> no[y]: min = y temp= no[min]; no[min] = no[x] no[x]=temp print("Pass: ",x+1,"=",no) print("Final List:",no) 10 19 5 4 12 3no= 0 1 2 3 4 5 x=0 min=x K Outer loop [this is pass 1] y=1 y=2 y=3 10 19 5 4 12 3 min=2x=0 K=6(less than 6) if 5>4 TRUE min value change to 3 10 19 5 4 12 3 y=3min=2 10 19 5 4 12 3
  • 13. SELECTION SORT: no=[10,19,5,4,12,3] K=len(no) for x in range(0,K): min = x for y in range(x + 1, K): if no[min]> no[y]: min = y temp= no[min]; no[min] = no[x] no[x]=temp print("Pass: ",x+1,"=",no) print("Final List:",no) 10 19 5 4 12 3no= 0 1 2 3 4 5 x=0 min=x K Outer loop [this is pass 1] y=1 y=2 y=3 y=4 10 19 5 4 12 3 min=3x=0 K=6(less than 6) if 4>12 FALSE min value remain 3 10 19 5 4 12 3 y=4min=3 10 19 5 4 12 3 10 19 5 4 12 3
  • 14. SELECTION SORT: no=[10,19,5,4,12,3] K=len(no) for x in range(0,K): min = x for y in range(x + 1, K): if no[min]> no[y]: min = y temp= no[min]; no[min] = no[x] no[x]=temp print("Pass: ",x+1,"=",no) print("Final List:",no) 10 19 5 4 12 3no= 0 1 2 3 4 5 x=0 min=x K Outer loop [this is pass 1] y=1 y=2 y=3 y=4 y=5 10 19 5 4 12 3 min=3x=0 K=6(less than 6) if 4>3 TRUE min value change to 5 10 19 5 4 12 3 y=5min=3 10 19 5 4 12 3 10 19 5 4 12 3 10 19 5 4 12 3
  • 15. SELECTION SORT: no=[10,19,5,4,12,3] K=len(no) for x in range(0,K): min = x for y in range(x + 1, K): if no[min]> no[y]: min = y temp= no[min]; no[min] = no[x] no[x]=temp print("Pass: ",x+1,"=",no) print("Final List:",no) 10 19 5 4 12 3no= 0 1 2 3 4 5 x=0 min=x K Outer loop [this is pass 1] y=1 y=2 y=3 y=4 y=5 10 19 5 4 12 3 min=5x=0 Now Swapping start tmp= 3 temp=no[min] 10 19 5 4 12 3 min=5 10 19 5 4 12 3 10 19 5 4 12 3 10 19 5 4 12 3 x=0 swap Inner loop finish no[min]=no[x]no[5]= 10 no[0]= 3 no[x]=temp1019 5 4 123 Pass 1 Final value:
  • 16. 1019 5 4 123 PASS 1 FINAL VALUE: Sorted Value Unsorted Value
  • 17. 1019 5 4 123 PASS 2 STARTS Where X=1 Sorted Value Y=x+1=1+1=2 K X=1 Inner loop Outer loop min=1
  • 18. SELECTION SORT: no=[10,19,5,4,12,3] K=len(no) for x in range(0,K): min = x for y in range(x + 1, K): if no[min]> no[y]: min = y temp= no[min]; no[min] = no[x] no[x]=temp print("Pass: ",x+1,"=",no) print("Final List:",no) 3 19 5 4 12 10no= 0 1 2 3 4 5 x=1 min=x K Outer loop [this is pass 2] Inner loop start where y starts from x+1 to K y=2 3 19 5 4 12 10 min=1x=1 y=2 K=6(less than 6) if 19>5 TRUE min value Change 2 min=1
  • 19. SELECTION SORT: no=[10,19,5,4,12,3] K=len(no) for x in range(0,K): min = x for y in range(x + 1, K): if no[min]> no[y]: min = y temp= no[min]; no[min] = no[x] no[x]=temp print("Pass: ",x+1,"=",no) print("Final List:",no) 3 19 5 4 12 10no= 0 1 2 3 4 5 x=0 min=x K Outer loop [this is pass 1] y=2 y=3 3 19 5 4 12 10 min=2x=1 y=3 K=6(less than 6) If 5>4 TRUE min value change to 3 min=2 3 19 5 4 12 10
  • 20. SELECTION SORT: no=[10,19,5,4,12,3] K=len(no) for x in range(0,K): min = x for y in range(x + 1, K): if no[min]> no[y]: min = y temp= no[min]; no[min] = no[x] no[x]=temp print("Pass: ",x+1,"=",no) print("Final List:",no) 3 19 5 4 12 10no= 0 1 2 3 4 5 x=0 min=x K Outer loop [this is pass 1] y=2 y=3 y=4 3 19 5 4 12 10 min=3x=1 K=6(less than 6) if 4>12 FALSE min value remain same 3 19 5 4 12 10 y=4min=3 3 19 5 4 12 10
  • 21. SELECTION SORT: no=[10,19,5,4,12,3] K=len(no) for x in range(0,K): min = x for y in range(x + 1, K): if no[min]> no[y]: min = y temp= no[min]; no[min] = no[x] no[x]=temp print("Pass: ",x+1,"=",no) print("Final List:",no) 3 19 5 4 12 10no= 0 1 2 3 4 5 x=0 min=x K Outer loop [this is pass 1] y=2 y=3 y=4 y=5 3 19 5 4 12 10 min=3x=1 K=6(less than 6) If 4>10 FALSE min value remain same 3 19 5 4 12 10 y=5min=3 3 19 5 4 12 10 3 19 5 4 12 10
  • 22. SELECTION SORT: no=[10,19,5,4,12,3] K=len(no) for x in range(0,K): min = x for y in range(x + 1, K): if no[min]> no[y]: min = y temp= no[min]; no[min] = no[x] no[x]=temp print("Pass: ",x+1,"=",no) print("Final List:",no) 3 19 5 4 12 10no= 0 1 2 3 4 5 x=0 min=x K Outer loop [this is pass 1] y=2 y=3 y=4 y=5 3 19 5 4 12 10 min=3x=1 Now Swapping start tmp= 4 temp=no[min] 3 19 5 4 12 10 min=3 3 19 5 4 12 10 3 19 5 4 12 10 x=1 swap Inner loop finish no[min]=no[x]no[3]= 19 no[1]= 4 no[x]=temp101954 123 Pass 2 Final value:
  • 23. 101954 123 PASS 2 FINAL VALUE: Unsorted Value Sorted Value
  • 24. 101954 123 PASS 3 STARTS Where X=2 Sorted Value Y=x+1=3 K X=2 Inner loop Outer loop
  • 25. SELECTION SORT: no=[10,19,5,4,12,3] K=len(no) for x in range(0,K): min = x for y in range(x + 1, K): if no[min]> no[y]: min = y temp= no[min]; no[min] = no[x] no[x]=temp print("Pass: ",x+1,"=",no) print("Final List:",no) 3 1954 12 10no= 0 1 2 3 4 5 x=2 min=x K Outer loop [this is pass 3] Inner loop start where y starts from x+1 to K y=3 3 1954 12 10 min=2x=2 y=3 K=6(less than 6) If 5>19 FALSE min value remain same min=2
  • 26. SELECTION SORT: no=[10,19,5,4,12,3] K=len(no) for x in range(0,K): min = x for y in range(x + 1, K): if no[min]> no[y]: min = y temp= no[min]; no[min] = no[x] no[x]=temp print("Pass: ",x+1,"=",no) print("Final List:",no) 3 1954 12 10no= 0 1 2 3 4 5 x=0 min=x K Outer loop [this is pass 3] y=3 y=4 3 1954 12 10 min=2x=2 y=4 K=6(less than 6) If 5>12 FALSE min value remain same min=2 3 1954 12 10
  • 27. SELECTION SORT: no=[10,19,5,4,12,3] K=len(no) for x in range(0,K): min = x for y in range(x + 1, K): if no[min]> no[y]: min = y temp= no[min]; no[min] = no[x] no[x]=temp print("Pass: ",x+1,"=",no) print("Final List:",no) 3 1954 12 10no= 0 1 2 3 4 5 x=0 min=x K Outer loop [this is pass 3] y=3 y=4 y=5 3 1954 12 10 min=2x=2 K=6(less than 6) If 5>10 FALSE min value remain same 3 1954 12 10 y=5min=2 3 1954 12 10
  • 28. SELECTION SORT: no=[10,19,5,4,12,3] K=len(no) for x in range(0,K): min = x for y in range(x + 1, K): if no[min]> no[y]: min = y temp= no[min]; no[min] = no[x] no[x]=temp print("Pass: ",x+1,"=",no) print("Final List:",no) 3 1954 12 10no= 0 1 2 3 4 5 x=0 min=x K Outer loop [this is pass 3] y=3 y=4 y=5 min=2x=2 Now Swapping start tmp= 5 temp=no[min] 3 1954 12 10 min=2 3 1954 12 10 3 1954 12 10 x=2swap Inner loop finish no[min]=no[x]no[2]= 5 no[2]= 5 no[x]=temp101954 123 Pass 3 Final value:
  • 29. 101954 123 PASS 3 FINAL VALUE: Unsorted Value Sorted Value
  • 30. 101954 123 PASS 4 STARTS Where X=3 Sorted Value Y=x+1=4 K X=3 Inner loop Outer loop
  • 31. SELECTION SORT: no=[10,19,5,4,12,3] K=len(no) for x in range(0,K): min = x for y in range(x + 1, K): if no[min]> no[y]: min = y temp= no[min]; no[min] = no[x] no[x]=temp print("Pass: ",x+1,"=",no) print("Final List:",no) 3 1954 12 10no= 0 1 2 3 4 5 x=3 min=x K Outer loop [this is pass 4] Inner loop start where y starts from x+1 to K y=4 3 1954 12 10 min=3x=3 y=4 K=6(less than 6) If 19>12 TRUE min value change to 4 min=3
  • 32. SELECTION SORT: no=[10,19,5,4,12,3] K=len(no) for x in range(0,K): min = x for y in range(x + 1, K): if no[min]> no[y]: min = y temp= no[min]; no[min] = no[x] no[x]=temp print("Pass: ",x+1,"=",no) print("Final List:",no) 3 1954 12 10no= 0 1 2 3 4 5 x=3 min=x K Outer loop [this is pass 4] y=4 y=5 3 1954 12 10 min=4x=3 y=5 K=6(less than 6) If 12>10 TRUE min value change to 5 min=4 3 1954 12 10
  • 33. SELECTION SORT: no=[10,19,5,4,12,3] K=len(no) for x in range(0,K): min = x for y in range(x + 1, K): if no[min]> no[y]: min = y temp= no[min]; no[min] = no[x] no[x]=temp print("Pass: ",x+1,"=",no) print("Final List:",no) 3 1954 12 10no= 0 1 2 3 4 5 x=3 min=x K Outer loop [this is pass 4] y=4 y=5 min=5 x=3 Now Swapping start tmp= 10 temp=no[min] min=5 3 1954 12 10 3 1954 12 10 x=3 swap Inner loop finish no[min]=no[x]no[5]= 19 no[3]= 10 no[x]=temp191054 123 Pass 4 Final value:
  • 34. 10 1954 123 PASS 4 FINAL VALUE: Unsorted Value Sorted Value
  • 35. 10 1954 123 PASS 5 STARTS Where X=4 Sorted Value Y=x+1=5 K x=4 Inner loop Outer loop
  • 36. SELECTION SORT: no=[10,19,5,4,12,3] K=len(no) for x in range(0,K): min = x for y in range(x + 1, K): if no[min]> no[y]: min = y temp= no[min]; no[min] = no[x] no[x]=temp print("Pass: ",x+1,"=",no) print("Final List:",no) 3 1054 12 19no= 0 1 2 3 4 5 x=4 min=x K Outer loop [this is pass 5] Inner loop start where y starts from x+1 to K y=5 3 1054 12 19 min=4x=4 y=5 K=6(less than 6) If 12>19 FALSE min value remain same min=4
  • 37. SELECTION SORT: no=[10,19,5,4,12,3] K=len(no) for x in range(0,K): min = x for y in range(x + 1, K): if no[min]> no[y]: min = y temp= no[min]; no[min] = no[x] no[x]=temp print("Pass: ",x+1,"=",no) print("Final List:",no) 3 1054 12 19no= 0 1 2 3 4 5 x=3 min=x K Outer loop [this is pass 4] y=5 min=4 x=4 Now Swapping start tmp= 12 temp=no[min] min=4 3 1054 12 19 x=4 swap Inner loop finish no[min]=no[x]no[4]= 12 no[4]= 12 no[x]=temp191054 123 Pass 5 Final value:
  • 38. 10 1954 123 PASS 5 FINAL VALUE: Unsorted Value Sorted Value
  • 39. 10 1954 123 FINAL RESULT OF SELECTION SORT: Sorted Value