Re: [algogeeks] Networking:suggest some book

2011-09-17 Thread Gaurav Menghani
. -- Gaurav Menghani -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit

Re: [algogeeks] I want resources to learn algorithms on Permutation and Combination problems and Graph algorithms except CLRS..

2011-09-16 Thread Gaurav Menghani
Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Gaurav Menghani -- You

Re: [algogeeks] SPOJ PIE

2011-09-15 Thread Gaurav Menghani
@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Gaurav Menghani -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] Party Lamps

2011-09-15 Thread Gaurav Menghani
Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Gaurav Menghani

Re: [algogeeks] How can we find second largest element in an array... in O(n+logn-2)... give me proof.....

2011-09-10 Thread Gaurav Menghani
Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Gaurav Menghani -- You received

Re: [algogeeks] MICROSOFT WRITTEN QUESTION

2011-09-10 Thread Gaurav Menghani
mentioned), and Bottom-up. Search for Bottom-up DP. -- Gaurav Menghani -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks

Re: [algogeeks] Find th gcd of 2 nos in the most efficient way

2011-09-10 Thread Gaurav Menghani
@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Gaurav Menghani -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] MICROSOFT WRITTEN QUESTION

2011-09-10 Thread Gaurav Menghani
://groups.google.com/group/algogeeks?hl=en. -- Gaurav Menghani -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr

Re: [algogeeks] Re: How can we find second largest element in an array... in O(n+logn-2)... give me proof.....

2011-09-10 Thread Gaurav Menghani
this group at http://groups.google.com/group/algogeeks?hl=en. -- Gaurav Menghani -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email

Re: [algogeeks] Write a function to find the least common multiple of integers in an array

2011-09-10 Thread Gaurav Menghani
this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Gaurav Menghani -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post

Re: [algogeeks] MICROSOFT WRITTEN QUESTION

2011-09-10 Thread Gaurav Menghani
, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Gaurav Menghani -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email

Re: [algogeeks] Digest for algogeeks@googlegroups.com - 25 Messages in 9 Topics

2011-09-07 Thread Gaurav Menghani
. -- Gaurav Menghani -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options

Re: [algogeeks] SPOJ

2011-09-06 Thread Gaurav Menghani
to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Gaurav

Re: [algogeeks] SPOJ Problem DIVSUM

2011-08-27 Thread Gaurav Menghani
. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Gaurav Menghani -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post

Re: [algogeeks] Adding Two no without using any operator...??

2011-08-27 Thread Gaurav Menghani
. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Gaurav Menghani -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group

Re: [algogeeks] Remove all Duplicates Words

2011-08-24 Thread Gaurav Menghani
. -- Gaurav Menghani -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit

Re: [algogeeks] Factorial Algorithms

2011-08-17 Thread Gaurav Menghani
Sure. On Wed, Aug 17, 2011 at 4:33 PM, Nitin Nizhawan nitin.nizha...@gmail.com wrote: @Gaurav , if you are able to find any resource that explains the logic of these algos, please let me know. On Sat, Aug 13, 2011 at 9:50 AM, Gaurav Menghani gaurav.mengh...@gmail.com wrote: Thanks

Re: [algogeeks] GSOC

2011-08-16 Thread Gaurav Menghani
/algogeeks?hl=en. -- Gaurav Menghani -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more

Re: [algogeeks] How to hash Strings

2011-08-14 Thread Gaurav Menghani
options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Gaurav Menghani -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group

Re: [algogeeks] what is mean by %2.3d in scanf

2011-08-13 Thread Gaurav Menghani
to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Gaurav Menghani -- You received this message because you are subscribed to the Google

Re: [algogeeks]

2011-08-13 Thread Gaurav Menghani
Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Gaurav Menghani -- You

Re: [algogeeks] what is mean by %2.3d in scanf

