Originally posted by Jai Sriram:
Sorry, I did get you guys could you explain with code.
No, please show us what code/pseudocode you would use. You learn a lot more if you show us what you have
already achieved and we comment on it.
And this is beginning to look like a beginner's question.