Although having strong legs is a advantage when training to dunk the ball. You need to condition the rest of your body also. Look at Olympic power lifters, you think they can get that enormous torso off the ground to dunk a basketball? They undoubtedly have some of thee strongest legs in the world but their upper body is not trained for jumping.
Overall full body conditioning is the key to reaching your maximum vertical leap. The most important thing is to use a good training program that works the large muscle groups of the body. By working the large muscle groups you involuntarily work the smaller muscles also. The end result is a solid foundation to work with when learning the mechanics needed to allow you to jump higher and dunk a basketball.
Look at all Major sports that require the ability to jump high. The obvious sport is basketball but there is also volleyball and wide receivers in football. In general they are lean without excessive body fat. These athletes train their whole body, not just their legs.
Another advantage of conditioning the whole body is speed. When all your muscles are stronger they compliment each other and you will be faster. Just because you can jump higher than everyone in a basketball game does not mean you will be the best player. You must have speed and agility to go along with your ability to jump.
The best exercises to perform to help you jump higher are high intensity cardio like sprints, You also want to do resistance exercises that use large muscle groups. You should always workout with a spotter when working with heavy weights.
