Echo Server and Client

This past winter was quite long but not too cold. A few weeks ago we received a one two punch with two winter storms. After that the temperatures went up and we had a day with temperatures in the mid 80s. In the past week the temperatures were down. Last night we were in the lower 40s. We turned off the central heating system at home for the season. We have already been using the air conditioner for a few days. This morning the inside temperature upstairs was 66 F. My home office is downstairs. The temperature has been at a solid 60 F so far. My wife and I are planning on going for a walk in a couple hours. Continue reading “Echo Server and Client”

Running MySQL on Windows 10

In my previous post I mentioned that I was going to be spending some time experimenting with MongoDB. So why would I be dealing with MySQL at this time? Good question! The reason for it is that I want to store, among different things, Java objects in MongoDB. I am interested in comparing how the same Java object may be stored and retrieved using a SQL and a NoSQL databases. I could have used a different SQL database (e.g., SQL Server), but decided on MySQL. It happens that I have a few databases installed on my Windows 10 computer. With that out of the way; let’s experiment with MySQL. Continue reading “Running MySQL on Windows 10”

Radix Sort

Earlier this week I ran into a description of Radix Sort. This sorting algorithm has been around for a few centuries (yes; that is not a typo). The algorithm dates back to 1887 to the work of Herman Hollerith (and yes; he was the inventor of the Hollerith Card Code for punched cards used in the past century).

This sorting algorithm is not the fastest, it requires additional space, but has been around for a long time. When you read about it, seems like it should not work; but it does. Continue reading “Radix Sort”

Two Dimensional Array

A few days ago a group of software engineers were discussing how the order in which the numbers of rows versus columns in a two dimensional array affect performance. That is; if an array has more rows than columns as opposed to more columns than rows, the time it takes to traverse the array will be affected. Continue reading “Two Dimensional Array”

Basic Calculator II

This is a LeetCode challenge. If interested this is the associated URL:  https://leetcode.com/problems/basic-calculator-ii/?tab=Description

The description of the challenge is short and sweet. This seems to be typical of LeetCode challenges.

Following is a set of screen captures of the console of the Eclipse IDE using the three sample test cases: Continue reading “Basic Calculator II”

Pyramid Max Path

Was talking with a software developer regarding how to determining the max path of a pyramid. We discussed a solution but it is nice to see it come to live.

The following figure illustrates the structure of the pyramid:

 

The requirements are that the height be in the range 1 <= height <= 25. The tree is complete. There are no missing nodes. That implies that the base contains leaf nodes (no children). The values for the nodes should arbitrarily be in the range 1 <= val <= 100. Continue reading “Pyramid Max Path”

Fraction Recurring Decimal

recurring_decimalsFor the past few months I had been working attempting to solve a challenge per day on HackerRank. I like that site. A couple weeks ago I was introduced to LeetCode. Challenges seem to be more intense and requirements seem to be vaguer. Knowing this, one needs to think and plan the approach / algorithm with greater care and expect to fail unit tests that one would not think off. I just finished a challenge and decided to post in this blog my approach to solving it. Continue reading “Fraction Recurring Decimal”

Count Ones

binary_counts_with_fingersHere is a simple task. Given an array of 10,000 random unsigned short integers (16-bit values) count the number of bits set to one (1). In the following example we have an array of two (2) unsigned shorts:

41344 1010000110000000

58520 1110010010011000

The first number 41,344 contains 4 ones and the second value 58,520 contains 7 ones for a total of (4 + 7) = 11 ones. Continue reading “Count Ones”