I have a university assignment that requires this algorithm, but right now I don\'t know how to set up the foundation for it.