Problem Statement:- a) Write a Python program to store roll numbers of student in array who attended training program in random order. Write function for searching whether particular student attended training program or not, using Linear search and Sentinel search. b) Write a Python program to store roll numbers of students array who attended training program in sorted order. Write function for searching whether particular student attended training program or not, using Binary search and Fibonacci search. Note:- Scroll horizontally to see the full line of code. def linear_search ( a , target ): for i in range ( len ( a )): if ( a [ i ]== target ): print ( "Roll no." , target , "is present at index" , i ) break else : print ( "Roll no." , target , "not found in list" ) def binary_search ( a , targ...
Comments
Post a Comment