delte[] added. minor change in printNodes