Lessons learnt solving The Tower of Hanoi
My new decoration

Lessons learnt solving The Tower of Hanoi

The Tower of Hanoi.

This was invented by the French mathematician Édouard Lucas in the 19th century. It is associated with legends of some temples where priests are supposed to move 64 stacked disks according to some logic. According to some, it is meant to increase the mental discipline.

This is also quite commonly used in Computer Science in initial studies of recursion, which is a topic I am currently doing as part of the algorithm design module.

Again - being thrown at the deep end of the pool, this has been haunting and fascinating me enough that I just had to also get this wooden model.

I am into v5 of my assignment code now, and there are some key lessons to learn from this assignment, which are listed below and elaborated further.

1️⃣ Poor Design

2️⃣ Small successes are bigger than you think

3️⃣ Take risks and experiment!

Poor Design

You can take take the 'wing-it' approach, which seems quite common in many large scale implementations. Yes, it worked, and it ran in about 7 seconds.

But, is this good enough? Is this efficient? What does it mean on a larger scale?

Think about your own infrastructure or software design. Are users unhappy about the experience, or it is harder to secure, because of poor design to begin with?

I feel the industry lacks this level of discipline to excel. This is either through

  • lack of proper training for the task,
  • unrealistic time and cost pressure, or
  • poor leadership not understanding what is possible in order to guide the team

I believe stronger discipline here is important as we build the digital future. Let's not "wing it" and leave it to our future generations to clean up.

Small successes are bigger than you think

After the 7-second code, I made it display out all the steps it took. As in life, sometimes you can take a bigger problem and break it down into smaller chunks which are easier to solve. The skills or experience that you gain in each of these "small successes" can become very useful when tackling the larger problems.

As a case in point, we started on some initiatives to uplift our delivery capabilities about a year back. It was a slow start as members did not have the right skills to do things differently, or to try different things.

One year in, I'm so proud of all the small successes that the team are now putting in together.

You can reach greater heights when you step on a higher platform from your "small success".

By breaking the problem down in my assignment, I manage to then see a pattern emerge in the steps and worked on v2-3.

Take risks and experiment!

There were two interim versions because I was experimenting with different approaches and data structures, which I have now improved from a run time of 7 seconds to 50 ms (which by the way still fails the time limit on the submission test cases 😫)

Important life lesson here. You will not learn new things being comfortable.

Do not view a failed experiment as a negative experience. It is your chance to grow!

Without a proper mindset, you create a mental obstacle to even try something new! Lifelong learning is never possible without even trying.

What is the team culture that I build? I always tell my team - IT IS OKAY TO FAIL. I am more concerned if we are always right, because then things are too easy.

As leaders - it is your duty to create that culture for your teams too!

I have an upcoming #learnwithme series, where I will share some interesting insights from my own journey.

Have a great weekend, and I hope someone finds this just that bit useful!

Clinton O'Grady

Product Leader | Bridging the worlds of product management & social impact | Global Corporate Responsibility @ EY

3y

Knowledge is meant to be shared, so thank you for sharing your reflections from your coursework, Gerry Chng; I've enjoyed seeing how your work connects from a broader sense. While reading, I was reminded of my two favorite quotes from #UCLA's John Wooden: "It's the little things that make the big things happen." and "Failure is not fatal, but failure to change might be." -- if we are to contribute as future forward thinkers, building for the future, we must keep these principles top of mind. Best of luck with reducing your 50ms run time - you have my confidence! That said, I look forward to keeping up with your #learnwithme series when you share it.

To view or add a comment, sign in

Insights from the community

Others also viewed

Explore topics