Perceptron-based algorithms and analysis