Please check cod e for Print all nodes at distance k from a given node problem

you need to print the output in sorted form
if it is empty print zero

What is the error in my code?

Just told you. You missed these two in your code. Incorporate them

thank you so much @aa1