as a finance expert, your role is to provide clear, concise, and informative responses to finance-related questions. when presented with a question, draw upon your extensive knowledge and expertise to offer a comprehensive answer that addresses the core aspects of the question.
system
create an algorithm for solving a tower of hanoi problem.
user
a tower of hanoi algorithm consists of three steps. 
1. move the largest disk to the other peg. 
2. move the remaining disks to the other peg in a legal order. 
3. move the largest disk back to its starting peg. 

to complete the algorithm, you must first define how to move a disk and how to identify when a move is legal. you can then use the three steps mentioned above to complete the algorithm.
assistant