Re: [algogeeks] facebook

2011-07-06 Thread Harshal
thanks for the info DK. On Wed, Jul 6, 2011 at 11:21 AM, DK divyekap...@gmail.com wrote: I've gone through their process. The questions are simpler than those for Google but they look for a different set of qualities in their hires than Google so your CV and reccos (if asked) are important.

Re: [algogeeks] MS

2011-07-06 Thread Ashish Goel
things to consider 1. priority(static, dynamic(based on wait and usage time), priority boost) 2. busy hrs vrs non-busy hrs stop time 3. when idle, should stop at highest traffic generation floor 4. weight factor to decide if to stop or not 5. multiple elevators, some for lower

Re: [algogeeks] MS Question

2011-07-06 Thread Navneet Gupta
See diff documentation. It's an application of Longest Common Subsequence problem. http://en.wikipedia.org/wiki/Diff On Wed, Jul 6, 2011 at 11:12 AM, priyanshu priyanshuro...@gmail.com wrote: What is the most efficient way to compare two text documents?? Also we need to find the percentage by

Re: [algogeeks] Sort - Consecutive Array in O(n)

2011-07-06 Thread Anantha Krishnan
Check this *int isconsecutive(int a[], int n) {* *if (n 1) {* *return 0;* *}* *int max = a[0], min = a[0];* *int i = 0;* * * *int *hash = (int*) calloc(n, sizeof (int));* * * *//find min and max from the array* *for (i = 1; i n; i++) {* *if (a[i]

Re: [algogeeks] Re: meaning of null in output

2011-07-06 Thread Anurag atri
#includestdio.h int main () { int * p = NULL ; printf ( %s , p ) ; getchar () ; } On Sat, Jul 2, 2011 at 3:33 AM, hary rathor harry.rat...@gmail.com wrote: Rajeev : please can u explain by a c example ? -- You received this message because you are subscribed to the Google

[algogeeks] puzzle

2011-07-06 Thread amit the cool
Can you make a target number 37 by using five 5s? You can use any math operator as you want. There are at least two different ways. 5 5 5 5 5 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send

Re: [algogeeks] puzzle

2011-07-06 Thread bagaria.ka...@gmail.com
On Wed, Jul 6, 2011 at 1:23 PM, amit the cool amitthecoo...@gmail.comwrote: Can you make a target number 37 by using five 5s? You can use any math operator as you want. There are at least two different ways. 5 5 5 5 5 (((5+5)/5)^5)+5 ((10/5)^5)+5 (2^5)+5 32+5=37 --

[algogeeks] NVIDIA Q

2011-07-06 Thread Piyush Sinha
What is the size of an object of a class with no members in it?? -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group.

Re: [algogeeks] NVIDIA Q

2011-07-06 Thread durgaprasad k
The size will be 1 byte as there is nothing to look into the object. And it is 1 instead of zero because two objects of the class will have different addresses by assigning each object size 1. Regards, Durga On Wed, Jul 6, 2011 at 2:11 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote: What is

Re: [algogeeks] NVIDIA Q

2011-07-06 Thread Piyush Sinha
thanks buddy..:) On 7/6/11, durgaprasad k durga...@gmail.com wrote: The size will be 1 byte as there is nothing to look into the object. And it is 1 instead of zero because two objects of the class will have different addresses by assigning each object size 1. Regards, Durga On Wed, Jul

Re: [algogeeks] NVIDIA Q

2011-07-06 Thread Gunjan Agarwal
it is 8 bytes if you are talking about a java class On Wed, Jul 6, 2011 at 2:27 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote: thanks buddy..:) On 7/6/11, durgaprasad k durga...@gmail.com wrote: The size will be 1 byte as there is nothing to look into the object. And it is 1 instead of

Re: [algogeeks] Sort - Consecutive Array in O(n)

2011-07-06 Thread Sathaiah Dontula
How about doing like this ?. Without loss of generality, I can assume that numbers starts from 1 (if not, if it starts from ZERO, add by 1 to all the numbers, if it is negative, find the min value, assume it is X, add by (-X)+1)) Now assume numbers are M, compute the product of the numbers and

Re: [algogeeks] Sort - Consecutive Array in O(n)

2011-07-06 Thread sunny agrawal
@ Sathaiah Dontula i think this won't work Because product of m consecutive integers is divisible by m! but reverse is not true ie. if product of m integers is divisible by m! then they are consecutive ?? correct me if i am wrong!! On Wed, Jul 6, 2011 at 12:55 PM, Sathaiah Dontula

