Technology, life, programming, travel and money.

Programming

McGaijin Software interview – Learn Hiragana Now!

McGaijin Software interview – Learn Hiragana Now!

McGaijin Software have just released their first iOS app “Learn Hiragana Now!” to help you learn the Japanese hiragana alphabet. Here is my interview with them. 1. Tell us about your new iOS app. 'Learn Hiragana Now!' is my little app to help people to read and write hiragana (one of the Japanese syllabaries) in as fast a time as [...]

DOS: Get the directory name from a file path

DOS: Get the directory name from a file path

If you need to write a DOS batch file that takes a file path as an input parameter and needs to do something to other files in the same directory as the input file then you’ll find there is no easy way to get the file’s directory name into a variable. You could pass in the directory name as a separate parameter but that seems like [...]

Triangle Identification – C++ solution and test code

Here is another interview coding question that I have heard of. You have to write a function to identify the triangle type. You have to return a number between 1 or 4 to identify either a valid triangle type or an error. The solution is very simple requiring only one condensed line of code to identify each triangle type. Two lines of code [...]

Reverse the words in a sentence – C++ solution and test code

Here is a solution to the standard interview questions of reversing the letters in the words of a sentence. It is a more complex version of the even more common "reverse a string" question. I also include my test code. There are two main parts to this. The first identifies where the word boundaries are. The second reverses the letters between [...]

Picking the 5th from last element in a singly linked list

Here's another of those fun coding interview puzzles. The kind that companies like Microsoft or Google might ask you. Given a singly linked list, select the 5th from last element. I'm writing the solution in C++ but the solution in Java would be almost identical. I'm also putting up my test code. The restrictions are - you can only make one [...]

Reverse a linked list – C++ source code

Reversing a linked list is a simple programming problem, which is often an interview question. In this case I'm referring to a singly linked list. I'll provide the C++ solution and the C++ test code. One of the easiest ways to reverse the linked list is to create a new head pointer, iterate through the list removing each item in turn and then [...]

Dijkstra’s Algorithm code in C++

Dijkstra’s Algorithm code in C++

Dijkstra's algorithm is a famous algorithm that calculates the routes and distances from a start node to all other nodes in a connected graph where all the distances are positive. Here is a version which I wrote in C++. My aim here was to try to create a version that was easy to read, rather than the most efficient version. I used the excellent [...]

Select 100 random values from a stream / linked list

Select 100 random values from a stream / linked list

Here's an interesting puzzle / interview question that I heard recently. Problem You have a either a linked list or a stream containing int values. You don't know how large the stream / linked list except that it contains 100 or more values. You need to write a method that selects 100 random values from the stream. You have to write the [...]

Friend Quotes – My first Facebook ‘app’

A few weeks ago I finished my first Facebook 'app'... Well, 'app' is too grand a word. All it does it display a random selection of your friend's quotes on your Facebook profile page. I wrote it just to see how easy it was to make a very simple Facebook extension. As it turns out it was very easy. Everything you need is on their official [...]

QuickSort Implementation Code in C++

I was having a look at the QuickSort algorithm (as you do for fun) and was trying to find a tidy looking implementation in C++. I found a lot of implementations out there but most of them looked far more complicated than I thought they should have been. The QuickSort algorithm as printed in the book looks relatively simple. I wanted a C++ [...]

 Page 1 of 2  1  2 »