Implemented a function to print the nodes distribution