Algebraic multiscale solver for flow problems in heterogeneous porous media