added a piramid structure algorithm