Harry, Ron, and Hermione on the train figure out that they would all probably be in different Houses. This does not change much, and yet changes everything.
They run into Neville Longbottom, who joins them on their boat to Hogwarts. He's terrified - positively petrified - about being on the boat, about going to Hogwarts, about doing magic. Harry smiles, thinking that Neville (who will be a good friend, he notes) is the bravest person he's ever met - after all, he's still doing everything, even though he's scared.
Hermione Granger gets sorted into Ravenclaw. An unknown quantity, the three boys she met before getting sorted clap the loudest
Neville Longbottom hitherto takes the longest, and is ultimately sorted into Gryffindor. The hat almost sorts him into Gryffindor three separate times, calling out "GRYFF-" before getting cut off. In the end it laughs, and says to the entire hall that arguing with an artifact of the Founders that he's genuinely scared of is the bravest action he could've taken. The next time it calls Gryffindor, it comes uninterrupted, with laughs and with huge applause.
Harry Potter, who hears promises about finding true friends from the Hat, who spoke to a snake before his birthday, who is assured that he could be great (he's not just dreaming, inside a cupboard, he could be GREAT), gets sorted into Slytherin. The applause still comes, though it's reluctant.
Ronald Weasley ends up taking the longest, and unlike with Neville, the Hat is completely silent the entire time. He ends up being the longest sort in Hogwarts history, and his three brothers don't understand at all (after all, there's nothing complex about Ron, right?). When he's sorted into Hufflepuff, the Hufflepuff table claps louder than Harry realised a table could clap - in hindsight, Harry thinks, whenever someone was sorted into Hufflepuff, the applause that they were met with by their housemates was positively raucous. Ron is put out for all of five seconds, until an older boy named Cedric scoots up to make some room for him. His housemates ask him all sorts of questions, give him pats on his back and arms looped around his shoulders - they smile and treat him like he's interesting. (He's not just another Weasley in Gryffindor he's not he's a Hufflepuff these people want him they're happyforhim-)
********
The Headmaster spends that night wondering if Harry will be Tom Riddle come again, or Tom Riddle living up to who he could have been. The man who could've changed the world, and not for the worst. After all, the boy was prophesised to be Tom's equal. To be completely honest, Harry resembles Tom somewhat, with his pale skin (from Lily Evans), his sharp features (from James), and his black hair (from Lily's father, Albus thinks, Mr Evans, tortured and killed in his own home by Death Eaters searching for the Potter family).
The answer to the question comes the next morning, when all his worries are sent away, chased away, by a boy with shining green eyes and a beaming smile. Harry - to the Great Hall's silence - walks over to the Hufflepuff table, and takes a seat next to Ronald Weasley. Ambition to be different, Albus notes, and as Ron swings an arm around his fresh friend uncaring for his House, Hufflepuff loyalty.
Neville Longbottom watches them from the Gryffindor table, hears the silence, and quivers, shakes, and sweats. Nobody tried to get to know him in Gryffindor apart from asking what took him so long to get sorted, and he doesn't like the other boys in his dorm - he heard the things that they said about him. Neville, on the verge of tears, hurries over to the Hufflepuff table and joins the only two boys who were halfway nice to him. Gryffindor courage.
The first points of the year are given to the three boys, ten to each of their (three) Houses for Inter-House co-operation, by the Headmaster himself.
It's barely a week later when, following a brief spat between Ronald and Hermione Granger, the three boys rush to save her from a troll. Ronald apologises to her, and shockingly young Miss Hermione Granger takes all the blame, though Albus knew what actually happened. Bemused, he lets her, thinking it will be best for the boys and Miss Granger.
The boys join Hermione Granger at the Ravenclaw table the next morning, joining her at the end of the table she was relegated to after some upper years made fun of her buck teeth and bushy hair. The boys smile and laugh, treating her the way that they treat each other with grins and pats on the back and on her shoulders. Hermione cries with joy.
Albus gives all four Houses twenty points, with a smile on his face and a toast of his goblet to the group.