Answer:
Explanation:
Well here you only have to add 2 new horses .... so simply what you can do is find 2 slots where the gap is maximum ... lets take the given example in detail to understand the same.... here 10001001000010 here you can observe that the difference between the first two filled slots is 3 then 2 then 4 then 1....... make it a separate array ...... now as i said that we just need to place two new horses so we just need two of the biggest numbers from this array and place the new horses at the center of the corresponding slots ... like here 3 and 4 are greatest ... so one horse is placed in between the gap corresponding to 3 while other at 4 ..... after making the new array answer can be find in linear time itself... I hope this makes sense ....
Now lets understand how to program it easily so firstly after scanning all stuff ..... we will make a gap array .... then just think now what we will do is find the greatest two numbers then again putting the horses and then find our answers .... so now an easy approach is that instead of making the string again and again searching for answer .... what we do is just do half of the two greatest ones and again find the greatest one in array....
I can help with two.
Web Scripting Virus, A sneaky virus that targets popular websites. What this virus does is overwrite code on a website and insert links that can install malicious software on your device. Web scripting viruses can steal your cookies and use the information to post on your behalf on the infected website.
FILE INFECTOR, targeting executable files (.exe), file infector viruses slow down programs and damage system files when a user runs them.
The appropriate response is turnkey. It is a kind of venture that is built so it can be sold to any purchaser as a finished item. This is stood out from work to request, where the constructor fabricates a thing to the purchaser's correct determinations, or when an inadequate item is sold with the supposition that the purchaser would finish it.
Answer:
O(N!), O(2N), O(N2), O(N), O(logN)
Explanation:
N! grows faster than any exponential functions, leave alone polynomials and logarithm. so O( N! ) would be slowest.
2^N would be bigger than N². Any exponential functions are slower than polynomial. So O( 2^N ) is next slowest.
Rest of them should be easier.
N² is slower than N and N is slower than logN as you can check in a graphing calculator.
NOTE: It is just nitpick but big-Oh is not necessary about speed / running time ( many programmers treat it like that anyway ) but rather how the time taken for an algorithm increase as the size of the input increases. Subtle difference.