In the film (not book), Hermione throws three objects to hit the knot and freeze the Whomping Willow:
Book difference: Only the locket is thrown (by Hermione). Ron immobilizes the tree with a well-aimed kick to the knot.