C++ or Java?

Last week I was talking with a manager on the subject of C++ versus Java. The motivation behind this was if a project needs to be developed in C++ does experience in Java could be useful to quickly learn the specifics of C++ and become proficient in a very short period of time.

I would like to share my thoughts regarding this question. Perhaps it will shed some light into similar discussions that may arise in current or future projects. I would like to state that in my software development career I have learned and used a few procedural and OO programming languages (Assembly Language (multiple processors), BASIC, Bash shell, C shell, C, C++, C#, Fortran, Java, JavaScript, Pascal, Perl, PHP, PL/1, PL/C, Python, Ruby on Rails, SQL, Visual Basic and Visual C++ among others). In some projects I have written several million LOC using a single programming language. Continue reading “C++ or Java?”

Caesar Cipher

I enjoy and have been working with cryptography for a couple decades or so. When I saw in HackerRank the challenged named Caesar Cipher I jumped in to solve it.

The cipher is very old and by itself it is completely insecure. One can write a very short program to convert cipher text into plain text which would execute in milliseconds. That said; it was fun to work on the solution.

If interested first take a look at the following URL in HackerRank:  https://www.hackerrank.com/challenges/caesar-cipher-1?utm_campaign=challenge-recommendation&utm_medium=email&utm_source=24-hour-campaign

It seems like the input format specifies the length of the plain text string in addition to the actual string in order to be able to generate the cipher text directly without having to read the entire string. I decided to pass on such offer. Continue reading “Caesar Cipher”

Cavity Map

Based on an email message from HackerRank I decided to accept the Cavity Map challenge. The description for the challenge may be found using the following URL:  https://www.hackerrank.com/challenges/cavity-map?utm_campaign=challenge-recommendation&utm_medium=email&utm_source=3-day-campaign

As usual, if interested please read the description and give it a try.

The Need Help link on the page discusses string basics. In this case I did not find the help of use. Continue reading “Cavity Map”

The Single-Responsibility Principle

Today is January 01, 2017. Happy and prosperous New Year!!!

As I have mentioned in prior blog entries, among many other activities, I enjoy reading technical books in order to learn, refresh and on occasions question what some may consider common knowledge. One of the books that I am currently reading is “Agile Software Development Principles, Patterns and Development” by Robert C. Martin. So far, I recommend this book to people studying and practicing computer science. Continue reading “The Single-Responsibility Principle”

Chocolate Feast

Today’s evening is New Year’s Eve 2016. Happy New Year 2017!!! By the way, 2017 is a prime number. The next prime will be 2027. Went ahead and took a look at the HackerRank challenge Chocolate Feast. If interested take a look at the description at the following URL: https://www.hackerrank.com/challenges/chocolate-feast?utm_campaign=challenge-recommendation&utm_medium=email&utm_source=24-hour-campaign

As usual I first take a look at the Need Help? I then spend time working on my solution. After trying and passing the sample tests I read most of the discussions to improve on my solution and try additional tests that other fellow developers have obtained. Finally I go ahead and submit my solution. Continue reading “Chocolate Feast”

Valid Parentheses

I have not solved a LeetCode challenge in a couple weeks. Went to the site and the system suggested the Valid Parentheses using the following URL:  https://leetcode.com/problems/valid-parentheses/

The idea is to determine if a sequence of parentheses in a string are properly matched. Please take a look at the actual challenge using the previous URL.

Following is a screen capture of the console on my Eclipse IDE: Continue reading “Valid Parentheses”

Max Priority Queue

A priority queue is an abstract data type which is like a regular queue or stack data structure, but where additionally each element has a “priority” associated with it. In a priority queue, an element with high priority is served before an element with low priority. If two elements have the same priority, they are served according to their order in the queue.

While priority queues are often implemented with heaps, they are conceptually distinct from heaps. A priority queue is an abstract concept like “a list” or “a map”; just as a list can be implemented with a linked list or an array, a priority queue can be implemented with a heap or a variety of other methods such as an unordered array. Continue reading “Max Priority Queue”

Filling Jars

It has been a week or so since I tried a challenge in HackerRank. Between work and holidays not much spare time available. BTW Happy Holidays!!!

The URL for the challenge follows:  https://www.hackerrank.com/challenges/filling-jars?utm_campaign=challenge-recommendation&utm_medium=email&utm_source=24-hour-campaign

Before proceeding reading this blog I would suggest to go to the web site and solve it on your own. Continue reading “Filling Jars”

Agile Design

As I have already mentioned in a previous post, I purchased and are currently reading the book “Agile Software Development Principles, Patterns and Practices” by Robert C. Martin. I am about to start reading section 2 titled “Agile Design”.

The author lists the following seven symptoms of poor design which on their own are very important to observe (I believe they are called code smells): Continue reading “Agile Design”

Prime Numbers

The motivation for this entry is based on chapter 5 of the book Agile Software Development Principles, Patterns and Practices by Robert Martin. In that chapter the author writes an initial program with correct output. The issue is that it is not as simple to follow (and possibly maintain) as the final one. The final one is longer but much easier to follow.

I was not able to find the source code in the URL specified by the book: www.objectmentor.com/PPP (the domain is up for grabs). I wanted to determine if the performance would be different (better) for the short program when compared against the longer one, which also outputs the same results. Continue reading “Prime Numbers”