varuntechlog.blogspot.com
{variable code, maths, language, concepts, puzzles, etc;}: February 2008
http://varuntechlog.blogspot.com/2008_02_01_archive.html
Variable code, maths, language, concepts, puzzles, etc;}. Tuesday, February 12, 2008. Tiger(JDK 5) has introduced a lot of features and in turn lots more to dig into. Here I want to explain the issues that arise due to equality comparisons and Autoboxing/Auto-unboxing. Since, equality operator (= ) can be used with reference variables and primitive types, the first question is what happens when we equate reference wrapper variable with its corresponding primitive type. Integer iObj = new Integer(i);.
varuntechlog.blogspot.com
{variable code, maths, language, concepts, puzzles, etc;}: April 2008
http://varuntechlog.blogspot.com/2008_04_01_archive.html
Variable code, maths, language, concepts, puzzles, etc;}. Tuesday, April 8, 2008. Good read on IoC and DI. Http:/ martinfowler.com/bliki/InversionOfControl.html. Http:/ martinfowler.com/articles/injection.html. Something that cleared my thought process (an excerpt from one of the articles). Inversion of Control is a key part of what makes a framework different to a library. Subscribe to: Posts (Atom). View my complete profile. Travel template. Template images by enot-poloskun.
varuntechlog.blogspot.com
{variable code, maths, language, concepts, puzzles, etc;}: Array Product
http://varuntechlog.blogspot.com/2012/06/array-product.html
Variable code, maths, language, concepts, puzzles, etc;}. Sunday, June 3, 2012. Q: Given an unsorted array of I of N integers, find an array O of N integers such that O[i] is the product of all integers in I except I[i]. Solve without using division. 1 Break the product into two parts as O[i] = (I[0] * I[1] * . * I[i-1]) * (I[i 1] * . * I[N-1]). 2 Calculate first part by iterating over I from 0 to N-1. 3 Multiply the values from step 2 with the second part by iterating over I from N-1 to 0.
varuntechlog.blogspot.com
{variable code, maths, language, concepts, puzzles, etc;}: June 2012
http://varuntechlog.blogspot.com/2012_06_01_archive.html
Variable code, maths, language, concepts, puzzles, etc;}. Thursday, June 28, 2012. Given a string of length N, rotate the string by K units. Eg. rotation of abcdef by 2 units will result in cdefab. 1) Using a temp Array. 2) 1 shift at a time. 3) Juggling algorithm - uses GCD(N,K) outer loop and inner loop till cycle is encountered. 4) Gries algorithm - divide and conquer. 5) Reversal algorithm - revert individual blocks and then revert the full string. The first multiple (also known as LCM – least ...
varuntechlog.blogspot.com
{variable code, maths, language, concepts, puzzles, etc;}: December 2008
http://varuntechlog.blogspot.com/2008_12_01_archive.html
Variable code, maths, language, concepts, puzzles, etc;}. Thursday, December 18, 2008. Today, I was just googling for the online image manipulators and found this. Blog entry worth keeping track of. Thanks for the info. Just to copy the most relevant information from that page:. A list of free online image editors:. Subscribe to: Posts (Atom). View my complete profile. Travel template. Template images by enot-poloskun.
varuntechlog.blogspot.com
{variable code, maths, language, concepts, puzzles, etc;}: String rotation
http://varuntechlog.blogspot.com/2012/06/string-rotation.html
Variable code, maths, language, concepts, puzzles, etc;}. Thursday, June 28, 2012. Given a string of length N, rotate the string by K units. Eg. rotation of abcdef by 2 units will result in cdefab. 1) Using a temp Array. 2) 1 shift at a time. 3) Juggling algorithm - uses GCD(N,K) outer loop and inner loop till cycle is encountered. 4) Gries algorithm - divide and conquer. 5) Reversal algorithm - revert individual blocks and then revert the full string. The first multiple (also known as LCM – least ...
varuntechlog.blogspot.com
{variable code, maths, language, concepts, puzzles, etc;}: Shuffling
http://varuntechlog.blogspot.com/2012/06/shuffling.html
Variable code, maths, language, concepts, puzzles, etc;}. Sunday, June 24, 2012. Q: Given an array, print a random permutation of it such that each permutation is equally likely. The first approach is to use a random number generator to generate a value between 0 - 1 and associate each element of the array with a random value. Now sort the array based on these random values associated with the array elements. Subscribe to: Post Comments (Atom). View my complete profile.
varuntechlog.blogspot.com
{variable code, maths, language, concepts, puzzles, etc;}: Repeating substring
http://varuntechlog.blogspot.com/2012/06/pattern-matching.html
Variable code, maths, language, concepts, puzzles, etc;}. Tuesday, June 5, 2012. Q: Given a string S find the smallest sub-string X such that S = (X). Ie S is a repetition of one or more X's. Iterate string from start to end keeping 2 pointers pointing to certain indexes in the string. The first one indicating endIndex of the sub-sequence X found till now. The second one indicating the index with which we must compare the character read in the next iteration. Subscribe to: Post Comments (Atom).
varuntechlog.blogspot.com
{variable code, maths, language, concepts, puzzles, etc;}: May 2012
http://varuntechlog.blogspot.com/2012_05_01_archive.html
Variable code, maths, language, concepts, puzzles, etc;}. Thursday, May 31, 2012. Sum of bits set. Q: Given a positive integer N calculate the sum of bits set for all the numbers from 0 to N. I will be using. Divide and conquer for this. Fact: The sum of all set bits from 0 to (2 n) - 1 is (2 n-1) * n. This can be proved by induction or construction. 1) Get the MSB location of the integer N, i.e. the left most bit which is set as 1, lets say it is X. 3) Now, add 1 for number (2 X) to Sum. 3 Since there a...