Amazon Interview Question

implement heap and tree and graph