2011-08-13 Thread Gaurav Menghani
wrote: lol On Sat, Aug 13, 2011 at 6:12 PM, Gaurav Menghani gaurav.mengh...@gmail.com wrote: http://lmgtfy.com/?q=scanf+float+precision+format On Sat, Aug 13, 2011 at 5:42 PM, SuDhir mIsHra sudhir08.mis...@gmail.com wrote: e g: scanf(%2.4d,a); -- You received this message because you

Re: [algogeeks] what is mean by %2.3d in scanf

2011-08-13 Thread Gaurav Menghani
anika.jai...@gmail.com wrote: @gaurav: nyc one ;) how u made this one well? On Sat, Aug 13, 2011 at 6:14 PM, SANDEEP CHUGH sandeep.aa...@gmail.com wrote: lol On Sat, Aug 13, 2011 at 6:12 PM, Gaurav Menghani gaurav.mengh...@gmail.com wrote: http://lmgtfy.com/?q=scanf+float+precision+format

Re: [algogeeks] logic???????????

2011-08-13 Thread Gaurav Menghani
, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Gaurav Menghani -- You received this message because you are subscribed

Re: [algogeeks] string confusion

2011-08-13 Thread Gaurav Menghani
, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Gaurav Menghani -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send

Re: [algogeeks] Factorial Algorithms

2011-08-12 Thread Gaurav Menghani
...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Gaurav Menghani -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com

Re: [algogeeks] find a solution

2011-08-11 Thread Gaurav Menghani
to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Gaurav Menghani -- You received this message because you

Re: [algogeeks] find a solution

2011-08-11 Thread Gaurav Menghani
In C++ it is done in the following way: - Concatenate all strings - Sort the string - Use next_permuation On Thu, Aug 11, 2011 at 7:01 PM, Gaurav Menghani gaurav.mengh...@gmail.com wrote: I guess we should learn to google first. On Thu, Aug 11, 2011 at 5:58 PM, surender sanke surend

Re: [algogeeks] find a solution

2011-08-11 Thread Gaurav Menghani
answered already, before posting in the said forum. This question has been answered repeatedly. If you want to answer all repeated questions, I suggest you take the onus of doing so. On Thu, Aug 11, 2011 at 7:01 PM, Gaurav Menghani gaurav.mengh...@gmail.com wrote: I guess we should learn to google

Re: [algogeeks] find a solution

2011-08-11 Thread Gaurav Menghani
they want. post the answer if you are willing, otherwise just ignore it. Its better we should see the workability of the group. Thank you, Siddharam On Fri, Aug 12, 2011 at 10:42 AM, Gaurav Menghani gaurav.mengh...@gmail.com wrote: On Fri, Aug 12, 2011 at 12:09 AM, siddharam suresh siddharam

Re: [algogeeks] pls help

2011-08-10 Thread Gaurav Menghani
at the the new last position, which is 'l'. can u pls explain that? On Fri, Aug 5, 2011 at 2:57 PM, Nitin Nizhawan nitin.nizha...@gmail.com wrote: Ok, Thanks On Fri, Aug 5, 2011 at 2:53 PM, Gaurav Menghani gaurav.mengh...@gmail.com wrote: Even if the number of elements is more than two

Re: [algogeeks] help--code

2011-08-08 Thread Gaurav Menghani
...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Gaurav Menghani -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com

Re: [algogeeks] help--code

2011-08-08 Thread Gaurav Menghani
Sorry, I was thinking something else. Code 1 should be faster since arrays are stored in row-major fashion, the entire row will fit in cache, and accessing sequentially in the row would be faster because of higher cache hits than Code 2. On Mon, Aug 8, 2011 at 3:25 PM, Gaurav Menghani

Re: [algogeeks] help--code

2011-08-08 Thread Gaurav Menghani
to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Gaurav Menghani -- You received this message because you are subscribed to the Google

Re: [algogeeks] Random number

