1 | initial version |
This smells of homework, so I'll just submit a simple suggestion : you may find inspiration (but not necessarily a solution) in this book (pp.91-2).
Hoping that this may incite you to read the rest of this (excellen)t book...