Re: [algogeeks] recursive

2010-07-11 Thread sharad kumar
@harit if that is d case plz post d link 4 this ques. remember if u dont want to discuss these ques,u can any time ignore this mail ,let others who are not as sharp as u discuss these questions. PS:this is d ques by amazon in 3rd round of interview -- You received this message because you are

[algogeeks] When should i use Calloc() ?

2010-07-11 Thread RIDER
what is the advantage of using calloc() over malloc() and in which case i should use that? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send

[algogeeks] solutions?

2010-07-11 Thread venkat kumar
are solutions available for problems in spoj,uva,codedhef,topcoder,etc.etc.?pls tell me tnkyou -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group,

[algogeeks] Tutorial HTML And DHTML,javascript,php,asp,css tutoiral, div tag tutorial

2010-07-11 Thread tutorialized
Hello Friend there are many website of html language but no body so able to clear the concept of html language .if wanna clear to your concept log on to www.tutorialized.co.in -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this

Re: [algogeeks] solutions?

2010-07-11 Thread ashish agarwal
solution for topcoder all available but not others On Sun, Jul 11, 2010 at 2:19 AM, venkat kumar svenkatkuma...@gmail.comwrote: are solutions available for problems in spoj,uva,codedhef,topcoder,etc.etc.?pls tell me tnkyou -- You received this message because you are subscribed to the

[algogeeks] sort in O(n)

2010-07-11 Thread srikanth sg
Given an array of size n wherein elements keep on increasing monotically upto a certain location after which they keep on decreasing monotically, then again keep on increasing, then decreasing again and so on. Sort the array in place (ie. using only O(1) extra memory). -- You received this

[algogeeks] Remove Extra Parenthesis

2010-07-11 Thread amit
Give a algorithm to remove extra pair of parenthesis Remove unnecessary from an expression : 1) (((a))) = a 2) (a+b) = a+b 3) (a+b)*c = (a+b)*c 4)(((a+b)*(c+d))+e) = (a+b)*(c+d)+e -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to

[algogeeks] String Problem

2010-07-11 Thread amit
given a string find the number of distinct substrings of the string. ex: input- output- 4(a, aa, aaa, ) input-abcd output-10(a, b, c, d, ab, bc, cd, abc, bcd, abcd) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this

Re: [algogeeks] recursive

2010-07-11 Thread harit agarwal
here is the recursion http://geeksforgeeks.org/?p=2686 execution: http://codepad.org/pMszw4Y8 was it difficult to google it -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com.

[algogeeks] Histogram Problem

2010-07-11 Thread amit
Given an histogram.. find out the maximum rectangle in it.. You are given the histogram as an array of heights of each bar.. find it in O(n).. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

Re: [algogeeks] sort in O(n)

2010-07-11 Thread srikanth sg
thr is no search option there .. if u can gimme the link that will be good .. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to

[algogeeks] Difference b/w two elements in a array

2010-07-11 Thread amit
Given an array of size n.find 2 numbers from array whose difference is least. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to

Re: [algogeeks] C++++

2010-07-11 Thread varun bhatia
public class sample { const int a; sample(int constValue):a(constvalue) { } }; On Sun, Jul 11, 2010 at 8:17 AM, UMESH KUMAR kumar.umesh...@gmail.comwrote: Hello everybody how to Assign Constant value in Class of C++ Describe : Private,Protected, and Public Area in

[algogeeks] Re: Sub-2Dmatrix maximum

2010-07-11 Thread Debajyoti Sarma
I was talking about this approach. for( left_top_i=0 ; left_top_irow_no ; left_top_i++ ) for( left_top_j=0 ; left_top_jcol_size ; left_top_j++ ) for( bottom_right_i=left_top_i ; bottom_right_irow_size ; bottom_right_i++ ) for( bottom_right_j=left_top_j ; bottom_right_jrow_size ; bottom_right_j++

[algogeeks] a correction in probability problem

2010-07-11 Thread rahul rai
A chess competition in which A is the present champion B and C are the challengers Furthermore,following: •  0.6. = probability that B will Beat C in any match •  0.5. =probability that A will Beat B in any match •  0.7. = probability that A will Beat C in any match B AND C are made to play a

[algogeeks] Re: geometry

2010-07-11 Thread Tech Id
If O(n^3) is permissible, then the following works: -- If we can find one point that falls on such a line, then it is easy to find the other points because the slope between this point and all other points that fall on this line

[algogeeks] Re: Remove Extra Parenthesis

2010-07-11 Thread Tech Id
Assuming we do not want to remove brackets from cases like (a+b)+c, (because strictly speaking, the brackets here are not required), one algorithm to remove brackets for given above cases can be: 1) Scan through the string. 2) Increment a counter when '(' is encountered and decrement it on ')' 3)

