Performing a breadth first search in python and optimizing the solution

Image for post
Image for post
Traversing a search tree. Image by the author.

I was watching a sequel of a Hong Kong drama series (使徒行者3) and one of the lead actresses was featured to be playing a Klotzli puzzle (华容道). That got me intrigued as I love solving puzzles and specifically, I enjoy finding the optimal solution for puzzles.

With some effort, I managed to find a similar game on Google Play Store, downloaded it, and started playing. The objective of the game is simple: move the 2x2 block out from the bottom of the frame. Turns out the game is really complicated and not that easily solvable, and finding the optimal solution is much harder. Each stage has optimal solution given by the minimum number of steps. …


And probably save some expense on HR tools for your firm

Image for post
Image for post
Image by the author

As a big-fan of automation, it pains me to see fellow colleagues doing work which is repetitive and excruciatingly manual. A request came to me from HR asking if I could encrypt a bunch of PDFs, then send them via email to individual recipients. I had a pretty good idea of what these letters could be as it was the time of the year and we were looking forward to our bonus and increment letter. …


A productivity tool to Marie Kondo your folders

Image for post
Image for post
Photo by Pranav Madhu on Unsplash

Can you create a list of files, folders, and subfolders for our project folder?

This request looks deceptively simple, but you can already imagine the n other modifications that may come once the first version of this list is done.

Can you also list the files types and add hyperlinks to the file? And maybe add the file size while you’re at it?

Depending on the size of the folder, number of files and how nested it might be, you could have chosen to complete this task manually as adding new fields might be simple. Now, let’s consider another request:

I’ve re-arranged some folders and renamed some files, can you update that list? …


A discussion on best practices for greater productivity

Image for post
Image for post
Photo by Mika Baumeister on Unsplash

Excel is one of the most frequently used application for data analysis. However, due to its clear limitations (i.e. performance, row and column limits), it may not be sufficient to cope with modern demands. Python fanatics have often recommended using the pandas library as an alternative to Excel to automate/speed-up data analysis. However, it may not necessarily lead to time savings if one is not familiar with the library and some of the best practices. This article aims to highlight some of the challenges in data analysis using Excel and how the use of python (and pandas library, along with some additional libraries) and adoption of best practices can help to increase overall efficiency. …

About

Ji Wei Liew

learnt python the hard way to automate the boring stuff

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store