Stack can be used to convert a number into it's binary form.
- Push the remainder into stack after dividing the number by 2.
- Keep doing 1, till number>0.
- Pop the binary remainders 1/0 to get the binary form.
No comments:
Post a Comment