•

Check out our Community Blogs

# thechef

Member Since 22 Dec 2009
Offline Last Active Jun 20 2012 08:09 PM

### In Topic: Dfs,bfs Algorithms For Permutation Generation

10 April 2012 - 08:24 PM

Dfs and bfs are specifically for traversing trees, so how do you expect to do this without building a tree?

### In Topic: How to unauthorise parameter passing through URL as in GET?

08 April 2012 - 11:03 AM

Calling "request.getMethod()" will tell you the HTTP method used, i.e. GET, POST, PUT, etc.

### In Topic: Speed Up Algorithm

08 April 2012 - 09:18 AM

I'd say 99% of timeout errors are due to an insufficient algorithm not subtleties in the code. To speed this up, you need to look at your while loop. It looks at every single letter of word "T" for every word "W", making it an order N-squared algorithm. Think about parsing word "T" into a tree structure that alphabetizes its nodes. Then, for each letter in word "W", you can easily find if the letter is in "T". Here is an example for a T of "AARDVARK":

A -> A -> A -> K
A -> A -> A -> R
A -> A -> D ...
A -> A -> K ...
A -> A -> R ...
A -> A -> V ...
A -> D -> A ...
A -> D -> K
A -> D -> R ...
A -> D -> V ...
A -> K
A -> R ...
A -> V ...

I'll let you fill in the rest. Now, finding a letter is order log(N) because the letters are ordered, and your algorithm takes almost half as much time.

I hope that makes sense, and happy coding!

### In Topic: AuthenticationFailedException :((

08 April 2012 - 04:32 AM

Have you seen this tutorial? It looks like they use a password authenticator to abstract their username and password.

http://www.mkyong.co...l-smtp-example/

### In Topic: Is there a way to open a url trough proxy

08 April 2012 - 04:19 AM

It looks like you have to set a couple system properties, as in:
```Properties props = System.getProperties();
props.put("http.proxyHost", "proxyhostname");
props.put("http.proxyPort", "proxyhostport");```

Happy coding!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download