Former PM elected Algeria president as thousands prepare to march