Distributed Consensus-Based Algorithms