Home / MCQ Bank / Computer
Computer Miscellaneous On Data Structures Difficulty: Medium

What is the time complexity of the following code used to search an element in an array? #include<stdio.h> int search_num(int *arr, int num, int len) { int i; for(i = 0; i < len; i++) if(arr[i] == num) return i; return -1; } int main() { int arr[5] ={1,3,3,3,5},num=3,len = 5; int indx = search_num(arr,num,len); printf("Index of %d is %d",num,indx); return 0; }

Select the correct option to test your answer:

More Computer Questions

Which of these expressions will return true if the input integer v is a power of two? In Java, can a subclass override a static method from its superclass? The creation of a stored program is similar to the definition of a . . . . . . . . What is the output of the given code? string_array = ["a","e","i","o","u"] boolean_array = ["True","False"] puts string_array[3] puts boolean_array How do you create a slider widget in Tkinter for selecting a value from a range?