discus the worst and best case complexity of binary search
Answer / Mohit Pal
Binary Search has a logarithmic time complexity (O(log n)), which means its efficiency increases as the size of the data set grows. However, it has two scenarios with different complexities:
1. Best Case Complexity (O(log n)): The best case occurs when the target element is in the middle or one of the extreme ends of the sorted array. In this case, the search operation requires a minimum number of comparisons.
2. Worst Case Complexity (O(log n)): The worst case occurs when the target element is not present in the array and the search proceeds until it reaches an empty sub-array. In the worst case, binary search still performs better than linear search.
| Is This Answer Correct ? | 0 Yes | 0 No |
When are the SBI clerk 2010 results are expected???
What is the fallacy in the following program segment ? int *f1() { int a=5; return &a; } f() int *b=f1() int c=*b; }
the conditional jump instruction in 8086 have a displacement of more than 1 byte.explain how would you tackle a situation in which it is required to branch,on some condition,to a location which is more than 120 bytes away.
Please derive the formula for the area of a circle.
what is recursion in c language?
MILITARY ENGINEER SERVICES
is the used fire extinguisher fall under Hazardous waste material?
Please mail me the sample papers of PNB for the post Dy. Manager.
How can I get know that my pc contains dram or sram..?
#include<stdio.h> int main() { char *ptr; char string[] = "How are you?"; ptr = string; ptr += 4; printf("%s",ptr); return 0; }
searching a B-tree indexed tree compared to B+ tree is slow..True or false
how to use photoshop and some related websites?
Civil Engineering (5086)
Mechanical Engineering (4453)
Electrical Engineering (16638)
Electronics Communications (3918)
Chemical Engineering (1095)
Aeronautical Engineering (239)
Bio Engineering (96)
Metallurgy (361)
Industrial Engineering (259)
Instrumentation (3014)
Automobile Engineering (332)
Mechatronics Engineering (97)
Marine Engineering (124)
Power Plant Engineering (172)
Textile Engineering (575)
Production Engineering (25)
Satellite Systems Engineering (106)
Engineering AllOther (1379)