Things that I have heard of and know (imagine how many things I haven't even heard of):
- Binary search
If you don't know at least 1 of these things and you are not red — you are doing it wrong. Stop learning useless algorithms, go and solve some problems, learn how to use binary search.
i don't know what it is, can u teach me?
instead of doing 1 linear search you doing 2. Thats why its called binary search. Works 2 times slower, but i dont care
This isn't 2 linear search . Linear search's time complexite is n/2. Binary search's time complexity is log2(n)
Very clever!
r/woosh
(it's a reddit meme)
When $$$N=3$$$, $$$\frac{N}{2}=1.5$$$ and $$$log_2(N)=1.5849$$$ so your complexity is worse.
When N=5, N/2=2.5 and log2(5)=2.32193 so your complexity is worse
Hey bro, this (including the blog) is just a well-known meme from Um_nik's blog. Don't take it so seriously.
definitely better than unrolling loops.
You can learn from this sites https://www.geeksforgeeks.org/binary-search https://en.wikipedia.org/wiki/Binary_search_algorithm
list of things you don't know:
binary search meme.
You are doing it wrong. Stop solving useless problems, go and read some blogs.
Things that I haven't heard of and don't know (imagine how many things I have heard of):
Two pointers
If you know at least 3 of these things and you are red — you are doing it right. Continue learning useless algorithms, don't go and solve some problems, learn how to use FFT.
I can't implement this algorithm. How do I use pointers in Python?
To use two pointers you have to think like two pointers. On early stages it's better to imagine that your friend is the first pointer and you are the second.
What if I got no friends though?
Then you steal one
wtf bro, where does a taxi driver need a binary search?
To find a passenger of height h among n passengers standing in the sorted order of their heights.
wtf bro why does the driver have to give a damn about the height as long as they are not > 6.5 feet?
Maybe they are binary searching to find the person with a height of 6.5 feet :)
binary search is used in bitmasks only to find the count of (2)s in this mask
I'm just waiting for the day when I find a problem with my binary search implementation, then my list of "things I know" will finally be empty
Teach me this dark art you speak of. What is it capable of?
Let's say you have a list of girls (or boys?) that you like, sorted by how cool they are. Let's further assume that a person will not date you if they are too cool for you. Then you can use binary search to find the best person that will date you, only within a very few embarrassing attempts to ask somebody out.
Time to get a girlfriend.
Ok, that's obviously a lie because in 133492526 You used dp and number theory. And it is only one sumbission. P.s. I know it is a joke...
You know, technically it could be the truth if he wasn't the real author of the code from that submission... Or he independently reinvented DP without knowing what it is... Or it was indeed just a joke.
it is so funny i forgot to laugh
umnik approves
I see, so that's exactly and the only reason I'm not purple, because I don't know Binary search
Things that I have heard of and know (imagine how many things I haven't even heard of):
⠀
If you don't know at least 1 of these things and you are not green — you are doing it wrong. Stop learning useless algorithms, go and solve some problems, learn how to use binary search.
lomien stop learning and reciting useless chinese data structure algorithms
The only thing I would insert here is how to read input data.
U are so humorous.
Yeah. If the array is sorted then Binary search is great as it runs in $$$O(\log{n})$$$ time. That means it can search an element from a sorted array of $$$1,000,000,000$$$ elements in at most $$$30$$$ steps.
No way I Reached specialist without knowing HLD and Square Root decomposition.