Ranking and Unranking of Non-regular Trees