algorithm - Binary Searching -


Therefore, I want to understand more about binary search, because I really can not understand. Binary search requires a pre-condition that has an array sorted. I got this right It seems that a method should check this pre-condition and throw an exception if it is not completed. But, why is a bad idea to check the prepaid?

This is a bad idea because the data is being sorted, it takes n Step About the full search is the log (n) step.
If you are going to check, you can also do linear search.


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -