Would Hamlet have killed Claudius if the ghost had not appeared?
There are several possible scenarios in which Hamlet might have killed Claudius without ever having talked to the ghost of his dead father. If, for example, Gertrude knew that Claudius had murdered his brother, she might have told this to Hamlet in confidence, or he might have forced a confession out of her in a scene similar to the one that occurs in Act 3, Scene 4. In another possible scenario, Hamlet might overhear Claudius praying and describing his crime as he does in Act 3, Scene 3 where he begins with these words:
O, my offence is rank, it smells to heaven;
It hath the primal eldest curse upon't,
A brother's murder! Pray can I not,
Though inclination be as sharp as will;
My stronger guilt defeats my strong intent,
And, like a man to double business bound,
I stand in pause where I shall first begin,
And both neglect. What if this cursed hand
Were thicker than itself with brother's blood,
Is there not rain enough in the sweet heavens
To wash it white as snow?
Claudius is praying because of his recent fright at the play within a play, but there must surely be other times when he prays, because he is eaten up with guilt. He may be saying similar prayers every day.
Claudius is afraid of Hamlet--even before Hamlet learns the truth and begins acting strangely. Hamlet is not only intelligent but very learned. He knows many languages and has read many different books. Claudius can hardly imagine what Hamlet knows, or suspects, or is contemplating. Hamlet has sufficient reason to assassinate Claudius even if Claudius had nothing to do with his brother's death. Hamlet was the heir apparent to the throne, and Claudius, in effect, usurped it by marrying Queen Gertrude and taking advantage of the fact that Hamlet was far away at Wittenberg. In those days it would have taken many days for Hamlet to get back to Elsinore--but it would have taken many days for news of his father's death to reach him in the first place.
Claudius wants to know what is going on in Hamlet's mind. He probably suspects a lot more than is actually the case. Claudius tells Polonius, in one of Shakespeare's beautiful and characteristically simplistic metaphors:
There's something in his soul,
O'er which his melancholy sits on brood,
And I do doubt the hatch and the disclose
Will be some danger...
Claudius is giving himself away. His heavy drinking is a sign that he has a guilty conscience. Hamlet is extremely intelligent. He has known his uncle since he was a child. If he set his mind to it, Hamlet might figure out the real truth. After all, what are the chances that a poisonous snake would bite his father while he was sleeping in his garden? Are there any poisonous snakes in Denmark? If Hamlet started watching Claudius he might detect many signs of his guilt. Hamlet could have staged that play within a play even if he had never talked to his father's ghost. Hamlet is furious about his mother marrying Claudius at all--much less about her marrying him so soon after her first husband's funeral. Hamlet is capable of staging a play that would at least show a queen making an impetuous and adulterous second marriage.
Hamlet seems to be playing "mind games" with Claudius. They are similar to the mind games Roger Chillingworth plays with Arthur Dimmesdale in Nathaniel Hawthorne's novel The Scarlet Letter. Hamlet might still have killed Polonius, but even if he didn't kill the old man, Claudius would probably send him to England with Rosencrantz and Guildenstern, and Hamlet would still probably read their letter and find out that Claudius was ordering him beheaded. That ought to be sufficient provocation for Hamlet to kill Claudius without ever having had any contact with the ghost of his dead father.