Question: how did the sword of gryffindor end up in the sorting hat?
Answer: The Sword of Gryffindor is first seen when it appears in the Sorting Hat in the Chamber of Secrets. Harry uses it then to kill a Basilisk. ... Harry and Hermione realize that the ring, which was a Horcrux, could only have been destroyed because the Sword had absorbed Basilisk venom.