Re: [algogeeks] NVIDIA Q

2011-07-06 Thread Gunjan Agarwal
that is why i mentioned if you are talking about a 'java class' On Wed, Jul 6, 2011 at 2:39 PM, Vivek Srivastava srivastava.vivek1...@gmail.com wrote: It is a more standard question when we consider c++,as the minimum size of any object is 1 byte. On Wed, Jul 6, 2011 at 2:35 PM, Gunjan

Re: [algogeeks] puzzle

2011-07-06 Thread amit kumar
thanx guys On Wed, Jul 6, 2011 at 2:40 PM, udit sharma sharmaudit...@gmail.com wrote: (5*5)+(!5)/(5+5) and (((5+5)/5)^5)+5 -- Regards UDIT DU- MCA -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send

Re: [algogeeks] Longest substring 0's 1's

2011-07-06 Thread amit kumar
excellent solution sunny On Tue, Jul 5, 2011 at 11:44 PM, amit kumar amitthecoo...@gmail.com wrote: #includestdio.h #define n 11 int main() { int ar[n]={1,0,1,1,1,0,0,0,0,0,1}; int a[n][n]; int l,i,k,maxlength=0,start,end; for(i=0;in;i++) {

Re: [algogeeks] Re: VIRTUAL INHERITANCE

2011-07-06 Thread T3rminal
@oppilas In normal inheritance base class is not shared. Each derived class X and Y have separate instance of base class. The whole point of virtual inheritance is sharing so that there shall be no ambiguity as there is only one object of base class. -- You received this message because you

[algogeeks] Re: Some adobe interview questions.

2011-07-06 Thread vikas
very nice link for questions of type Q9. http://pw1.netcom.com/~tjensen/ptr/ch9x.htm -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/0ngOncUXrRYJ. To post

[algogeeks] Re: Some adobe interview questions.

2011-07-06 Thread Abhi
Q1. First sort both the strings using counting sort perhaps. Then starting from the first character, search for it in the second string using binary search. The succeeding character of A will be searched from the index in B at which last character of A was found Worst case: When both the

Re: [algogeeks] Re: help to code

2011-07-06 Thread Tushar Bindal
Evenly divisible simply means that a number should be completely divisible by the given numbers, i.e., it should give a whole number as an answer when divided by that particular number. Evenly divisible doesn't mean that quotient should be an even number. It just needs to be a whole number.

[algogeeks] Re: Some adobe interview questions.

2011-07-06 Thread Abhi
Sol for Q4 int pallindrome(char *str) { static length = strlen(str); if(length 1) return 1; if(str[0] == str[length-1]) { length -= 2; return pallindrome(str+1); } else return 0; } -- You received this message because you are

[algogeeks] solve this

2011-07-06 Thread rupali chauhan
Solve Dis! A Boy Forgot His Pin-Code Which Was Of 5 Digits, But Luckily He Remembered Some Hints How To 2 Remind That Password, ...Here Are Those Clues. 1.First Digit Is Equal To The Square Of Second Digit 2.Second Plus 3rd Digit Are Equal To 10 3.4th Digit Equal To The 2nd Digit Plus 1 4.5th

Re: [algogeeks] solve this

2011-07-06 Thread Navneet Gupta
93747. Just defined the variables as x^2, x, y, x+1, 14-y and solved it with information in 5th statement. On Wed, Jul 6, 2011 at 5:28 PM, rupali chauhan chauhanrupal...@gmail.com wrote: Solve Dis! A Boy Forgot His Pin-Code Which Was Of 5 Digits, But Luckily He Remembered Some Hints How To 2

Re: [algogeeks] solve this

2011-07-06 Thread udit sharma
93747.. -- Regards UDIT DU- MCA -- 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

Re: [algogeeks] solve this

2011-07-06 Thread anurag aggarwal
93747 On Wed, Jul 6, 2011 at 5:28 PM, rupali chauhan chauhanrupal...@gmail.comwrote: Solve Dis! A Boy Forgot His Pin-Code Which Was Of 5 Digits, But Luckily He Remembered Some Hints How To 2 Remind That Password, ...Here Are Those Clues. 1.First Digit Is Equal To The Square Of Second

[algogeeks]

2011-07-06 Thread Piyush Sinha
Why is it suggested not to use malloc() or calloc() in C++ for memory allocation? -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks]

