Skip to content

Instantly share code, notes, and snippets.

package com.squareup.alcatraz.auth;
import com.google.common.base.Optional;
import com.unboundid.ldap.sdk.Filter;
import com.unboundid.ldap.sdk.LDAPConnection;
import com.unboundid.ldap.sdk.LDAPException;
import com.unboundid.ldap.sdk.ResultCode;
import com.unboundid.ldap.sdk.SearchRequest;
import com.unboundid.ldap.sdk.SearchResult;
import com.unboundid.ldap.sdk.SearchResultEntry;
@wgpshashank
wgpshashank / Hint.md
Created September 25, 2012 19:02 — forked from yuvipanda/Hint.md
Repair Roads Solution (InterviewStreet CodeSprint Fall 2011)

The line graph of a graph G is a graph having the edges of G as it's nodes and edges between them if the corresponding edges in G are adjacent. The Hamiltonian Completion Number is the minimum number of edges to be added to a graph for it to have a Hamiltonian Cycle.

Formally, the problem can be stated as asking for the Hamiltonian Completion Number of the line graph of a tree. While this problem is NP-Complete for the general case, it is in fact solvable in polynomial (linear actually) time for trees. Again, I do not have a simple algorithm, or a proof of why the algorithm works. Feel free to look at solutions or read up more about the problem online. See: http://en.wikipedia.org/wiki/Hamiltonian_completion http://www.sciencedirect.com/science/article/pii/S0020019000001642

Note that the caterpiller trees discussed above are precisely the trees for which the Hamiltonian Completion Number of their line graphs is 0.

@wgpshashank
wgpshashank / JavaScript Compiler. final version
Created February 9, 2012 14:55 — forked from rohit-nsit08/JavaScript Compiler. final version
My GSOC proposal for "JavaScript on Parrot"
NAME: Rohit Jangid
EMAIL ID: rohit.nsit08@gmail.com
GOOGLE ID: rohit.nsit08
OTHER CONTACT INFO:
Irc nick-name on #parrot channel: rohit_nsit08
skype id : rohit_nsit08
@wgpshashank
wgpshashank / MemoizationAverage.rb
Created September 16, 2011 23:26
Snippets of code I've written recently to various programming challenges
#Problem= Given N, arrange all numbers from 1 to N such that the average of any two numbers in the list #does not lie between them.
#if this doesn't run, "gem install memoize" add sudo in front if you don't use RVM to manage your gems
require 'rubygems'
require 'memoize'
require 'benchmark'
include Memoize
def good_list(n)