main algorithms / data structure simple implementation in java