2011-07-06 Thread Tamanna Afroze
I think C++ has some advanced feature for memory allocation like new. On Wed, Jul 6, 2011 at 6:34 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote: Why is it suggested not to use malloc() or calloc() in C++ for memory allocation? -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657*

Re: [algogeeks]

2011-07-06 Thread Navneet Gupta
The basic reason is graduation. Since C++ is object oriented and designers wanted to provide more safety in case of dynamic memory allocations, they defined new and delete operators to handle allocation and deallocation. If you see malloc, if does only one function - allocate the memory, with

[algogeeks] Design questions in interviews

2011-07-06 Thread pacific :-)
Hi all , Can someone point to some websites where you can find cs design questions ? Eg. Design a data structure for sparse matrix ? -- regards, chinna. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

[algogeeks] Grouop activity

2011-07-06 Thread Tamanna Afroze
Hi All, This group is very active and useful. Very useful to shre information related to algorithms, its problem and solution. -- Best Regards, *Tamanna Afroze* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send

Re: [algogeeks] solve this

2011-07-06 Thread Anika Jain
93747 On Wed, Jul 6, 2011 at 5:05 AM, anurag aggarwal anurag19aggar...@gmail.comwrote: 93747 On Wed, Jul 6, 2011 at 5:28 PM, rupali chauhan chauhanrupal...@gmail.comwrote: Solve Dis! A Boy Forgot His Pin-Code Which Was Of 5 Digits, But Luckily He Remembered Some Hints How To 2 Remind

[algogeeks] Re: Some adobe interview questions.

2011-07-06 Thread yogi
Yes I am also getting the same. On Jul 5, 12:50 am, Ritesh Srivastava riteshkumar...@gmail.com wrote: For Q3 . Sum of all the digits should be 8. I think , 42101000 is an answer. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to

[algogeeks] Puzzle

2011-07-06 Thread swetha rahul
Hi, A son and father goes for boating in river upstream . After rowing for 1 mile son notices the hat of his fathe falling in the river.After 5 min. he tells his father that his hat has fallen. So they turn round and are able to pick the hat at the point from where they began boating

[algogeeks] Re: Reason for banning

2011-07-06 Thread Sanket
Thanks for the reply Shady. I was hoping that the moderator who banned me gets a chance to reply since I am pretty sure I have done neither of these knowingly - advertising kind of mails, or abusive mails, spamming. The only way this might have happened is if my account got hacked so if that was

[algogeeks] Re: Some adobe interview questions.

2011-07-06 Thread tiru
what about 7? 7 occurred once right? On Jul 6, 12:32 am, aditya kumar aditya.kumar130...@gmail.com wrote: in 7000 : '0' occurs seven times and rst of the numbers occur zero times. i still dint get where i am wrong . plz explain me . On Wed, Jul 6, 2011 at 12:47 AM, L

[algogeeks] Re: Sort - Consecutive Array in O(n)

2011-07-06 Thread Gaurav Tyagi
a) Find min(A). - O(n) b) Find max(A) - O(n) c) Calculate sum of natural numbers starting from min(A) to max(A) - O(n) d) Calculate sum of all numbers in the array. - O(n) e) If sum in step c) is not same as sum in step d), then elements are not consecutive. If the sum is same, then they are

Re: [algogeeks] قروب مملكة الجنس x2020x

2011-07-06 Thread shady
banned !!! this is why people get banned :D 2011/7/6 m love d d love m almouhnad2...@gmail.com [image: http://4.bp.blogspot.com/-3SaLDKOYNrk/ThRiSbWaLlI/AAU/czfZbRx-PHk/s1600/00.jpg] * قروب مملكة الجنس* *للاشتراك ارسل رسالة فارغة على الايميل * *

Re: [algogeeks] Re: Reason for banning

2011-07-06 Thread Arpit Sood
it is fine... :) in case of any complaint, suggestion please mail me i am one of the moderator... and one request from my side please don't discuss errors in code, like why is it giving WA, SIGSEV etc. concentrate on algorithms :D and Advertising, Spamming, Off-Topic posts

Re: [algogeeks] Re: Some adobe interview questions.

