Skip to content

Instantly share code, notes, and snippets.

@wgpshashank
wgpshashank / Home.json
Last active October 6, 2020 09:51
College Home
{
"All": {
"Engineering": {
"TotalCount": 2456,
"colleges": [{
"name": "IIT Guhawati",
"imageUri": "http://s3-us-east-1.amazonaws.com/bucket/avc.jpg"
},
{
"name": "IIT Bombay",
@wgpshashank
wgpshashank / NewsArticles.Json
Created June 11, 2020 08:41
News Articles Structure
[
{
"website": "https://www.amarujala.com/education",
"newsUpdates": [
{
"headline": "PSEB 10th Result 2020: राज्य में सभी बच्चे पास, बन गया रिकॉर्ड",
"date_string": "2020-06-10",
"url": "https://www.amarujala.com/education/pseb-1oth-result-2020-100-percent-student-pass-no-one-is-fail?src=top-lead"
},
{
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 / SumOfCubes
Last active February 6, 2019 05:32
Find the smallest number expressible as the sum of cubes of two numbers in two different ways. Indeed, 10^3 + 9^3 =12^3+1^3=1729 , Do It Efficiently
Problem:
A mathematician G. H. Hardy was on his way to visit his collaborator S. Ramanujan an who was in the hospital. Hardy remarked to Ramanujan that he traveled in taxi cab number 1729 which seemed a dull one and he hoped it was not a bad omen. To this, Ramanujan( Math Guy) replied that 1729 was a very interesting number-it was the smallest number expressible as the sum of cubes of two numbers in two different ways.
Indeed, 10^3 + 9^3 =12^3 + 1^3 = 1729.
Hint: This problem is very similar to another very popular problem that is asked in interviews.
You are given a η ×η matrix in which both rows and columns are sorted in ascending order and you are supposed
to find a given number in the matrix.
Algorithm:
@wgpshashank
wgpshashank / Auto-Suggestion
Created October 17, 2011 07:09
How Google Won User's Heart :: Google Auto-Suggestion/Auto-Completion Algorithm Exposed
How Auto Suggestion Works e.g. How Google Won User's Heart
You've seen search engines suggest queries when you begin typing the first few letters of your search string. This is being done by Duck Duck Go as well as Google (to name a few). This is typically done by maintaining
a list of past queries and/or important strings that the search engine thinks are worthy of being suggested to a user that is trying to find something similar. These suggestions are effective only if the search engine
spits them out very fast since these should show up on the screen before the user has finished typing what he/she wanted to type. Hence the speed with which these suggestions are made is very critical to the usefulness of this feature.
Let us consider a situation (and a possible way of approaching this problem) in which when a user enters the first few letters of a search query, he/she is presented with some suggestions that have as their prefix,
the string that the user has typed. Furthermore, these suggestions should
@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)