Randomized Algorithms And Theory For Rank Estimation And Least Squares