Computer Science With Python Chapter 5 Liner List Manipulation
  • Sponsor Area

    NCERT Solution For Class 12 Computer And Communication Technology Computer Science With Python

    Liner List Manipulation Here is the CBSE Computer And Communication Technology Chapter 5 for Class 12 students. Summary and detailed explanation of the lesson, including the definitions of difficult words. All of the exercises and questions and answers from the lesson's back end have been completed. NCERT Solutions for Class 12 Computer And Communication Technology Liner List Manipulation Chapter 5 NCERT Solutions for Class 12 Computer And Communication Technology Liner List Manipulation Chapter 5 The following is a summary in Hindi and English for the academic year 2021-2022. You can save these solutions to your computer or use the Class 12 Computer And Communication Technology.

    Question 1
    CBSEENCO12011542

    What will be the status of the following list after the First, Second and Third pass of the bubble sort method used for arranging the following elements in descending order ?
    Note: Show the status of all the elements after each pass very clearly underlining the changes.
    152, 104, -100, 604, 190, 204

    Solution

    Phase I

    152

    104

    -100

    604

    190

    204

    152

    104

    -100

    604

    190

    204

    152

    104

    -100

    604

    190

    204

    152

    104

    604

    -100

    190

    204

    152

    104

    604

    190

    -100

    204

    152

    104

    604

    190

    204

    -100

     Phase II

    152

    104

    604

    190

    204

    -100

    152

    104

    604

    190

    204

    -100

    152

    604

    104

    190

    204

    -100

    152

    604

    190

    104

    204

    -100

    152

    604

    190

    204

    104

    -100

     Phase III

    152

    604

    190

    204

    104

    -100

    604

    152

    190

    204

    104

    -100

    604

    190

    152

    204

    104

    -100

    604

    190

    204

    152

    104

    -100

    Question 2
    CBSEENCO12011689

    What will be the status of the following list after the fourth pass of bubble sort and fourth pass of selection sort used for arranging the following elements in descending order?
    14, 10, –12, 9, 15, 35

    Solution

    Bubble Sort

    Original Content

      14 10 12 9 15 35
    (i) 14 10 9 15 35 12
    (ii) 14 10 15 35 9 12
    (iii) 14 15 35 10 9 12
    (iv) 15 35 14 10 9 12

    Unsorted status after 4th pass

    Selection Sort

      14 10 12 9 15 35
    (i) 35 10 12 9 15 14
    (ii) 35 15 12 9 10 14
    (iii) 35 15 14 9 10 12
    (iv) 35 15 14 10 9 12

    Question 3
    CBSEENCO12011690

    Write a method in python to search for a value in a given list (assuming that the elements in the list are in ascending order) with the help of Binary Search method. The method should return –1 if the value does not present else it should return the position of the value present in the list.

    Solution
    def bSearch(L, key):
    	low = 0
    	high = len(L)-1
    	found = False
    	while (low <= high) and (not found):
    		mid = (low+high)//2
    		if L[mid] == key:
    			found = True
    		elif L[mid] < key:
    			low = mid + 1
    		else:
    			high = mid - 1
    		if found:
    			return mid+1 # may even be 'return mid'
    		else:
    			return -1

    Mock Test Series

    Sponsor Area

    Sponsor Area

    NCERT Book Store

    NCERT Sample Papers

    Entrance Exams Preparation

    16