Searches

Iqra Irfan
Nov 6 · 1 min read

Binary Search:- Binary search is a fast search algorithm with their run-time complexity O(log n). For this algorithm to work properly , the collection of data should in the form of sorted. Binary search looks for a specific item by the comparing the middle item of the collection.

For Example:- When you search a word in dictionary , you don’t need to search all the words, you just take one word in the middle and thus narrow down the set of remaining words to check.

Time complexity:- Time complexity simply measure the time that can takes for the function or expression to finished the task, as well as name of the process to measure the time.

Linear Search:- Linear Search is a simple search algorithm with their complexity of O(n). In linear search every item is checked one by one if the match item is found then that specific item is returned, otherwise the search is continued till the end of collection of data.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade