Understanding sorting || Sumita Arora || Class 11 || Practical || Computer Science || Solution
P.I.P:- 10.1
P.I.P:- 10.2
Q2. Write a program to perform insertion sort on a given list of strings.
Q3. Write a program to perform sorting on a given list of strings, on the basis of just the first letter of the strings. Ignore all other letters for sorting purposes.
Choose sorting algorithm of yourself.
Q4. Consider the following incorrect implementation of insertion sort that sorts a given list namely List in decreasing order. Explain what is wrong and show how to fix it.
[Hint: You only need to change one line.]
for i in range(1, len(List)):
i2 = i
i1 = i - 1
while i1 >= 0:
if List[i1] > List[i2]:
v = List[i1]
List[i1] = List[i2]
List[i2] = v
i1 -= 1
i2 -= 1
else:
break
Q5. Write a program that inputs a sequence A of numbers and creates another sequence B of number of same size as per following guidelines:
Ask the desired order of sorting.
Place first element of sequence A into sequence B and then take each element in the sequence A:
Q6. Write a code that reduces number of comparisons in above code while creating sequence B.
please add full practical
ReplyDeleteq1 is missing
That are theory questions.
DeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )