wrote the pseudo code

Signed-off-by: bazookan <aby.vinod@gmail.com>