2011-07-06 Thread Tushar Bindal
You have given solution for number of coins required for different sum as explained on topcoder tutorial. But I think the question has put forward some conditions based on which it asks us to find the denominations of the 6 coins. You have taken the sum given(which cannot be obtained by using

Re: [algogeeks] Re: Reason for banning

2011-07-06 Thread shady
some new moderators are sanket, arpit, sunny, piyush On Wed, Jul 6, 2011 at 9:41 PM, Arpit Sood soodfi...@gmail.com wrote: it is fine... :) in case of any complaint, suggestion please mail me i am one of the moderator... and one request from my side please don't

Re: [algogeeks] Re: Reason for banning

2011-07-06 Thread shady
lol, arpit you have just joined, lol On Wed, Jul 6, 2011 at 9:44 PM, shady sinv...@gmail.com wrote: some new moderators are sanket, arpit, sunny, piyush On Wed, Jul 6, 2011 at 9:41 PM, Arpit Sood soodfi...@gmail.com wrote: it is fine... :) in case of any complaint,

[algogeeks] Reversing the order of words in String

2011-07-06 Thread Navneet Gupta
I think somebody on this thread has asked this question but i am not able to find that. Question was if a string is like my name is ram, then output should be ram is name my. Wrote the code for same, so sharing. #includeiostream #includestring using namespace std; void SwapStringChars(string

Re: [algogeeks] Puzzle

2011-07-06 Thread Tushar Bindal
Let speed of boat be x miles/hr Let speed of river be s miles/hr First Method: Hat comes down 1 mile in 10 minutes. Hat comes with flow of river only. So its speed is equal to speed of river. In 60 minutes, it will travel 6 miles. thus, s = 6 miles/hr Second Method: Distance travelled upward by

[algogeeks] Re: Reason for banning

2011-07-06 Thread Sanket
Arpit, is it possible to remove the ban from my other email id? I would like to use that email address for activities on this group... On Jul 6, 11:16 am, shady sinv...@gmail.com wrote: lol, arpit you have just joined, lol On Wed, Jul 6, 2011 at 9:44 PM, shady sinv...@gmail.com wrote: some

Re: [algogeeks] Reversing the order of words in String

2011-07-06 Thread Tushar Bindal
good job but how can this be done in one traversal as asked on the Adobe Interview Questions threadhttps://groups.google.com/forum/#%21msg/algogeeks/oEL8z4wwMJY/FAVdr2McPqIJ . On Wed, Jul 6, 2011 at 9:49 PM, Navneet Gupta navneetn...@gmail.com wrote: I think somebody on this thread has asked

Re: [algogeeks] Reversing the order of words in String

2011-07-06 Thread saurabh singh
I have proposed my solution in one of the previous posts.Check the solution there On Wed, Jul 6, 2011 at 10:10 PM, Tushar Bindal tushicom...@gmail.comwrote: good job but how can this be done in one traversal as asked on the Adobe Interview Questions

[algogeeks] Re: Help!!

2011-07-06 Thread KK
Hey anyone Pl help... its clearly written code and algo u know vry well so it wont take much time :) On Jul 5, 8:43 pm, KK kunalkapadi...@gmail.com wrote: This is the solution to the MST problem m getting WA again n again... cant figure out where's the mistake... so plzzz

Re: [algogeeks] Reversing the order of words in String