[algogeeks] Re: sort in O(n)

2010-07-11 Thread Tech Id
I searched Google for it but no luck. Texts have made references to k-tonic sort but couldn't find definition. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from

[algogeeks] Re: There are 2 type of values - 1 byte and 2 byte given a pointer to any point in the string tell me if its a 1B or 2B value ending there. MSB of 1-byte character is 0 and MSB of 2-byte

2010-07-11 Thread Tech Id
Question is not clear to me :( Can you explain a little more and also give an example if possible? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group,

[algogeeks] Re: recursive

2010-07-11 Thread Tech Id
Doesn't the solution without queue look very inefficient? The tree is being traversed till level n-1 for every Nth level printing. Thus if the tree has height h, then h^2 tree traversals are there. Nodes being accessed at level l (assuming fully balanced tree): 1 + 2 + 4 + 2^l = 2^(l+1) - 1 which

[algogeeks] Re: When should i use Calloc() ?

2010-07-11 Thread TiGuCo
Although this is question is more a C question than a an algorithm question, it is in fact a very good question. The calloc function works very like malloc, but it initializes all its bits to zero. It has a little more overhead than malloc, because it must write zeros in the memory, but it could

Re: [algogeeks] graph:

2010-07-11 Thread jalaj jaiswal
yeah secod part will be in n^2*k On Sun, Jul 11, 2010 at 9:36 AM, sharad kumar sharad20073...@gmail.comwrote: how to do second part it requires log k matrix multiplication thus o(n3 log n) plzz xplain -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] recursive

2010-07-11 Thread devendra pratap singh
to do level order traversal u can apply BFS taking root node as a starting node u can implement it either in a iterative way or recursive way On Sun, Jul 11, 2010 at 6:42 PM, harit agarwal agarwalha...@gmail.comwrote: here is the recursion http://geeksforgeeks.org/?p=2686 execution:

[algogeeks] Minimum Window String

2010-07-11 Thread amit
Given a set T of characters and a string S , find the minimum window in S which will contain all the characters in T in complexity O(n) . Constraint : The characters may appear in any order -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To

Re: [algogeeks] sort in O(n)

2010-07-11 Thread jalaj jaiswal
its easy suppose the array is 12345 4321 2345 4321 it increases then dcreases then increases and decreases again first of all in a single scan find the location of decreasing sub-arrays here it is 5 to 8 and 13-16 and reverse the decreasing array. so the array becomes 12345 1234 2345 1234 now

Re: [algogeeks] Difference b/w two elements in a array

2010-07-11 Thread Amit Jaspal
Constraint - O(n) On Sun, Jul 11, 2010 at 9:24 AM, amit amitjaspal...@gmail.com wrote: Given an array of size n.find 2 numbers from array whose difference is least. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group,

Re: [algogeeks] Difference b/w two elements in a array

2010-07-11 Thread jalaj jaiswal
sort the numbers ... the numbers with minimum difference will be adjacent On Sun, Jul 11, 2010 at 9:54 PM, amit amitjaspal...@gmail.com wrote: Given an array of size n.find 2 numbers from array whose difference is least. -- You received this message because you are subscribed to the Google

[algogeeks] xoring

2010-07-11 Thread sharad kumar
given a set of numbers u hve to find the pair which give maximum value if we xor that pair ex a={1,3,6,7,8,9} then ans is 15 as 7 xor 8 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

Re: [algogeeks] Minimum Window String

2010-07-11 Thread Anand
you can use longest common subsequence algorithm to solve it. http://codepad.org/NDAeIpxR On Sun, Jul 11, 2010 at 9:32 AM, amit amitjaspal...@gmail.com wrote: Given a set T of characters and a string S , find the minimum window in S which will contain all the characters in T in complexity

[algogeeks] Re: Amazon: sort array

2010-07-11 Thread Abhishek Kumar Singh
@souravsain for input {10,20,30,40,50,23,27}; ur output is coming 10, 20, 23, 27, 40, 30, 50, which not SORTED array. On Jul 10, 6:19 pm, souravsain souravs...@gmail.com wrote: @Jitendra I have run the code with input given by you and found that it works well. Please have a look