Memory efficient alignment and multiple alignment