2011-07-06 Thread Navneet Gupta
Saurabh, I understood your solution but wonder if it is purely single traversal In affect, you have a second traversal when you are popping the strings from stack to form the reverse order string. Though the second activity is less than O(n) i.e. O(#words in string) Nice solution, this way we

[algogeeks] puzzle

2011-07-06 Thread shiv narayan
* You are given 2 eggs. * You have access to a 100-storey building. * Eggs can be very hard or very fragile means it may break if dropped from the first floor or may not even break if dropped from 100 th floor.Both eggs are identical. * You need to figure out the highest floor of a 100-storey

[algogeeks] Re: Some adobe interview questions.

2011-07-06 Thread yogi
On Jul 5, 4:04 am, Dumanshu duman...@gmail.com wrote: ans1. use counting sort for character array (0 to 255) then check for the second string if same or not. ans2. send 1 and 2, 1 comes back, send 10 and 5, 2 comes back, send 2 and 1 ans3. As vikas said, sum of digits should b 8. In that

Re: [algogeeks] NVIDIA Q

2011-07-06 Thread T3rminal
@ashish Most probably because empty struct in C have nothing associated with it. They are as good as nothing. But empty classes in C++ can have member functions. These functions need to be associated with object, having a unique address, for that class. And unique address is not possible with

Re: [algogeeks] Reversing the order of words in String

2011-07-06 Thread Tushar Bindal
I read that solution. But the same doubt as Navneet which I think you also raised i one of your posts on that thread On Wed, Jul 6, 2011 at 10:34 PM, Navneet Gupta navneetn...@gmail.comwrote: Saurabh, I understood your solution but wonder if it is purely single traversal In affect, you have

Re: [algogeeks] puzzle

2011-07-06 Thread Sriganesh Krishnan
i think this puzzle follows arithmetic progression...i'm not sure though...does anybody have a clean explanation for this? On Wed, Jul 6, 2011 at 10:35 PM, shiv narayan narayan.shiv...@gmail.comwrote: * You are given 2 eggs. * You have access to a 100-storey building. * Eggs can be very hard

Re: [algogeeks] puzzle

2011-07-06 Thread Tushar Bindal
100th floor is the answer On Wed, Jul 6, 2011 at 10:35 PM, shiv narayan narayan.shiv...@gmail.comwrote: * You are given 2 eggs. * You have access to a 100-storey building. * Eggs can be very hard or very fragile means it may break if dropped from the first floor or may not even break if

Re: [algogeeks] puzzle

2011-07-06 Thread Tushar Bindal
Eggs can never break the building. So dropping the eggs won't break the building - whether you drop them from 1st floor or 100th floor. On Wed, Jul 6, 2011 at 10:42 PM, Sriganesh Krishnan 2448...@gmail.comwrote: i think this puzzle follows arithmetic progression...i'm not sure though...does

Re: [algogeeks] NVIDIA Q

2011-07-06 Thread Ashish Modi
@piyush: No,one can declare the variable of empty struct and access its address via pointer. So, when you are accessing address via pointer means some memory is allocated for that variable. But *sizeof()* operator returns *zero*?? why??? On Wed, Jul 6, 2011 at 10:38 PM, T3rminal

Re: [algogeeks] puzzle

2011-07-06 Thread aseem garg
14 attempts Aseem On Wed, Jul 6, 2011 at 10:44 PM, Tushar Bindal tushicom...@gmail.comwrote: Eggs can never break the building. So dropping the eggs won't break the building - whether you drop them from 1st floor or 100th floor. On Wed, Jul 6, 2011 at 10:42 PM, Sriganesh Krishnan

[algogeeks] Re: Some adobe interview questions.

2011-07-06 Thread Ankit
For Q1: if length1!=length2 = false else take 2 arrays ch1[256] and ch2[256] For every character c in each string increment the element ch[c] in the respective array; now traverse both arrays together. if each ch1[] element =each ch2[] element = true

Re: [algogeeks] puzzle

2011-07-06 Thread Navneet Gupta
Just to let you guys know it's a good legitimate problem with no trick answer. People who don't know the solution should try. On Wed, Jul 6, 2011 at 10:44 PM, Tushar Bindal tushicom...@gmail.com wrote: Eggs can never break the building. So dropping the eggs won't break the building - whether

Re: [algogeeks] Re: Reason for banning

2011-07-06 Thread Arpit Sood
he made me as well as you moderator just now. what is your banned id ? I don't think any of your ids is banned now On Wed, Jul 6, 2011 at 10:04 PM, Sanket sanku.v...@gmail.com wrote: Arpit, is it possible to remove the ban from my other email id? I would like to use that email address for

Re: [algogeeks] Re: Reason for banning

2011-07-06 Thread shady
none of ur ids are banned On Wed, Jul 6, 2011 at 10:55 PM, Arpit Sood soodfi...@gmail.com wrote: he made me as well as you moderator just now. what is your banned id ? I don't think any of your ids is banned now On Wed, Jul 6, 2011 at 10:04 PM, Sanket sanku.v...@gmail.com wrote: Arpit, is

Re: [algogeeks] puzzle

2011-07-06 Thread Tushar Bindal
@Navneet Didn't get your point -- Tushar Bindal Computer Engineering Delhi College of Engineering Mob: +919818442705 E-Mail : tushicom...@gmail.com Website: www.jugadengg.com -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this

Re: [algogeeks] puzzle

2011-07-06 Thread TIRU REDDY
14 On 6 Jul 2011 22:35, shiv narayan narayan.shiv...@gmail.com wrote: * You are given 2 eggs. * You have access to a 100-storey building. * Eggs can be very hard or very fragile means it may break if dropped from the first floor or may not even break if dropped from 100 th floor.Both eggs are

Re: [algogeeks] puzzle

2011-07-06 Thread Sriganesh Krishnan
@tiru and @aseem: explanation pls...! On Wed, Jul 6, 2011 at 11:11 PM, TIRU REDDY tiru...@gmail.com wrote: 14 On 6 Jul 2011 22:35, shiv narayan narayan.shiv...@gmail.com wrote: * You are given 2 eggs. * You have access to a 100-storey building. * Eggs can be very hard or very fragile

Re: [algogeeks] puzzle

2011-07-06 Thread TIRU REDDY
s(s+1)/2 must be close to 100. The best possible number is 14. try from 14th floor. next from 14+13th floor. next from 14+13+12th floor. Worest case number of attempts = 14. Best Regards, T V Thirumala Reddy Engineer, Qualcomm India Private Ltd. 1540C30, 15th Floor, Building #9, Mindspace,

[algogeeks] Random Number Generator

2011-07-06 Thread Nitish Garg
Describe an implementation of Random(a, b) that only make calls to Random(0, 1)? Well I am thinking this way: - Divide the range (a,b) in to 2 parts like (a, mid) and (mid, b) where mid = (a+b)/2 - Select one of the range using a call to Random(0, 1). - Then continue dividing the

Re: [algogeeks] puzzle

2011-07-06 Thread aseem garg
Suppose u start from x floor. Two cases arise...the egg breaks or it does not. If it doesthen u have to move linearly from first floor. till x-1 floor..Max attempts reqd. = x If it does not break.take a jump of x-1 because ur number of attempts has already increased by1.

Re: [algogeeks] Random Number Generator

2011-07-06 Thread TIRU REDDY
how about a*rand(0,1)+b? On Wed, Jul 6, 2011 at 11:20 PM, Nitish Garg nitishgarg1...@gmail.comwrote: implementation of Random(a, b) that only make calls to Random(0, 1) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this

[algogeeks] Re: puzzle

2011-07-06 Thread shiv narayan
whr s(S+1)/2 must be nearly equal to 100 can uexplain.. On Jul 6, 10:48 pm, TIRU REDDY tiru...@gmail.com wrote: s(s+1)/2 must be close to 100. The best possible number is 14. try from 14th floor. next from 14+13th floor. next from 14+13+12th floor. Worest case number of attempts =

Re: [algogeeks] Random Number Generator

2011-07-06 Thread Nitish Garg
Don't think this will work. Try rand(4, 7) : 4*rand(0,1) + 7 = 4*0 + 7 = 7 or 4*1 + 7 = 11(out of scope). -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit

Re: [algogeeks] Random Number Generator

2011-07-06 Thread sunny agrawal
For RNG in range [a,b] first thing is that all numbers should be generated with equal probability. in your case you are considering mid in both the ranges so you can modify it like [a,mid],[mid+1,b] still I think this will work fine as far as the ranges get divided equally.. like consider the

[algogeeks] Re: Puzzle

2011-07-06 Thread shiv narayan
speed of river=(distance traveled by object in it) / total time it took to travel here hat has traveled a distance of 1 KM and it has taken =5mn+5 min=10 min=10min/60=1/6 hrs; so speed = 1/(1/6)=6km/hr On Jul 6, 9:28 pm, Tushar Bindal tushicom...@gmail.com wrote: Let speed of boat be x miles/hr

Re: [algogeeks] Random Number Generator

2011-07-06 Thread sunny agrawal
Oops ... my method will also not work as probabilities will not be equal !!! On Wed, Jul 6, 2011 at 11:29 PM, sunny agrawal sunny816.i...@gmail.comwrote: For RNG in range [a,b] first thing is that all numbers should be generated with equal probability. in your case you are considering mid in

Re: [algogeeks] Re: puzzle

2011-07-06 Thread Tushar Bindal
the solution is given herehttp://www.thecareerplus.com/?page=resourcescat=150subCat=10qNo=2 but can anyone lease explain it better please give a original solution and stop making rude comments about answers posted genuinely. If you have an original solution, please post it. -- You received this

Re: [algogeeks] Random Number Generator

2011-07-06 Thread Nitish Garg
Yes, I meant (a, mid) and (mid+1, b) only. It now looks to me as the method I proposed will work well if the numbers in the range are a power of 2, in which case the division will be ideal. Still looking a solution for any general range. -- You received this message because you are subscribed

[algogeeks] Re: Interview Question

2011-07-06 Thread DK
If you allow for the following assumptions: 1. All numbers fit into a 32 bit or 64 bit integer. 2. The arrays are actually linked lists. Time complexity: O(N) Space complexity: O(1) Solution: 1. Apply radix sort. (binary radix sort would probably do fine) Note: You can make the sort stable

[algogeeks] Re: NVIDIA Q

2011-07-06 Thread shiv narayan
hey i am getting size of empty struct 1. check my code #includeiostream #includeconio.h using namespace std; struct empty{}; int main() { empty e; int x=sizeof(e); coutx; getch(); return 0; } when i run this i get 1 as output On Jul 6, 10:16 pm, Ashish Modi ashishrmod...@gmail.com

Re: [algogeeks] Random Number Generator

2011-07-06 Thread uttam tiwari
i think a+rand(0,1)(b-a) will work -- 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

Re: [algogeeks] Random Number Generator

2011-07-06 Thread DeVaNsH gUpTa
You can try Random(a,b)=(b-a)*Random(0,1)+a Thanks and Regards DEVANSH GUPTA MNNIT, ALLAHABAD -- 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

Re: [algogeeks] Re: NVIDIA Q

2011-07-06 Thread sanchit mittal
Run dis in saving the same in .C format m getting 0...:) #includestdio.h #includeconio.h struct empty{}; int main() { struct empty e; int x=sizeof(e); printf(%d,x); getch(); return 0; } On Wed, Jul 6, 2011 at 11:58 PM, shiv narayan narayan.shiv...@gmail.comwrote: hey i am getting

