Basketballs bounce higher than baseballs, and either one will bounce higher than a ball-shaped rock. There are several factors that contribute to this, but in the end the amount of bounce comes down to how much energy is present in the ball to begin with and how much energy it loses when it strikes the floor. The energy put into the ball can come from gravity alone, or more energy can be put into the ball by throwing it forcefully downward.
Some balls, such as basketballs and beach balls, are hollow. A skin of some material, usually rubber, is expanded and held to a spherical shape by the pressure of air inside of it. Dropping an inflated ball on the floor will cause both the exterior of the ball and the inside of the ball to compress. The higher the air pressure inside the ball, the higher it will bounce. This is because air does not lose very much energy when it is compressed, at least compared to the material of the ball itself.
Different materials absorb and release energy at different rates, so what the ball is made of will have a noticeable effect on how high it bounces. The material the ball is bouncing on is of equal importance. Steel, for example, does not seem to be a very bouncy material. However, energy put into a steel ball does not dissipate very quickly. A steel ball dropped onto a steel floor will bounce quite well. Dropping the same steel ball onto a wooden floor will likely result in some smashed floor boards.
Temperature has an effect on how much a ball bounces. This effect is most noticeable in balls that are filled with air, such as basketballs. This is because air contracts when it is cold and expands when it is hot. A basketball that has been heated will bounce higher than one at room temperature and will lose some of its bounce if it has been cooled. This principle applies to solid balls as well. The effect is not as noticeable with a solid ball, however, as solids typically show less expansion and contraction than gases when heated or cooled.
Energy must be put into the ball for it to bounce at all. There are two possible sources for this energy under most conditions. The first is gravity. Simply dropping a ball from a height will cause gravity to impart acceleration to the ball. The second force is kinetic. Kinetic force can be applied to the ball from a number of different sources, but the most common method is simply throwing it at the ground. The more energy that is applied to the ball, the higher it will bounce.