While programming in most (never say all) programming languages and platforms one often runs into the need to swap the values of two variables. The following code in Java illustrates a first attempt to swap two integers: Continue reading “Swap Values”
Earlier this week, I received an email message from HackerRank suggesting a C++ challenge. Finally I was able to work on it. This past week I was busy with work. Continue reading “Lower Bound – STL”
I received an email inviting me to solve the Classes and Objects challenge at HackerRank. If interested please take a look at the requirements and give it a try before reading my solution.
The requirements call for the design of a class with two methods. One of them reads grades from standard input while the other computes the total score for a set of five grades. Continue reading “Classes and Objects”
I took a look at the StringStream HackerRank challenge. There are two items that one needs to deal with. The first is to parse the coma separated string of integers after it has been assigned to a string stream as suggested by the challenge. Of course one could solve this challenge just parsing the string directly. The second task is to allocate a vector in which to return the integers. At first I just allocated an empty array which I resized each time a new integer had to be inserted. In my final approach I just determined the number of integers by counting the ‘,’s in the string. Continue reading “StringStream”
I believe that I am finished with the implementation and testing of the DoubleLinkList class using templates in C++. At this point I should be able to start using the class. Hope to get to that sometime this weekend.
Following is the screen capture of a console displayed on my Windows
machine using Visual Studio 2013 while running the test code for double linked lists: Continue reading “Linked List – Part VI”
Hope you had a nice weekend. Over the weekend and for preparation to start the design and implementation of the DoubleLinkList class I started updating the test code for the LinkedLists test class. The current code builds a crude list taking into account the pre and next members of the Node class.
Following is a screen capture of the console for Visual Studio 2013 when executing a partially commented out test: Continue reading “Linked Lists – Part IV”
I spent some time enhancing and testing the SingleLinkList class. I will stop at this point. On the next post related linked lists will design and implement the DoubleLinkList class using the same methods that have been implemented on the SingleLinkList class. Of course, while testing one class or the other some new method may be added or an existing method may be modified. This is typical in software development.
Following is a screen capture of a console generated by Visual Studio 2013 when running the test code for the SingleLinkList class: Continue reading “Linked Lists – Part III”