Re: [algogeeks] Re: NVIDIA Q

2011-07-06 Thread sanchit mittal
while runnin same code in .cpp format gives 1 On Thu, Jul 7, 2011 at 12:19 AM, sanchit mittal sm14it...@gmail.com wrote: Run dis in saving the same in .C format m getting 0...:) #includestdio.h #includeconio.h struct empty{}; int main() { struct empty e; int x=sizeof(e);

Re: [algogeeks] Random Number Generator

2011-07-06 Thread Nitish Garg
If I understood you properly, Random(a,b)=(b-a)*Random(0,1)+a -Random(3, 6) = (3)*Random(0, 1) + 3 = 3 + 3 = 6 or 0 + 3 = 3 Just generates 3 and 6 with equal probability, what about 4 and 5? -- You received this message because you are subscribed to the Google Groups

[algogeeks] Re: puzzle

2011-07-06 Thread 991
Approach 1: Start from storey 1 and go up. keep dropping one of the eggs. As soon at it breaks, return the storey you are in now. No. of drops in the worst case: 99 Approach 2: Split the building into 10 '10 storeyed' parts. Start Dropping eggs at 10,20,30,...th storey. If it breaks at say

[algogeeks] Re: Random Number Generator

2011-07-06 Thread Dave
@Nitish: I'm assuming that Random(0,1) returns 0 and 1 randomly, with equal probability. Let n = ceiling(log_2(b-a+1)). Use the rejection method (http://en.wikipedia.org/wiki/ Rejection_sampling) as follows: Generate an integer, k, 0 = k 2^n, one bit at a time, using Random(0,1) n times. k will

