Showing posts with label recursion. Show all posts
Showing posts with label recursion. Show all posts

Towers of Hanoi

In my Java class this semester, we went over the Towers of Hanoi problem during our study of recusion. The recusrive solution is elegant. It is also simpler than any iterative solution. We did not code a solution. We just studied one intently to understand the recursive nature of it.

Recently I saw one of the sample problems you need to solve during a Facebook interview. One of them is the Towers of Hanoi problem. Nice. Facebook even let's you code the thing in Java. It has to work correctly. And you need to complete the thing in 45 minutes.

Not sure if I can meet that metric. But at least I have seen the problem and solution before. I guess I could google the code. That would be cheating. I feel good about what my Java college class is teaching me.

Advanced Java

I have been away from the Java programming language for almost the whole summer. There was an app I wanted to write. But I needed it to work quick. So I fell back to using C++. Now I want to get back into the Java swing of things (no pun intended). This week I signed up for a community college course on Advanced Java.

I was a little shocked by the price of the class. It rang up to around $800. That does not even cover the cost of the book. I thought community college was supposed ot be inexpensive. It might be worth it though. We are supposed to cover topics such as collections, multithreading, generics, database programming, network programming, and Java Server Pages. Dang. That's quite a list.

To get my Java skills back, I decided to read the first chapter from the class textbook. It is on recusion. The Java syntax for recursion is simple enough. Understanding the technique of generating a recursive algorithm to solve a problem is hard. With the new Java class coming up at the end of the month, I think I will be more chatty on my blog about Java points of interest.