data-Structure problems given in lab ( solved using java)