Which algo is used for the search options in Whatsapp.Like if we search for word in a personal chat it takes longer time than if we search for the same word in the whatsapp page.Why does this happen??
General doubts in ds-algo
It is unknown exactly what algorithm is being employed by WhatsApp in their searches.
I’m not exactly sure about the one that’s used by WhatsApp. But in theory for exact match any string matching algorithm. Some of the commonly known text string search algorithms are
- Boyer Moore
- Knuth Morris Pratt
- Rabin Karp
Of which Boyer Moore Algorithm (Technically called as Boyer Moore Majority Vote Algorithm) is the best and mostly powerful native string match algorithm
yes I have also noticed that the search on the home screen is visibly faster than searching inside individual chats. At first, this doesn’t make sense. On thinking more about it, it could be that WhatsApp has gone about this in a different way.
They could be indexing all the chat data locally and searching within the index when searches are run from the home screen, while they stick to a traditional string search algorithm like KMP or Boyer-Moore while searching within chats.
It can’t be confirmed that they are indexing data. That would mean that in both cases, they are using traditional string search algorithms, but in the case of individual chats, they face some issue due to the way the data is stored and hence the delay.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.