A binary search algorithm is a method to determine the position of a target value within a sorted array (an ordered list). Binary search compares the target value to the middle element of the array. If they are not equal, the half in which the target cannot lie is eliminated and the search continues on the remaining half, again taking the middle element to compare to the target value, and so on. If the remaining half at any stage is found to be empty, then the target is not in the array. Even though the idea is simple, implementing binary search correctly requires attention to some subtleties about its exit conditions and midpoint calculation. Binary search runs in logarithmic time in the worst case. It is faster than linear search except for small arrays, but the array must be sorted first. Although specialized data structures designed for fast searching, such as hash tables, can be searched more efficiently, binary search applies to a wider range of problems.
Read more: https://en.wikipedia.org/wiki/Binary_search_algorithm
_______________________________ Today's selected anniversaries:
1787:
The opera Don Giovanni, based on Don Juan, the legendary fictional libertine, and composed by Wolfgang Amadeus Mozart, premiered in the Estates Theatre in Prague. https://en.wikipedia.org/wiki/Don_Giovanni
1948:
Arab–Israeli War: As the Israel Defense Forces captured the Palestinian Arab village of Safsaf, they massacred at least 52 villagers. https://en.wikipedia.org/wiki/Safsaf_massacre
1998:
At 77 years old as a crew member aboard the Space Shuttle Discovery on the STS-95 mission, John Glenn became the oldest person to go to space. https://en.wikipedia.org/wiki/John_Glenn
2015:
China announced the abolition of its one-child policy, allowing families to have two children instead. https://en.wikipedia.org/wiki/One-child_policy
_____________________________ Wiktionary's word of the day:
shunt: 1. (transitive) To cause to move (suddenly), as by pushing or shoving; to give a (sudden) start to. 2. (transitive) To divert to a less important place, position, or state. 3. (transitive) To provide with a shunt. 4. (transitive, computing) To move data in memory to a physical disk. 5. (transitive, electricity) To divert electric current by providing an alternative path. 6. (transitive, rail transport) To move a train from one track to another, or to move carriages, etc. from one train to another. 7. (transitive, chiefly road transport, informal, Britain) To have a minor collision, especially in a motor car. 8. (transitive, surgery) To divert the flow of a body fluid. 9. (transitive, obsolete, Britain, dialectal) To turn aside or away; to divert. https://en.wiktionary.org/wiki/shunt
___________________________ Wikiquote quote of the day:
Take care that thou be not made a fool by flatterers, for even the wisest men are abused by these. Know, therefore, that flatterers are the worst kind of traitors; for they will strengthen thy imperfections, encourage thee in all evils, correct thee in nothing; but so shadow and paint all thy vices and follies, as thou shalt never, by their will, discern evil from good, or vice from virtue. And, because all men are apt to flatter themselves, to entertain the additions of other men's praises is most perilous. Do not therefore praise thyself, except thou wilt be counted a vain-glorious fool; neither take delight in the praises of other men, except thou deserve it, and receive it from such as are worthy and honest, and will withal warn thee of thy faults; for flatterers have never any virtue — they are ever base, creeping, cowardly persons. … But it is hard to know them from friends, they are so obsequious and full of protestations; for as a wolf resembles a dog, so doth a flatterer a friend. --Walter Raleigh https://en.wikiquote.org/wiki/Walter_Raleigh
daily-article-l@lists.wikimedia.org