Maze Generator using depth-first search algorithm with Backtracking


Maze is another favorite of my daughter.

The code can be found at:

https://github.com/ajay555/Maze-Generator

Demo can be seen here:

https://ajay555.github.io/Maze-Generator/

You can see the Wikipedia page for the algorithm details:

https://en.wikipedia.org/wiki/Maze_generation_algorithm

The depth-first search algorithm of maze generation implemented using backtracking:

  1. Make the initial cell the current cell and mark it as visited
  2. While there are unvisited cells
    1. If the current cell has any neighbours which have not been visited
      1. Choose randomly one of the unvisited neighbours
      2. Push the current cell to the stack
      3. Remove the wall between the current cell and the chosen cell
      4. Make the chosen cell the current cell and mark it as visited
    2. Else if stack is not empty
      1. Pop a cell from the stack
      2. Make it the current cell

Simulate Fireworks using P5JS


Came across P5JS Javascript framework and it looks amazing. The best part is it is very intuitive to demonstrate the thought process.

Tried Daniel Shiffman’s Firework example and the result looks amazing.

The code can be found on my Github account:

https://github.com/ajay555/Fireworks

And the demo can be seen here:

https://ajay555.github.io/Fireworks/

Will try more samples and share with all of you.

Find the Celebrity algorithm in linear time and constant space


I was working on this problem with various options like graph, recursion etc… however the most optimized solution I case across was using Stack which solves the problem in linear time however the space consumption was also linear.

Tried removing the stack and with simple change the space complexity changed to constant while keeping time complexity linear.

Below is the sample code.

celebrity_problem

 

Building a successful team -Discussion on Why, How and When


In my previous blog the point of being inclusive was emphasized. Now being part of the team is very important, however even more important is how you participate within team. If the participation is primarily from the point of giving direction and orders then we might not see the intended results.

Every team member give their best when they have the feeling of ownership. And that feeling of ownership only comes when there is clarity and information sharing. An ownership without underlying details is merely an assigned task. Don’t expect any innovative out of the box thinking in this case.

The best way to share the underlying details is to encourage the Why, How and When discussion. The idea is that any new idea, design, proposal has to have ‘Why’ information associated with it. The idea can come from any team member (Engineer, QA or Product Manager). There has to be a problem statement which this idea is intended to solve. Let additional team members provide their thoughts which might help in expanding the definition of Why.

Once there is an agreement on Why, the next steps is to brainstorm on How. There is a tendency among engineers to immediately provide solution to a problem. My recommendation would be to take sometime to digest the information on Why before coming out with solution. A break in between Why and How discussion is highly recommended. The idea is to come up with a high level technical design to the solve the problem. This detail helps in determining the high level effort (Story Points).

By this time we have the Why and How part reasonably covered. The high level effort helps in prioritizing the work by following the priority matrix.

 

priority-matrix

One of the key attribute of having successful open discussion around Why, How and When is trust between Product Management¬†and Engineering. We will see great result when these two groups open up their mind to understand each other’s view to take a decision which is right for the Product.