๐ Search Operation Explained for Non-Programmers
A comprehensive ๐งต ๐
In this ๐งต, I will explain
๐๐ผโโ๏ธ What is Search?
๐๐ผโโ๏ธ Where do we use it?
๐๐ผโโ๏ธ How important is it?
๐๐ผโโ๏ธ How better can it be?
Understand about concepts like Sorting, Hashing.
No programming knowledge required for reading this thread.
(1/n)
What is Search? - Search is basically when you are looking for something.
You must have come across terms like 'Find', 'Filter', 'Fetch', 'Get', 'Check', 'Select', 'Read', 'Look for' etc. They all involve 'Search'.
(2/n)
In our day-to-day life, we use search everywhere.
Your morning starts with alarm ringing. You are looking for your phone to snooze and ๐ด for some more time.
After getting up, you went to rest room and looking for your tooth brush.
(3/n)
After bathing, you are looking for your dresses in the wardrobe.
You go to the key-holder and looking for your car key.
Inside office, you check for important meetings. You gather all the files that you need to submit to your manager.
(4/n)
Ranging from very simple to complex ones, we search for items almost through out the day.
Is it always straight forward for us to find what we are looking for? How frustrating and tedious is it?
Let's see some situations.
(5/n)
Have you ever faced difficulties while trying to find a dress you are looking for?
How difficult is it to find a good restaurant for your special occasion?
Do you get the record on time that you have kept somewhere earlier?
(6/n)
Finding an item that you are looking for gets tedious once the number of items increases.
Example, think of a book. You read something yesterday and forgot to mark that. Today when you plan to resume, you are clueless.
(7/n)
You will check page by page, line by line until you find at where you stopped yesterday.
Unless you are so fortunate, you would be searching almost till the end. You may abandon in between out of frustration.
(8/n)
What arrangement should you have made? The answer is however it suits you and will make your life easier in finding the right item quickly.
The person who is searching should know about the arrangement to take maximum benefit out of it. It is the most important part.
(9/n)
One such arrangement is keeping items in a sorted manner. How will sorting help in searching?
Consider this. If you know everything is sorted from A to Z, you want something starting with P. You randomly choose one and find out it's R. OK, now just search 2 items behind.
(10/n)
Another popular option is 'Hashing'. Hashing is like creating a shortcut for your item. Instead of searching big items, you now search small 'hashes'.
If hash values are arranged properly, finding an item becomes so straight forward many a times.
(11/n)
But it must be noted that hashes are not unique. It means, you may get same hash value for different items.
So combining Hash Values and Sorting will help search operation very fast. Keep items sorted for same hash values.
(12/n)
These are not the only choices that we have. But it's definitely that if some arrangement is made, search operation could become faster.
Let's have a real life example and see how do you arrange.
(13/n)
You must be tweeting regularly. With time, number of your tweets increases. It's getting time consuming to find an old tweet.
So what do you do? How can you find your popular tweets easily? How do you arrange?
I have seen people arrange these by creating a master ๐งต
(14/n)
Now you must have got why do programmers give so much importance on Searching. In a programmer's life, searching takes 75% time.
Do you know about CRUD? If you don't know, it stands for Create-Read-Update-Delete. In real world, almost all items undergo these 4 operations
(15/n)
Out of these 4, Read, Update and Delete require an item to be searched. So it's approximately 75% (may be more).
People may judge an application depending upon how fast it does search operation. Google is searching for you in micro seconds. Think if it's in seconds!!!
(16/n)
Little bit about programming now. You designed a web page. Browser renders it. CSS styles it. To fetch a UI element and its styles you have DOM, CSS Selectors.
Depending upon how fast these perform, your website will be performant.
If you have made this far, congratulations. I believe it must have given you some understanding about Search Operation and its importance.
If you liked and want to support me, please ๐ the original tweet. ๐ฌ Reply if you have any thoughts. ๐