My question is about concept, so code is not related, however, do you really need 51% of the mining power in order to attack/replace the real bitcoin Blockchain?
For example, a blockchain has a length of 8, A, B, C, D, E each represent a individual with 20% of the total mining power, let's say person A and B decide to work together, but that's only 40% of the total mining power (less than 51%), for illustration purpose, miner C, D, E will always mine alone, so by the time miner C, D, E each finished mining the 9th block, A and B have already mined the 11th block (assuming they mine faster, since they work together and have a total mining power of 40%), so longest chain wins right? and now the 9th block that miner C, D, E just mined becomes invalid and their chain will be replaced to the longer blockchain, does this mean A and B might have the power to control and manipulate the entire bitcoin Blockchain with only 40% of the mining power as long as the rest of the network don't work together? if so, then bitcoin is not really safe, because most of the time there is no way for small individuals to work together, it's like owning a company, you don't have to be holding 51% shares in order to be in charge of the company, you can do it with just 2% as long as the rest of share holders each hold less than 2% and don't work together against you,
So my ultimate question is, does bitcoin network have a way to force the rest of the share holders to join forces? Therefore you need a true 51% to control/manipulate it or is it like a company?