Bash on Ubuntu on Windows

I have been working and developing software on Linux, UNIX and Windows for a while. On the Microsoft platforms I started on MS DOS. Last week I was talking with a colleague and he mentioned that while still in BETA, Microsoft has something called Bash on Ubuntu on Windows. I do enjoy the simplicity and power of the Linux shells. I decided to give the Microsoft BETA software a run. Continue reading “Bash on Ubuntu on Windows”

Dynamic Programming

down_to_zeroIn the process of practicing and refreshing algorithms, I am looking at the Down to Zero II challenge (https://www.hackerrank.com/challenges/down-to-zero-ii) from HackerRank.

After reading the challenge a few times and taking a look at some of the discussions I decided to do it in two steps. My first approach is what I would call brute force. It seems to work in some cases but as expected it does not provide an optimal solution in others. The second approach and what seems to be the right one will be discussed in the next post. That approach uses dynamic programming. Continue reading “Dynamic Programming”

Remove Linked List Elements

linked_listLogged into LeetCode and had the site automatically select a challenge for me. It selected Remove Linked List Elements (https://leetcode.com/problems/remove-linked-list-elements/).

Please visit the LeetCode web site to get the description of the challenge. This challenge has a difficulty level set as easy. Continue reading “Remove Linked List Elements”

Sort Times – Part III

algorithms_fourhe_edition_deluxeAs I have mentioned before, I am going over the Algorithms fourth edition book by Robert Sedgewick and Kevin Wayne with the purpose of refreshing concepts and always learning something new. In this entry I cover my observations when using Quicksort which is one of the most popular and better performing sorting algorithms.

Before continuing reading this entry, please take a look at Sort Times – Part II. In particular take into consideration the comments in italics. Continue reading “Sort Times – Part III”

Waiter

hackerrank_logoI enjoy coding challenges. It makes me think outside my daily work routine. Last weekend I received the following email message from HackerRank:

Hi John,

Improve your skills with this challenge recommended for you:

Waiter

Data Structures | 2,031 submissions

Print the correct order of plates.

Solve Challenge

Happy coding,

The HackerRank team

Continue reading “Waiter”

Sort Times – Part II

timsortIn the Sort Times (now labeled Sort Times – Part I) post I showed code that produced results that needed some additional thoughts. I requested and obtained comments from an author and professor at an Ivy League school (now using names because I have not received a written authorization to do so). Professor, thanks for your insights and thoughts. Continue reading “Sort Times – Part II”

Simple Text Editor

thanksgiving_dayHope you had a nice Thanksgiving Day and today you are enjoying Black Friday shopping.

Logged on to HackerRank and selected the Simple Text Editor challenge. To get a description please visit their site at: https://www.hackerrank.com/challenges/simple-text-editor Continue reading “Simple Text Editor”

Sort Times – Part I

sort_comparisonIn the past few weeks I have been reading and experimenting with code and exercises found in the Algorithms fourth edition book by Robert Sedgewick and Kevin Wayne. It is always a good idea for any professional in any field to refresh concepts and learn new things. In my case I am a Senior System Architect for a company in the West Coast so I constantly polish my skills in Computer Science. Hope physicians do the same thing with medical books ;o)

Many software developers tend to grab library methods to get different tasks accomplished. That makes sense. That said; it is a good idea to go back and review if the code is as optimal as needed. In my case I am comparing the performance of different sorting algorithms. If interested get a copy of Algorithms and take it for a spin. Continue reading “Sort Times – Part I”

Largest Rectangle – Part 2

daveed_vandevoordeI received a message regarding the Largest Rectangle – Part 1 post. It seems that like in many other blogs and posts, I failed to properly describe the algorithm. It seems that I was just describing the implementation. Sorry about that. Thanks for the comment xxx (will not disclose names unless explicitly indicated in email messages). I will attempt to address my mistake in this new post. Continue reading “Largest Rectangle – Part 2”

Largest Rectangle – Part 1

histogramOn and off, during the past couple days I spent time soling the Largest Rectangle challenged form HackerRank (https://www.hackerrank.com/challenges/largest-rectangle). The challenge is described as follows:

“There are N buildings in a certain two-dimensional landscape. Each building has a height given by h in [1 : N]. If you join K adjacent buildings, they will form a solid rectangle of area K * min(h, … , h). Given N buildings, find the greatest such solid area formed by consecutive buildings”. Continue reading “Largest Rectangle – Part 1”