Re: [algogeeks] Random Number Generator

2011-07-06 Thread surender sanke
@nitish i think all above meant 3+rand(0,1)+rand(0,1)+rand(0,1) surender On Thu, Jul 7, 2011 at 12:36 AM, Nitish Garg nitishgarg1...@gmail.comwrote: If I understood you properly, Random(a,b)=(b-a)*Random(0,1)+**a -Random(3, 6) = (3)*Random(0, 1) + 3 = 3 + 3 = 6 or 0 +

[algogeeks] Re: Reason for banning

2011-07-06 Thread Sanket
I am able to access the posts using my other email Id, thanks for the help. On Jul 6, 12:37 pm, shady sinv...@gmail.com wrote: none of ur ids are banned On Wed, Jul 6, 2011 at 10:55 PM, Arpit Sood soodfi...@gmail.com wrote: he made me as well as you moderator just now. what is your banned

[algogeeks] Re: Some adobe interview questions.

2011-07-06 Thread KK
for Q5 change the expr into postfix and then build expression tree... but is expression tree same as parse tree?? correct me if i m wrong!! -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

[algogeeks] DP or DFS

2011-07-06 Thread KK
https://www.spoj.pl/problems/SHOP/ Anybody plzz post a solution to the above problem... i tried with dp but it failed... How to implement with DFS or if possible with DP??? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group,

