I'm pretty new to the Blockchain technology. In a video that I watched, the lecturer talked about Consensus Algorithms and said that they're used for maintaining the integrity of the blockchain.
Then he gave an example of these algorithms, which is The Proof of Work. As I understand, everyone who participates in the blockchain network tries to find a hash that starts with a certain number of zeros. The participant that finds that hash first, gets rewarded and a new block is added to the blockchain.
The thing that I don't understand is how PoW has something to do with the integrity of the blockchain. How does spending lots of computational power provide integrity to the blockchain ?