human
Indexed Sequential Search | Python program for Indexed Sequential Search.
Storing element.
Storing the index.
Driver code.
Element to search.
Function call"
Solution in Python:
assistant
#Here is code to indexed Sequential Search and the other steps required.
 def indexedSequentialSearch ( arr , n , k ) :
	elements = [ 0 ] * 20
	indices = [ 0 ] * 20
	j , ind , start , end = 0 , 0 , 0 , 0
	set_flag = 0
	for i in range ( 0 , n , 3 ) :
		elements [ ind ] = arr [ i ]
		indices [ ind ] = i
		ind += 1
	if k < elements [ 0 ] :
		print ( " Not ▁ found " )
		exit ( 0 )
	else :
		for i in range ( 1 , ind + 1 ) :
			if k <= elements [ i ] :
				start = indices [ i - 1 ]
				end = indices [ i ]
				set_flag = 1
				break
	if set_flag == 0 :
		start = indices [ i - 1 ]
		end = n
	for i in range ( start , end + 1 ) :
		if k == arr [ i ] :
			j = 1
			break
	if j == 1 :
		print ( " Found ▁ at ▁ index " , i )
	else :
		print ( " Not ▁ found " )
if __name__ == " _ _ main _ _ " :
	arr = [ 6 , 7 , 8 , 9 , 10 ]
	n = len ( arr )
	k = 8
	indexedSequentialSearch ( arr , n , k )