2011-08-08 Thread Gaurav Menghani
an ordered sequence...just put the generated no.s in hash table as soon as they are generated...dats it.. then afterwards display that hash table.. Did u get me...? On 8/7/11, Gaurav Menghani gaurav.mengh...@gmail.com wrote: We can have a sorted sequence and display them in random order

Re: [algogeeks] os

2011-08-08 Thread Gaurav Menghani
to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Gaurav

Re: [algogeeks] shift left nd right

2011-08-08 Thread Gaurav Menghani
. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Gaurav Menghani -- You received this message because you are subscribed to the Google Groups Algorithm Geeks

Re: [algogeeks] max product!

2011-08-07 Thread Gaurav Menghani
Also, when using a greedy strategy, it is best when you can PROVE why the strategy works. On Sun, Aug 7, 2011 at 10:25 PM, Gaurav Menghani gaurav.mengh...@gmail.comwrote: O(n) solution is pretty simple, without using a greedy strategy. prod[i] denotes product of ith, i+1th and i+2th elements

Re: [algogeeks] Re: max product!

2011-08-07 Thread Gaurav Menghani
Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Gaurav

Re: [algogeeks]

2011-08-06 Thread Gaurav Menghani
/software_development/postmans_sort/cuj/cuj.htm On 8/5/11, Gaurav Menghani gaurav.mengh...@gmail.com wrote: I agree with Dilip. It depends upon what type of input you have at hand. - Suppose you have an array having a million elements, where the elements are in the range 1-3, counting sort would be perfect

Re: [algogeeks] Random number

2011-08-06 Thread Gaurav Menghani
and display them randomly, i mean: Let say a[10] contains all the random no.s , map all the 10 indexes to a hash table and then display the arrays with the hashed index... I think it may work... what say..? On 8/5/11, Gaurav Menghani gaurav.mengh...@gmail.com wrote: 1. Get a good seed. 2

Re: [algogeeks] pls help

2011-08-05 Thread Gaurav Menghani
('-'); for(int i=0;ialphabet.size();i++) { s[l]=alphabet[i]; backtrack(s,l+1); } } -- Gaurav Menghani -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe

Re: [algogeeks] pls help

2011-08-05 Thread Gaurav Menghani
it again.. On Fri, Aug 5, 2011 at 12:32 PM, Gaurav Menghani gaurav.mengh...@gmail.com wrote: On Fri, Aug 5, 2011 at 12:20 PM, Kamakshii Aggarwal kamakshi...@gmail.com wrote: given a set of letters and a length N, produce all possible output.(Not permutation). For example, give the letter

Re: [algogeeks] pls help

2011-08-05 Thread Gaurav Menghani
() { maxlen=3; alphabet=op; backtrack(,0); return 0; } On Fri, Aug 5, 2011 at 12:42 PM, Kamakshii Aggarwal kamakshi...@gmail.com wrote: @gaurav:i could not understand ur sol.can u explain it again.. On Fri, Aug 5, 2011 at 12:32 PM, Gaurav Menghani gaurav.mengh...@gmail.com wrote: On Fri, Aug

Re: [algogeeks] Re: remove duplicate words in a string

2011-08-05 Thread Gaurav Menghani
...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Gaurav Menghani -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com

Re: [algogeeks] pls help

2011-08-05 Thread Gaurav Menghani
'};  int numchars =sizeof(chars)/sizeof(char);  int N=3;  generate(numchars,chars,N); } On Fri, Aug 5, 2011 at 12:58 PM, Gaurav Menghani gaurav.mengh...@gmail.com wrote: An Implementation: #includeiostream #includestring using namespace std; string alphabet; int maxlen; void backtrack(string

Re: [algogeeks] pls help

2011-08-05 Thread Gaurav Menghani
','o'};  int numchars =sizeof(chars)/sizeof(char);  int N=3;  generate(numchars,chars,N); } On Fri, Aug 5, 2011 at 12:58 PM, Gaurav Menghani gaurav.mengh...@gmail.com wrote: An Implementation: #includeiostream #includestring using namespace std; string alphabet; int maxlen; void

