Patrz: algorytm drzewa opinajÄ…cego.