Codes for various algorithms