Re: [algogeeks] pls help

2011-08-05 Thread Gaurav Menghani
: @Varun  I think it can be done using bits, if input character set has only two elements. Or could u plz explain? On Fri, Aug 5, 2011 at 2:29 PM, Varun Jakhoria varunjakho...@gmail.com wrote: I think it can be done using bitwise ANDing with a mask On Fri, Aug 5, 2011 at 12:58 PM, Gaurav Menghani

Re: [algogeeks] Random number

2011-08-05 Thread Gaurav Menghani
to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Gaurav Menghani -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks

Re: [algogeeks] Random number

2011-08-05 Thread Gaurav Menghani
the theory about PRNGs and LFSRs, all of them repeat. On Fri, Aug 5, 2011 at 7:14 PM, payel roy smithpa...@gmail.com wrote: How do you guarantee termination of your algorithm if duplication occurs ?? On 5 August 2011 18:25, Gaurav Menghani gaurav.mengh...@gmail.com wrote: You might want to read

Re: [algogeeks] Re: Give an efficient search algo

2011-08-04 Thread Gaurav Menghani
Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Gaurav Menghani -- You received

Re: [algogeeks] Re: Tug of War

2011-08-04 Thread Gaurav Menghani
polynomial-time algorithm for this problem. If you think you have a greedy solution to this problem, think again. The DP solution is also, 'pseudo-polynomial-time' [0] http://en.wikipedia.org/wiki/Partition_problem -- Gaurav Menghani -- You received this message because you are subscribed to the Google

Re: [algogeeks] Re: Tug of War

2011-08-04 Thread Gaurav Menghani
On Thu, Aug 4, 2011 at 7:42 PM, Gaurav Menghani gaurav.mengh...@gmail.com wrote: On Thu, Aug 4, 2011 at 7:37 PM, saurabh singh saurab...@gmail.com wrote: Its a classical 0/1 knapsack problem which can be implemented either as a greedy solution or dp It has been stated earlier

Re: [algogeeks] Re: Tug of War

2011-08-04 Thread Gaurav Menghani
in reasonable time. When you increase the set size, the time taken increases. -- Gaurav Menghani Stony Brook University -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com

Re: [algogeeks] Google Telephonic interview

2011-08-04 Thread Gaurav Menghani
@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Gaurav Menghani -- You received this message because you are subscribed to the Google Groups Algorithm Geeks

Re: [algogeeks] Google Telephonic interview

2011-08-04 Thread Gaurav Menghani
Then that has to be mentioned in the question. Premature optimization is the root of all evil, in the words of Don Knuth. On Fri, Aug 5, 2011 at 9:38 AM, Anand Shastri anand.shastr...@gmail.com wrote: what if new task gets added every time. On Thu, Aug 4, 2011 at 8:24 PM, Gaurav Menghani

Re: [algogeeks] Data Structure to design logn LCA

2011-08-04 Thread Gaurav Menghani
) time. Segment tree [0] is what you are looking for. [0] http://www.topcoder.com/tc?module=Staticd1=tutorialsd2=lowestCommonAncestor -- Gaurav Menghani -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email

Re: [algogeeks]

2011-08-04 Thread Gaurav Menghani
Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Gaurav Menghani -- You received

Re: [algogeeks] Least Common Ancestor in an n ary tree

2011-08-04 Thread Gaurav Menghani
Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Gaurav Menghani -- You received

Re: [algogeeks] compiler

2011-08-04 Thread Gaurav Menghani
to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Gaurav Menghani -- You received this message because you

[algogeeks] Re: Missing elements

2011-08-01 Thread Gaurav Menghani
On Aug 1, 6:25 pm, Deepak deepakthegi...@gmail.com wrote: Given an array of elements 'n'. some kn elements are replaced by elements such that the repalced elements are n. with o(n) find the missing elements, without wasting any extra memory. I think you did not phrase the question correctly.