Understanding Sorting || Type C || Sumita Arora || Class 11 || Computer science || Information practices || Solution
Q1) Election is a dictionary where key : value pair are in the form of name : votes received. Write a program that sorts the contents of the election dictionary and create two list that stores the sorted data. List A[i] will contain the name of the candidate and list B[i] will contain the votes received by candidate list A[i] . Print the name of candidates with votes received in decreasing order of the number of votes received.
Q2) Given following list L that stores the names of Nobel prize winners. Each element of the list is a tuple containing details of the one nobel prize winner.L = [(“Wilhelm Conrad R''ontgen”, “Physics”,1901),(“Ronald Ross”, “Medicine”,1902),(“Marie Curie”, “Physics ”,1903),(“Ival Pavlov”, “Medicine”,1904),(“Henryk Sienkiewicz ”, “Literature”,1905),(“Theodore Roosevelt”, “Peace”,1904)]Write a program to short the list in the order of last names of the winners . use insertion sort algorithm .
Q3) Write a program to read a list containing 3-digit integers only. Then write an insertion sort function that sorts the list on the basis of one’s digit of all elements. That is, if given list is:
Q4) Write a program to perform sorting on the given list of strings, on the basis of length of strings. That is the smallest–length string should be the first string in the list and the largest–length string should be the last string in the sorted list.
Q5) Write a program that sort a list of tuple–elements in descending order of Points using Bubble sort. The tuple–element of the list contain following information about different players:(PlayerNo, Player Name, Points)
Type=b
ReplyDelete3 question answer
Please solve
please provide the type b question answers.
ReplyDeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )