This cognitive algorithm keeps sorting things in this stack that we have in our mind to pile things that we find interesting, maybe using sorting algorithms like the bubble sort, selection sort, recursive bubble sort, merge sort, or pancake sorting... This cognitive algorithm put on top of the stack the most interesting thing we are experiencing right now and fire one event that starts another algorithm that investigates this interesting thing using our memory to see where it can be clustered and with what it is related. During this time our attention is less focused on the thing we are experiencing in real-time. this investigation process can in turn fire a signal that makes us stop what we are doing and go looking for more information about this interesting thing. It happens that when we are in such kind of situation we take our phone or jump on our computer to make a search on one of these search engines like google.
This happened to me today and I looked for this
I already told you that TV program drives searches in search engines. I was looking for a youtube video about gaming when this cognitive process happened to me. So Youtube video consumption generate also searches in search engines.
PS: by saying algorithm I am just using an analogy with computers but our brain is more than a computer that tries to emulate it.