Re: [algogeeks] DP or DFS

2011-07-06 Thread radha krishnan
nothing :P BFS :P On Wed, Jul 6, 2011 at 1:23 PM, KK kunalkapadi...@gmail.com wrote: https://www.spoj.pl/problems/SHOP/ Anybody plzz post a solution to the above problem... i tried with dp but it failed... How to implement with DFS or if possible with DP??? -- You received this message

Re: [algogeeks] Reversing the order of words in String

2011-07-06 Thread Piyush Sinha
Can we do it using linked list if ONE TIME TRAVERSAL is a constraint?? On 7/6/11, Tushar Bindal tushicom...@gmail.com wrote: I read that solution. But the same doubt as Navneet which I think you also raised i one of your posts on that thread On Wed, Jul 6, 2011 at 10:34 PM, Navneet Gupta

Re: [algogeeks] Unique substring

2011-07-06 Thread Hemesh Singh
I think this problem can be solved by KMP algorithm in O(n) time. I find suffix tree hard to implement. On Tue, Jul 5, 2011 at 9:43 PM, Aakash Johari aakashj@gmail.com wrote: Its probably Longest repeating substring problem. So it can be solved with suffix array/tree easily in O(n) time.

Re: [algogeeks] Re: Reason for banning

2011-07-06 Thread shady
i have made you moderator sanket, you can even ban me now. :D On Thu, Jul 7, 2011 at 1:20 AM, Sanket sanku.v...@gmail.com wrote: I am able to access the posts using my other email Id, thanks for the help. On Jul 6, 12:37 pm, shady sinv...@gmail.com wrote: none of ur ids are banned

Re: [algogeeks] Re: puzzle

2011-07-06 Thread Aakash Johari
And what about binary search? On Wed, Jul 6, 2011 at 12:26 PM, 991 guruprakash...@gmail.com wrote: Sorry abt the previous post ( and this one ) if it ended up as a spam. I just saw the question and left the place. When I finished posting, ppl hav already given replies... On Jul 7, 12:12 am,

Re: [algogeeks] Reversing the order of words in String

2011-07-06 Thread Navneet Gupta
@Piyush, could you elaborate your approach with Linked List? From what i am getting, even with Linked List, you would need two traversals at least. On Thu, Jul 7, 2011 at 2:07 AM, Piyush Sinha ecstasy.piy...@gmail.com wrote: Can we do it using linked list if ONE TIME TRAVERSAL is a constraint??

Re: [algogeeks] Re: puzzle

2011-07-06 Thread saurabh singh
We have two eggs,so have only two chances of missing.SO its about a combination of binary and linear search. On Thu, Jul 7, 2011 at 9:09 AM, Aakash Johari aakashj@gmail.com wrote: And what about binary search? On Wed, Jul 6, 2011 at 12:26 PM, 991 guruprakash...@gmail.com wrote: Sorry

Re: [algogeeks] Re: puzzle

2011-07-06 Thread Aakash Johari
How AP(ans=14) solution is satisfying the constraints? -- 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

Re: [algogeeks] Re: Some adobe interview questions.

2011-07-06 Thread Navneet Gupta
Anyone for Q10, i wonder if it can really be solved in O(n). Very obvious O(nlogn) is what I know On Thu, Jul 7, 2011 at 1:25 AM, KK kunalkapadi...@gmail.com wrote: for Q5 change the expr into postfix and then build expression tree... but is expression tree same as parse tree?? correct me if i

[algogeeks] Re: Random Number Generator

2011-07-06 Thread anonymous procrastination
@surender Yep, I think the same. for(i=0;i(b-a);i++,a+=rand(0,1)); Watsay? -- 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

Re: [algogeeks] Reversing the order of words in String

2011-07-06 Thread Vishal Thanki
If we only need to print the words in reverse order, strtok+recursion can help. Following is the code (which also stores the string into another string, not memory efficient though): #include stdio.h #include string.h #include stdlib.h char str[] = This is a new world; char sstr[sizeof(str)];

Re: [algogeeks] NVIDIA Q

2011-07-06 Thread oppilas .
Ok. So for differentiating objects, we have size 1. What will be size of following class:- class A{ int z; }; How does different objects gets differentiated in above case? On Wed, Jul 6, 2011 at 2:24 PM, durgaprasad k durga...@gmail.com wrote: The size will be 1 byte as there is nothing to

  1   2   >