Thursday, September 16, 2010

Finding a loop in a singled Linked List

Found an approach on Internet regarding how to find a loop in a singled linked list. Though you may know this already, this is possible for my own reference. ;)

Catch Loops in Two Passes

(Source)

O(n) time complexity

Simultaneously go through the list by ones (slow iterator) and by twos (fast iterator). If there is a loop the fast iterator will go around that loop twice as fast as the slow iterator. The fast iterator will lap the slow iterator within a single pass through the cycle. Detecting a loop is then just detecting that the slow iterator has been lapped by the fast iterator.


// Best solution
function boolean hasLoop(Node startNode){
Node slowNode = Node fastNode1 = Node fastNode2 = startNode;
while (slowNode && fastNode1 = fastNode2.next() && fastNode2 = fastNode1.next()){
if (slowNode == fastNode1 || slowNode == fastNode2) return true;
slowNode = slowNode.next();
}
return false;
}

This solution is "Floyd's Cycle-Finding Algorithm" as published in "Non-deterministic Algorithms" by Robert W. Floyd in 1967. It is also called "The Tortoise and the Hare Algorithm".

Thursday, August 19, 2010

PeriPeople

Many of you have joined already. But still, for your information, our HW guru Kirk has created a site PeriPeople for those have been working at Peri then Nortel (Enterprise Solution) then Avaya. You can visit it at:

http://www.peripeople.com

whenever you get a chance. :)

Thursday, July 22, 2010

Hibernate Tutorial (YouTube)

Courtesy of Barbara, here is a Hibernate tutorial at YouTube:

http://www.youtube.com/watch?v=GINvxAaXDbY&feature=related

Have fun...

Monday, July 12, 2010

Build Eclipse once for any platform

How cool is this?

Using the Eclipse "delta pack" downloadable via the Eclipse site. You can build your Eclipse RCP app once and have it include the libraries for so many different platforms.

Instructions here:
http://www.vogella.de/articles/EclipsePDEBuild/article.html

I just built an app that will run on Windows 32bit, Linux 32bit, and Linux 64bit all at once. Totally awesome timesaver! :)

Jane @ Ingres

Wednesday, July 7, 2010

helios is here

The new version of eclipse 3.6 is here.  It has support for JSF 2.0 web projects and content assist for JSF - really sweet.  I am running through the JSF tooling getting started help pages building a JSF 2.0 app - it rocks.  I am gonna try to run it on the beta of apache tomcat 7.0 which is also newly available for download and is servlet spec 3.0 compliant...

Thursday, July 1, 2010

More Google stuff

What a cool site! Check it out ...

http://www.ppcblog.com/how-google-works/

Jane @ Ingres

Interview Questions - Core Java

You may know these already. Just put some important areas at interviews in core Java here as a note/reminder about:
  1. Collections
  2. Threading
  3. Declaration, OO, Exception Handling etc.
  • What is the difference between interface and abstract class? (Declaration)
  • What is the difference between final and finally? (Declaration, Exception Handling)
  • What is the difference between overriding and overloading? (OO)
  • What is Polymorphism? (OO)
  • When would finally not get called? (Exception Handling)
(to be continued...)

Hello and Google Books

HELLO Peri Alum buddies! What a great way of sharing info! :)

I want to tell you about Google Books!

Google is scanning in and hosting thousands of books here: http://books.google.com/books

Somehow they won a court battle to do so.

You can have access to tonnes of book material, specifically look at all the Eclipse books! For free!
http://www.google.com/search?q=eclipse+ide&btnG=Search+Books&tbs=bks%3A1&tbo=1

Enjoy!
Jane @ Ingres

My favorite "API" links

I thought of something useful... These are my favorite links to API docs I have in my link bar of my browser - I can barely code without them...

jdk 1.5 API: http://java.sun.com/j2se/1.5.0/docs/api/
ant manual: http://ant.apache.org/manual/index.html
tomcat 6 docs: http://tomcat.apache.org/tomcat-6.0-doc/index.html
JEE API: http://download.oracle.com/docs/cd/E17477_01/javaee/1.4/api/index.html

and soon to be gone I'm sure...

vxml 2.0 spec: http://www.w3.org/TR/voicexml20/#dml1.4

the new blog for us java developers and periphonics alumni

I wish I had something cool to share right now...