Design HashMap – 4 of 4

Today is the last Wednesday of 2020. New year 2021 will be here this Friday. My best wishes for the New Year. It seems that most of us will be receiving the COVID-19 vaccine in 2021 so we should be able to reach worldwide heard immunity. We need to learn and understand how the pandemic started and make sure we do not allow this to repeat. Millions human beings have died due to COVID-19 and the economies of the world have been severely impacted. Let’s make sure we work together to make it happen. Continue reading “Design HashMap – 4 of 4”

Design HashMap – Third approach

Good day and hopefully you had a nice long weekend.

It seems that COVID-19 vaccines have been inoculated to about two million people in the USA. Apparently the vaccine is being well received by recipients. The issue at this point seems to be able to determine the efficacy against different virus mutations and how long our bodies will maintain resistance to it. In my humble opinion these two factors will take time to determine and must be backed up the actual (non edited) and unbiased data.

My sister sent me a link to the article “History isn’t just for patriots” by Daniel Immerwahr published by The Washington Post. I enjoy reading (mostly computer science related books, papers and articles) but also enjoy reading different subjects in order to understand the world which is inhabited by humans. In general we are extremely complex and hard to understand.

Reading the article I detected a taste of political bias. If you are interested I encourage you to read the article and form your own opinion.

At some point the author makes a comparison between history and geometry, in specific to the Pythagorean Theorem. I asked my wife when was the last time she recalls using it, if any, and for what purpose. She had no recollection of ever using it outside the geometry class while attending middle school. On the other hand, I use it often due that I design and develop software and have interest in algorithms and data structures among other computer science subjects.

On the other hand, we both have read several history books from different countries and at different times. To me unbiased history, which is very hard to find, provides facts that we can process and formulate an idea of what had happened in a certain part of the world during a specific period in time. With that information I hope to be able to better understand opinions from others. It is a fact that the winners write history.

Now a day we have a different type of influence. It comes in different forms and sources. For example I read the article in question that was published by The Washington Post and was sent to me by my sister who currently is living and teaching in China. After understanding the sources I need to read the article in an unbiased manner attempting to understand the set of points the author is providing and to understand the logic behind them. I have made my opinion and hopefully if you have a chance to read the article, you will also be able to generate your own educated opinion. Continue reading “Design HashMap – Third approach”

Design HashMap – Second approach

Today is Christmas Eve Day 2020 and we woke up with -3 F. In addition snow and wind started yesterday afternoon. Looks like a perfect day to stay in and roast a turkey.

As a matter of fact, my wife and I prepared the turkey early this morning and put it in the oven. The raw turkey came in at 24 lbs. It had giblets and a bag of liquid for basting. We disposed of those items. Next time we roast a turkey will get a smaller one (about 11 lbs.) and from a different brand (not Jennie-O). The breast of this turkey is not in proportion to the weight. Will see how the sandwiches on ciabatta bread turned out later this afternoon. Continue reading “Design HashMap – Second approach”

Design HashMap

It seems like I lost track of time this week. It is early morning on Wednesday December 23, 2020 and the weather forecast calls for 8 inches of fresh snow and a low of -1 F. This would be the first time this season that we experience subzero temperatures in the city where I live.

We always should look at the positive side of things. With the snow less people will be out and about which is good for restraining new COVID-19 infections. In addition, the days are starting to get longer. We will not be able to notice it for a few weeks, but it is happening.

I brought in from the refrigerator we keep in the garage, a 24 lbs. turkey, which we will roast tomorrow morning and will consume it mostly as sandwiches. Given that it will be my wife and I consuming this bird, it will last for several weeks. We will freeze most of it and consume it as needed. Continue reading “Design HashMap”

Spiral Matrix – Revisited

Good morning. Hope your day is starting on the right note. Yesterday was a long and busy day. Something at work stated on Saturday extended at least through yesterday. I spent a lot of time on the phone, browsing code and looking at log files. It seems we know what is causing the problem. Currently I am in the midst of formulating approaches to address the issue. Hopefully all will be solved by tomorrow.

On a separate note, yesterday I had the opportunity to meet on-line a software engineer that works at a large software company. You never know what the future has reserved for you. Continue reading “Spiral Matrix – Revisited”

Copy List with Random Pointer in Java

I am fried and happy that it is past 05:00 PM on a Friday evening. It was a long and busy week but to be honest with you, due to the lack of different activities during the day or evening, it seems that the days, weeks and months are passing faster than usual.

Tomorrow my wife and I will go grocery shopping at Cub Foods and Costco. On Sunday we will stop by Trader Joe’s. It seems that there is a better selection and quality of vegetables and fruits when comparing with most stores in this area. Continue reading “Copy List with Random Pointer in Java”

Binary Search in Java

It is Thursday and not much to report. My wife and I are planning on baking a couple things this weekend. Will update you on a couple recipes we are interested in making.

Earlier today I selected LeetCode 704 Binary Search. I was browsing the LeetCode site and have not implemented the binary search algorithm in this blog so here it is.

Given a sorted (in ascending order) integer array nums of n elements 
and a target value, 
write a function to search target in nums. 
If target exists, then return its index, otherwise return -1.

Note:

o You may assume that all elements in nums are unique.
o n will be in the range [1, 10000].
o The value of each element in nums will be in the range [-9999, 9999].

The array need to have numbers in sorted order. If the numbers are not sorted it is easy to figure out that it will not work. The opposite is true for a binary reach tree. If the input is sorted we will get an inefficient linked list with all the values. Continue reading “Binary Search in Java”

Balanced Binary Tree in Java

Good news! It seems that vaccination against COVID-19 is already in progress in several parts of the country. At this time vaccination is limited to the elder and to first responders. General public vaccination will start in spring 2021. In the mean time pharmacies will start preparing with equipment, procedures and protocols to get two shots of the vaccine per patient. Hopefully all will proceed with minor hiccups. Continue reading “Balanced Binary Tree in Java”

Add Two Numbers in Java

Hope your day is going well. I have not checked the mail box in a few days. I will have to do so by the end of the workday. In this day and age of on-line communications it seems that due to security and privacy companies continue to send information and documents via USPS.

I was looking at a LeetCode problem to solve next when I found LeetCode 2. Add Two Numbers. The title for the problem and the description sounded quite similar to the problem Add Strings which we solved a day or so ago. I decided to give it a try. Hopefully we will use some of the same techniques we used to solve the last one. Continue reading “Add Two Numbers in Java”

1-bit and 2-bit Characters

Today is Wednesday morning. It seems that the high temperature for the day will be 31F. Better than yesterday but my wife and I live in the Twin Cities of Minneapolis and St. Paul and winters are rather harsh in this part of the country.

This morning I decided to move from solving Facebook technical interview questions to Microsoft. I will try to solve a couple problems a day if time allows. Will see how it goes. My source will be LeetCode. At some point I might switch to HackerRank.

Without further ado, let’s get to the problem at hand. Continue reading “1-bit and 2-bit Characters”