on the particular languageoperating system and machine you are usingthe actual effect of this error will be different for examplein running under unixyou may get execution aborted followed by the message "segmentation fault"or you may be given the wrong answer as the output in javayou will always get an error message more efficient algorithmbinary search one always needs to consider whether it is possible to improve upon the performance of particular algorithmsuch as the one we have just created in the worst casesearching an array of size takes steps on averageit will take / steps for large collections of datasuch as all web-pages on the internetthis will be unacceptable in practice thuswe should try to organize the collection in such way that more efficient algorithm is possible as we shall see laterthere are many possibilitiesand the more we demand in terms of efficiencythe more complicated the data structures representing the collections tend to become here we shall consider one of the simplest we still represent the collections by arraysbut now we enumerate the elements in ascending order the problem of obtaining an ordered list from any given list is known as sorting and will be studied in detail in later thusinstead of working with the previous array [ ]we would work with [ ]which has the same items but listed in ascending order then we can use an improved algorithmwhich in english-like pseudocode form is/this assumes we are given sorted array of size and key /use integers left and right (initially set to and - and mid while left is less than rightset mid to the integer part of (left+right)/ and if is greater than [mid]then set left to mid+ otherwise set right to mid if [leftis equal to xthen terminate returning leftotherwise terminate returning - and would correspond to segment of or java code like/data *int [ , , , , , , , , ]int int /program *int left right - midwhile left right mid left right if [midleft mid+ else right midif [left= return leftelse return -