Sort on Frequency

UPDATE

Noticed that some of the code blocks had additional characters e.g., &s. I removed and inserted the  original code blocks. The code looks good. Sorry about that.

Today is Saturday March 07, 2020 and the high for today in Apple Valley, MN is forecasted to be in the low to mid 50’s. Tomorrow we should be hitting low to mid 60’s. We can call it global warming or whatever you would like, but the global climate is changing. We can debate the reasons but Occam’s Razor problem-solving principle would attribute it to us humans.

One way or the other, my wife and I believe that we are doing our part. Starting this month, the neighborhood has hired a new company for garbage removal. They collect both bins every week. Possible smell during summer would prevent us from keeping our garbage for more than a week, but we generate such a small amount that the service could pick it up once a month. Continue reading “Sort on Frequency”

Sum of Two

I received a notification via email that Nicholas White had put a new video in YouTube. If you are interested, the video is named Google Coding Interview Question – Sum of Two. I enjoy working on problems. Try to get a few each week.

Let’s skip the chit chat and go directly to this problem. The statement for the problem follows:

You have two integer arrays a and b, and an integer target value v.

Determine whether there is a pair of numbers, where one number is taken from a and the other from b, that can be added together to get a sum of v.

Return true if such a pair exists, otherwise return false. Continue reading “Sum of Two”

Larry’s Array

Over the weekend my wife and I tried baking baba (Italian yeast cake) using a large mold. Typically baba is baked in individual small molds but it takes a while to grease and fill them. We tried for the first time using a large mold. All was going well until we put the mixer bowl covered with plastic in the oven with the lights on for it to ferment and double in size. After a couple hours the dough had pushed its way out of the bowl and spilled over the oven floor. We had to clean the mess before baking. We also moved the contents of the bowl into the large baking mold. Continue reading “Larry’s Array”

A* Search Algorithm

As I mentioned in my last post, I read the article “A* search: what’s in a name?” by James W. Davis and Jeff Hachtel. If interested, you may find the article in Communications of the ACM, December 2019, Vol. 63 No. 1, Pages 36-37. The article deals with the name of a search algorithm that was originally published in 1968 by Peter Hart, Nils Nilsson and Bertram Raphael of Stanford Research Institute.

My interest was not much about the name but to be able to experiment and understand the algorithm. There are so many algorithms in Computer Science that adding one more to my list is always welcomed. I do not plan on memorizing the algorithm but if the time comes when I might need to search a graph, I will have one more choice in my toolkit. Continue reading “A* Search Algorithm”

Stack Array

It is the Sunday of Labor Week 2019. Woke up as usual, fixed breakfast and then woke up my wife. After having breakfast got ready and went down to my office for my first work block of the day.

Yesterday afternoon we stopped by my son’s place and cooked paella in the wood pit. It was pretty good. This time we did not use red peppers. It seems to taste better with them. Continue reading “Stack Array”

Rabin-Karp Algorithm

It is a cooler summer Saturday in the Twin Cities of Minneapolis and St. Paul. My wife and I are planning to go out for lunch. As soon as she is ready we should leave.

In the recent posts “MongoDB Text Search” and “Find Damaged – Part II” for one reason or another I have been dealing with full text searches. The MongoDB post covers how to use text searches in the database. A software engineer was in the process of experimenting with MongoDB on the cloud (Atlas) and was interested in performing text searches. The need was associated with a work related request. Continue reading “Rabin-Karp Algorithm”

C++ Boost Library Visual Studio 2017

Yesterday I spent time attempting to port a C DLL that I wrote some time ago to generate MD5 digests for a storage server. At the time I used as a base code provided by RSA Data Security, Inc. and designed and implemented a set of functions that could be directly called in applications / servers that would require generating MD5 digests for strings and files. When done I package the results into a DLL. The library has been in production for a long time. I used the C programming language for performance and the code was built for 32-bit processors. Continue reading “C++ Boost Library Visual Studio 2017”

Flatland Space Stations

Please do not be shocked by the introductory sentences. I was born into an Italian family. My parents moved from Italy to Peru in the 1930’s. Growing up in Peru we were introduced to have wine with weekend meals. In particular wine was only served for lunch. My sisters and I started drinking lemonade with wine. After a few years we moved to have a desert that is made of fresh strawberries with sugar and wine. You just mix the ingredients and let them sit for a couple hours in the fridge. If you try it this summer, make sure it is served chilled. As we got older we had weekend lunch with a couple bottles of wine. None of us ever had issues with alcohol. Different cultures have different approaches to solve the same issue. We just need to make sure that what we do works to solve the problem. If it does not, learn and put practice different approaches. This philosophy can and should be applied to life and software development. Continue reading “Flatland Space Stations”

Promise to Async and Await

Yesterday on snail mail I received a pin from the Red Cross. Apparently I have given blood 16 times so far. That adds up to two gallons of blood. Planning on continue to donate in the foreseeable future.

As you can tell based on the code we will be using for this post, I am a fan of Ian Fleming’s spy novels staring James Bond. I read all his books when I was growing up. Have watched all the James Bond movies and own a DVD collection of all the titles that have been released of 007.

To start we have a set of functions written in JavaScript Continue reading “Promise to Async and Await”

ACM ICPC Team

It is Thursday April 11 and this area of the Twin Cities of Minneapolis and St. Paul has received since yesterday around noon to today around 04:00 PM about 10 inches of snow. Around noon today the snow stopped and we start receiving freezing rain. Schools are closed and there is very little traffic in the area.

According to the forecast, tomorrow will be raining during the day. Not sure if the precipitation will turn into freezing rain. One way or the other, staying home working is not a bad idea. Continue reading “ACM ICPC Team”