Data Structures Linear List || Practical ||  Sumita Arora || Class 12 || Computer science



Q3. Fill in the blanks in the following code segment to implement sequential search of the given array. The method should return a Boolean value indicating whether or not the parameter value was found in the array.


def seqSearch( s ) :

    a = [9, 12, 14, 3, 25 ]

    for i in ____ :

        if _____ :

            return ____

    return ____



Q4. Write a function to insert an element in a sorted list only if it does not already exist in the list.



Q5. Write a function to insert an element in a sorted list only if it already exists in the list. (i.e., only duplicate entries can be inserted.



Q6. Write a function to delete an element from a sorted list.



Q7. Modify the function deleting an element from a sorted list so that only duplicate entries can be removed. An element which is unique in the list cannot be deleted.

e.g., from the array given below only 10, 35, 43 can be deleted as these have multiple entries; other elements cannot be deleted from it


[5, 10, 10, 12, 20, 35, 35, 35, 40, 42, 43, 43, 59, 70]



Q9. Create a two dimensional List in Python that stores runs scored by a batsmen in five overs. The list looks somewhat like:


Runs = [[0, 6, 4, 1, 0, 0], [3, 0, 2, 0, 0, 0], [0, 0, 4, 4, 0, 1], [0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0]]


(a) Write a function that returns the over in which the batsman scored the highest runs.


(b) Write a function that returns the over(s) in which the batsman scored the minimum runs.


(c) Write a function that returns the total runs scored by the batsman.



Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post