You can fnd all that at Rosetta Code. Keep in mind that if this if for an assignment then you will likely get caught plagiarizing if you use it. I you just copy/paste someone else's code you won't learn anything.
Rosetta Code is a gold mine. Unless gold can't be used.+15