00:01
In this question, to represent the tower of hanoi problem with different description, we can create a class diagram for each scenario.
00:07
So here are the class diagram for the three described scenarios as per given in this question.
00:12
So the scenario first is a tower consists of three pegs.
00:15
Each peg has several discs on it in a certain order.
00:19
So in this diagram, we make a three peg which is tower, peg and disc.
00:24
In this diagram, we have a three class tower, peg and disc.
00:29
Tower contains peg objects and each peg contains a disc object and the disc objects are organized on the pegs in a specific order.
00:39
Now coming to the scenario second, so the tower consists of three pegs.
00:43
Disc on the pegs are organized into subset called a stack.
00:47
A stack is an ordered set of discs.
00:49
So here in this diagram, we make a three peg tower, peg, stack and in the stack, the disc is connected.
00:58
So in this scenario, we have make a three class tower, peg and stack...