Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Explain binary searching, Fibinocci search.

Answer Posted / nipesh.....janghel....bca..2nd

Binary Search
The binary search is the standard method for searching
through a sorted array. It is
much more efficient than a linear search, where we pass
through the array elements in
turn until the target is found. It does require that the
elements be in order.
The binary search repeatedly divides the array in two, each
time restricting the search to
the half that should contain the target element.
In this example, we search for the integer 5 in the 10-
element array below:

2 : 5 : 6 : 8 : 10 : 12 : 15 : 18 : 20 : 21

Loop 1 - Look at whole array
Low index = 0, high index = 9
Choose element with index (0+9)/2 = 4
Compare value (10) to target
10 is greater than 5, so the target must be in the lower
half of the array
Set high index = (4-1) = 3
Loop 2
Low index = 0, high index = 3
Choose element with index (0+3)/2 = 1
Compare value (5) to target
5 is equal to target
Target was found, index = 1

Is This Answer Correct ?    23 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Differentiate between hashmap and hashtable.

1047


Can treeset have duplicates?

862


How can you insert a node to the beginning of a singly linked list?

882


Which is more efficient merge sort vs quicksort?

805


How does a selection sort work for an array?

851


What is mean by sorting?

840


What is the height of a binary tree?

885


Is array a linked list?

861


What do u mean by data type?

824


How do you declare An array of three char pointers

925


Where is data structure used?

898


Is heap sort stable?

826


What is difference between array and arraylist?

927


What is a string array?

865


What is difference between arraylist and list?

865