Re: [algogeeks] Query: Function returning void pointer
ya void * malloc(void * ptr) since void * is generic pointer,it can converted to pointer of any type and vice versa On Tue, Nov 22, 2011 at 1:28 PM, Anika Jain anika.jai...@gmail.com wrote: yes.. On Tue, Nov 22, 2011 at 1:23 PM, Aniket aniket...@gmail.com wrote: Can a function return a void pointer ? -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] function overloading query
no it wont work ... const is not a datatype. its a qualifier On Sun, Nov 20, 2011 at 7:49 PM, rahul sharma rahul23111...@gmail.comwrote: void fun(char *) void fun(const char *) is this overloading works or these are same type of arguments?? -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] function overloading query
it wont work even this wont function(char a[]) function (char *) coz the two forms are interchangeable On Sun, Nov 20, 2011 at 10:12 PM, saurabh singh saurab...@gmail.com wrote: wont work..Thre is no way compilers gonna guess which function to call.The const qualifier only guarantees that the value at the address wont be altered inside the function.That has nothing to do with calling, On Sun, Nov 20, 2011 at 9:50 PM, rahul vatsa vatsa.ra...@gmail.comwrote: yes, it will work. On Sun, Nov 20, 2011 at 9:12 PM, Akash Coder akash.coder.g...@gmail.comwrote: no it wont work ... const is not a datatype. its a qualifier On Sun, Nov 20, 2011 at 7:49 PM, rahul sharma rahul23111...@gmail.comwrote: void fun(char *) void fun(const char *) is this overloading works or these are same type of arguments?? -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- Saurabh Singh B.Tech (Computer Science) 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 group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Silly question
yup... solve new varieties of problem... u will get used to it On Sun, Nov 20, 2011 at 11:09 PM, amrit harry dabbcomput...@gmail.comwrote: i have a silly question to ask. im gud in ALGO and gud in DATA STR. but i can solve a problem if i know the algorithm or if earlier faced it. i can't able to think my own logics and solve new mathematical problems. even i dont know about how to come up with new TEST DATA. i knw we can develop this skill only by practice. but is there any method or steps to be followed during solving a problem? -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: urgent :guys what type of ques does flipkart ask anyidea for written and interview
ne updates on flipkart n1?? On Fri, Sep 9, 2011 at 9:53 PM, siva viknesh sivavikne...@gmail.com wrote: hi...which coll and package???...plz post the interview experiences after attending ..thx On Sep 8, 6:03 pm, htross htb...@gmail.com wrote: please post the questions after the first round is over... On Sep 8, 9:35 am, rahulmaximus rahul29ma...@gmail.com wrote: what the pattern like? Any papers or type of topics to stress on would be welcomed ... -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] pointerssss
hey...d code doesn't compile on gcc though On Sat, Oct 1, 2011 at 7:32 PM, rahul sharma rahul23111...@gmail.comwrote: but it is ++(*ptr) i mean valure at ptr is incremented..n hw AN when we have written %ci cant get dat On Sat, Oct 1, 2011 at 6:47 PM, SAMM somnath.nit...@gmail.com wrote: Think pointer as an array , then u can understand the problm. Here *ptr=TAN ; so ptr points to the First adress of the string . when u do increment it just point to the next address and Thus is gives AN . On 10/1/11, rahul sharma rahul23111...@gmail.com wrote: void main() { void *ptr; char *a='A'; char *b=TAN; int i=50; ptr=a; ptr=(*char)malloc(sizeof(a)); printf(%c,*ptr); ptr=i; ptr=(*int)malloc(sizeof(i)); printf(%d,++(*ptr)); ptr=b; ptr=(*char)malloc(sizeof(b)); printf(%c,++(*ptr)); } Ans: A51AN int his o/p int last printf it is %c but hw it is printing a two character stringANisn't it a51 n then ++(*ptr)++(T) so it become *U* * * *isnt it a51U* * * * * *but above ans is correct...* * * *explain plz* -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- Somnath Singh -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Does anyone haveOperating System Concepts with Java, 8th Edition ebook plz mail me Thanx in advance
nebody has OPERATING SYSTEMS DESIGN AND IMPLEMENTATION by Andrew S. Tanenbaum thanx :) On Sun, Oct 2, 2011 at 8:38 AM, Deoki Nandan deok...@gmail.com wrote: -- With Regards Deoki Nandan Vishwakarma -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] yahoo qn
i am trying implement it by d shuffling of an array using random. On Wed, Sep 28, 2011 at 8:39 PM, Shravan Kumar shrava...@gmail.com wrote: How about using the order of words a key? 41325 is the key in you i/p . But this is so trivial, what we can do further is by encrypting this number On Wed, Sep 28, 2011 at 8:16 PM, Akash Mukherjee akash...@gmail.comwrote: hi dis is a qn posted in this grp itself Q3) Input - India is a great country. Key(alphanumeric) - B2. You have to encrypt the given sentence, in such a way that only the words should be jumbled. Output - great India a is country. While decrypting it, you have to use the same alpha numeric key and we should be able to get the same original string, i.e., India is a great country. can some1 plzz give a working solution...not able to figure out :( thanx :) -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Yahoo
any language pref?? are bash solns acceptable?? On Mon, Sep 26, 2011 at 12:04 PM, abhishek abhishek.ma...@gmail.com wrote: a file is given containing lots of records seprated by new line (records can be repeat) and a substring given for egabc now check for the record which contains the substring and print top 10 record according to their frequency derive algo with complexity o(n) On Sep 26, 10:58 am, htross htb...@gmail.com wrote: can u explain more on the coding question u solved? On Sep 26, 9:08 am, aditya kumar aditya.kumar130...@gmail.com wrote: I cleared the written round, the next round was coding round. We were asked to select any one problem out of three in 2 hrs. Q1) Given n number of xml files find a particular word and output should list all the files in current directory that contains that word. Q2) Given a hierarichal structure i.e., you have a parent class, a child class which extends a parent class which has some attributes and methods. You need to parse the structure and output should give you the set of the base class, set of derived class, set of attribute set and the set of method. Q3) Input - India is a great country. Key(alphanumeric) - B2. You have to encrypt the given sentence, in such a way that only the words should be jumbled. Output - great India a is country. While decrypting it, you have to use the same alpha numeric key and we should be able to get the same original string, i.e., India is a great country. I opted for the 3rd question, I used an array to store the starting offset of a word and i used key to shuffle the offset. i used hash function which takes the key and according the key value it shuffles the set of offsets while doing encryption. While decrypting i used the reverse method and i shuffled the same way to get back the original offset. After 2 hrs the external asked me to explain my logic, i explained each and every line and he was very much happy with the algorithm. He asked all the students to wait outside. They shortly announced the results for the next interview round. Technical round -1 He asked me whether i was nervous, i told him frankly, yes sir a little bit. Then he motivated me by saying that you have done well in the previous rounds thats why you are here. Then he asked me to solve a problem. The problem was given a time in format of hh:mm we have to find the min angle between hr nd min hand. I answered him well and he was happy with that so he did not aske me to write the code. Second question - There is a system which continuously takes stream of data from one end, and from other end we want to retrive the particualr number is present in the system or not. Example - If you are retriving for 10 and if it is present then return the same number else return the closest value to that number. I used hashing then he asked me if I had a large input let us say in lakhs then hashing is not ideal approach. Then i told him that its better to use max heap. Then he said ok and before moving to next questions he told me that there are other better approach to this. He asked about my favourite subjects since i told my fav subject was OS, he started askimg me questions about OS. The questions were -Difference b/w semaphore and monitor -There are two threads, one produces even number and other produces odd number, how will you print the consecutive numbers. -What is semaphore and how will you implement it? -What is deadlock and what are 4 conditions of deadlock. -Simulate deadlock(Pictorial diagram). -Which data structure will you use for deadlock? I answered all the above questions so he was very much happy with it. Then and there he told me that i wont eliminate you in this round and would like to see you in next round. Technical round-2 He asked me about my previous round experience and asked me to introduce myself for another 2/3 mins. He gave me a problem, there is a function which returns 0 or 1. You need to pass each and every element of the array one by one to that function and depending on the return value, you need to store all the numbers in such a way that all the true values should appear first and all the false value should appear last. After thinking for some time i came up with O(n) solution, he asked me to future optimze it. Within 2 mins he moved on to next question. Next question was a puzzle about aliens. Third question was about the real life example of stack. Fourth question was how the internet works as i told that OS and networking was my strong subject. Fifth question was how will you implement tree in real life example. He asked me to wait outside for the result. I
[algogeeks] dbms
hican ne1 suggest good books for dbms...not theory types but more of a question bank like maybe a cracking the coding interview is for coding/algo... thanx :) -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] dbms
@payal : thanx but des are more of theory books ryt?? On Fri, Sep 23, 2011 at 5:32 PM, payal gupta gpt.pa...@gmail.com wrote: KORTH OR NAVATHE is nyc...:) regards, PAYAL GUPTA, CSE 3rd yr, NIT_B On Fri, Sep 23, 2011 at 1:09 PM, Akash Mukherjee akash...@gmail.comwrote: hican ne1 suggest good books for dbms...not theory types but more of a question bank like maybe a cracking the coding interview is for coding/algo... thanx :) - 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] dbms
@ shady : sry, i thought with all the discussions on placement questions it would be a good place :P..will be more particular abt wat i post in future :) On Fri, Sep 23, 2011 at 7:01 PM, payal gupta gpt.pa...@gmail.com wrote: hmmm..yes dey r d theory...vich i used..n dey r gud regards, PAYAL GUPTA, CSE_3rd yr NIT_B On Fri, Sep 23, 2011 at 11:21 PM, Akash Mukherjee akash...@gmail.comwrote: @payal : thanx but des are more of theory books ryt?? On Fri, Sep 23, 2011 at 5:32 PM, payal gupta gpt.pa...@gmail.com wrote: KORTH OR NAVATHE is nyc...:) regards, PAYAL GUPTA, CSE 3rd yr, NIT_B On Fri, Sep 23, 2011 at 1:09 PM, Akash Mukherjee akash...@gmail.comwrote: hican ne1 suggest good books for dbms...not theory types but more of a question bank like maybe a cracking the coding interview is for coding/algo... thanx :) - 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] ms question
thanx...it was very helpful :) On Mon, Sep 12, 2011 at 8:46 PM, Piyush Grover piyush4u.iit...@gmail.comwrote: A can remain same in following cases: - If m, n are equal in all the N iterations - if m, n are equal in N-2 iterations but in 1 iteration m and n both are different in that case there should be one iteration where m and n should be same as the previous iteration so that they are swapped again to the same position. In the similar fashion if you think, the pairwise similar iteration should be there. Now, if in all N iterations probability that m = n is: (N/N*N) * (1/N)*...(1/N) = (1/N)^N two of the iterations have different m and n then probability is: NC2 * (1/N)^(N-2) * {(1 - 1/N)* 1/NC2} = NC2 * (1/N)^N * 2 similarly, four of the iterations have different m and n then probability NC4 * (1/N)^(N-4) *{(1 - 1/N) * 1/NC2}^2 = NC4 * (1/N)^N * 2^2 -Piyush On Mon, Sep 12, 2011 at 10:24 PM, payal gupta gpt.pa...@gmail.com wrote: @piyush.. cud u plzz..xplain...n elaborate Regards, Payal Gupta On Mon, Sep 12, 2011 at 10:15 PM, Piyush Grover piyush4u.iit...@gmail.com wrote: Sry i was little wrong: nC0*(1/n)^n + nC2 *2*(1/n)^n + nC4*2^2*(1/n)^n++nCn*2^(n/2)*(1/n)^n when n is even nC0*(1/n)^n + nC2 *2*(1/n)^n + nC4*2^2*(1/n)^n++nCn-1*2^(n-1/2)*(1/n)^n when n is odd On Mon, Sep 12, 2011 at 10:08 PM, Piyush Grover piyush4u.iit...@gmail.com wrote: it should be: (1/n)^n * (1 + 2 + 2^2 + 2^3 +(n/2)+1 terms) = {2^(1 + n/2) - 1}*(1/n)^n when n even (1/n)^n * (1 + 2 + 2^2 + 2^3 +(n-1/2)+1 terms) = {2^(1 + (n-1)/2) - 1}*(1/n)^n when n is odd -Piyush On Mon, Sep 12, 2011 at 8:01 PM, sandeep nagamalli nsandee...@gmail.com wrote: I think it is 1 / (2N) (1/N) * (1/N)*(N/2) = 1/(2N) On Mon, Sep 12, 2011 at 6:33 PM, Akash Mukherjee akash...@gmail.comwrote: this is a case, but isnt der a case of circular permutation 2?? what say abt dis 0,1 2,3 4,5 0,1 2,3 4,5 it wrks i gues?? On Mon, Sep 12, 2011 at 12:56 PM, teja bala pawanjalsa.t...@gmail.com wrote: I think it is 1/N let N=6 that means rand(6)= takes values 0-5 i.e 6 values. rand(m)=6 values rand(n)=6 values total combinations 6*6=36 values set but among dem array will change only for (0,0)(1,1)(2,2)(3,3)(4,4)(5,5)(6,6)=6values of N So 6/36=1/6 If we generalize it 1/N 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@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. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- ThanksRegards: -sandeep -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] yahoo campus placements
anybody has any yahoo campus placements papers/questions or tips etc. please share thanx in advance Akash -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] yahoo campus placements
bit mesra, cg 7...dunno nething else :( On Wed, Sep 14, 2011 at 3:00 PM, rahul sharma rahul23111...@gmail.comwrote: in which col it is cumingn wats is its procedure???waht is cgpa creteria? On Wed, Sep 14, 2011 at 6:26 PM, Akash Mukherjee akash...@gmail.comwrote: anybody has any yahoo campus placements papers/questions or tips etc. please share thanx in advance Akash -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: yahoo campus placements
k...bt its a gud 2 weeks lefti guess der wud be sm other clg visits b4 dat On Wed, Sep 14, 2011 at 9:22 PM, htross htb...@gmail.com wrote: please share the questions asked after the company visits ur campus On Sep 14, 8:53 pm, Akash Mukherjee akash...@gmail.com wrote: bit mesra, cg 7...dunno nething else :( On Wed, Sep 14, 2011 at 3:00 PM, rahul sharma rahul23111...@gmail.com wrote: in which col it is cumingn wats is its procedure???waht is cgpa creteria? On Wed, Sep 14, 2011 at 6:26 PM, Akash Mukherjee akash...@gmail.com wrote: anybody has any yahoo campus placements papers/questions or tips etc. please share thanx in advance Akash -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] MS test cases type Questions
+1 On Mon, Sep 12, 2011 at 3:42 PM, pg@manit gpt.pa...@gmail.com wrote: Cud some 1 suggest me 4m how 2 practise test cases type of questions which usually cum in MS written Papers? thanx..in advance Regards, PAYAL GUPTA -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] ms question
given a rand(N) a random generator 0 - N-1. now //assume N is defined somewhere int A[N] for(i = 0; i N; i++){ int m = rand(N); int n = rand(N); swap(A[m],A[n]); } what is the probability that array A remains the same? p.s. rand n swap are o(1) in case it makes any diff -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] ms question
this is a case, but isnt der a case of circular permutation 2?? what say abt dis 0,1 2,3 4,5 0,1 2,3 4,5 it wrks i gues?? On Mon, Sep 12, 2011 at 12:56 PM, teja bala pawanjalsa.t...@gmail.comwrote: I think it is 1/N let N=6 that means rand(6)= takes values 0-5 i.e 6 values. rand(m)=6 values rand(n)=6 values total combinations 6*6=36 values set but among dem array will change only for (0,0)(1,1)(2,2)(3,3)(4,4)(5,5)(6,6)=6values of N So 6/36=1/6 If we generalize it 1/N 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@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. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Zynga intern
+1 On Wed, Aug 31, 2011 at 8:12 AM, arvind kumar arvindk...@gmail.com wrote: Hi Can any1 temme process,questions,experiences,etc for zynga intern?? -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] amazon q
heap is true but i am not getting y we can't use a balanced binary tree searching for the smallest is logn(leftmost node), then deleting it is logn so, should it be both?? thanx :) On Sun, Aug 21, 2011 at 6:54 PM, sukran dhawan sukrandha...@gmail.comwrote: its heap On Sun, Aug 21, 2011 at 6:52 PM, Puneet Chawla puneetchawla...@gmail.comwrote: I think Heap DS should be used as to delete smallest element jst apply min heap and delete it and for insertion add the element and apply max or min as needed Max heap = Min heap both have complexities =O(logn) On Sun, Aug 21, 2011 at 6:46 PM, priya ramesh love.for.programm...@gmail.com wrote: A data structure is required for storing a set of integers such that each of the following operations can be done in (log n) time, where n is the number of elements in the set. Deletion of the smallest element Insertion of an element if it is not already present in the set Which of the following data structures can be used for this purpose? · Pick one of the choices A heap can be used but not a balanced binary search tree A balanced binary search tree can be used but not a heap Both balanced binary search tree and heap can be used Neither balanced binary search tree nor heap can be used -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- With regards Puneet Chawla Computer Engineering Student NIT Kurukshetra -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: amazon q
@sagar : deletion in logn, check http://en.wikipedia.org/wiki/Heap_%28data_structure%29 i would say that the re-heapify is implicit just as the re-balance is implicit in balanced bst On Mon, Aug 22, 2011 at 12:58 AM, sagar pareek sagarpar...@gmail.comwrote: +1 Dumanshu This question was asked by amazon :D And answer is BST only coz deletion in heap(min heap) is O(1). And if it is max heap then deletion of min element is O(n). On Sun, Aug 21, 2011 at 9:13 PM, Dumanshu duman...@gmail.com wrote: We can't use a heap. Balanced BST is correct because Deletion of the smallest element Insertion of an element if it is not already present in the set - for this we need to search for the element and searching in heap is O(n). On Aug 21, 6:16 pm, priya ramesh love.for.programm...@gmail.com wrote: A data structure is required for storing a set of integers such that each of the following operations can be done in (log n) time, where n is the number of elements in the set. Deletion of the smallest element Insertion of an element if it is not already present in the set Which of the following data structures can be used for this purpose? · Pick one of the choices A heap can be used but not a balanced binary search tree A balanced binary search tree can be used but not a heap Both balanced binary search tree and heap can be used Neither balanced binary search tree nor heap can be used -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- **Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT 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 group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] array ques
just my 2 cents in d binary search, replacing key with mid, ie if(a[mid] mid) check lower half else upper half should work?? On Mon, Aug 15, 2011 at 12:26 AM, aditi garg aditi.garg.6...@gmail.comwrote: Given an ordered array A[1…n] with numbers in strictly increasing order. Find a ‘j’ such that A [j]=j or -1 if no such number exist in o (log n). -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Adobe Interview Question
dp problem, refer to dp from AFI On Sat, Aug 13, 2011 at 9:01 PM, Decipher ankurseth...@gmail.com wrote: There is a river and there are n number of steps between two banks of the river to cross the river. A frog wants to cross the river with the condition that he can jump max one step. Find the number of ways he can cross the river? For e.g. if there are 3 steps in between, frog can go from paths: _123_, _2_, _13_ so there are 3 different ways frog can cross the river (in the example _ is two ends of the river) Can this question be done using Dynamic Programming ? If yes, please tell how . -- 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/-/4HJq5yRGXboJ. 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. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] amazon help
thanx...downloaded :) On Fri, Aug 12, 2011 at 10:56 AM, coolfrog$ dixit.coolfrog.div...@gmail.com wrote: @all can some plz suggest the source for where i can fine the dates and news regarding amazon off-campus Placements. On Fri, Aug 12, 2011 at 6:36 AM, Akash Mukherjee akash...@gmail.comwrote: Hi, Can anyone suggest from where I should practice for the online coding round for amazon off-campus placements. I am looking for similar problems not for the environment. Thanx, Akash -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- *Divesh* (¨`·.·´¨) Always `·.¸(¨`·.·´¨ ) Keep (¨`·.·´¨)¸.·´Smiling! `·.¸.·´ Life can give u 100's of reason 2cry,but u can give life 1000's of reasons 2Smile -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: amazon help
sure, thanx :) On Fri, Aug 12, 2011 at 4:15 PM, WgpShashank shashank7andr...@gmail.comwrote: @Akshmkj , A Blog For Geeks , Fresher Might Stuck !!! http://shashank7s.blogspot.com - Cracking The Code You Might Enjoy Regards Shashank Mani Computer Science Birla institute of Technology Mesra -- 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/-/RNWXT-3cNusJ. 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. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] amazon help
Hi, Can anyone suggest from where I should practice for the online coding round for amazon off-campus placements. I am looking for similar problems not for the environment. Thanx, Akash -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] amazon help
thanx :) On Fri, Aug 12, 2011 at 7:51 AM, Prakash D cegprak...@gmail.com wrote: www.projecteuler.net On Fri, Aug 12, 2011 at 6:52 AM, Dipankar Patro dip10c...@gmail.comwrote: Topcoder will be a good option. Amazon mainly makes you write functions in which the parameters and structure of any user defined data types are clearly mentioned. Just coding on a normal computer will also help. Suggestion: Make sure you are accustomed with Tree programs, On 12 August 2011 06:36, Akash Mukherjee akash...@gmail.com wrote: Hi, Can anyone suggest from where I should practice for the online coding round for amazon off-campus placements. I am looking for similar problems not for the environment. Thanx, Akash -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- ___ Please do not print this e-mail until urgent requirement. Go Green!! Save Papers = Save Trees -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] MICROSOFT INTERVIEW QUESTIONS faced by my frenz nd me
@srinivas if any of the characters (i,n,d,a) appear den it is no longer readso gujr On Tue, Aug 9, 2011 at 6:04 PM, Srinivas Varanasi srinivas4...@gmail.comwrote: Can any one explain question number 8? On Tue, Aug 9, 2011 at 12:19 PM, Akash Mukherjee akash...@gmail.comwrote: @prashant devcpp gives an error cannot convert `char (*)[5]' to `char*' in initialization ne ideas?? On Mon, Aug 8, 2011 at 12:58 PM, Prashant Kulkarni prashant.r.k...@gmail.com wrote: @Mohit Output Will be: 55some chunk value Reason: When 'p' is assigning, we are assigning next memory location of 'ch'. similar we are assigning same memory location to 'q' as well but while printing, we are printing the last memory location content of 'ch' (i.e p-1) and for 'q' we are printing its starting location so we will some garbage value. -- Prashant Kulkarni On Mon, Aug 8, 2011 at 11:28 AM, Mohit Goel mohitgoel291...@gmail.comwrote: can anyone one explain output of question 1. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- srinivas -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] amazon test question!!!
i think its 1 though ... On Mon, Aug 8, 2011 at 10:21 PM, rohit rajuljain...@gmail.com wrote: What will the following code snippet do, when is it passed the root of a binary tree ? func( Node *node){ if(node-right != NULL) func( node-right); if(node-left != NULL) func( node-left); if( node-left == NULL node-right == NULL ) delete(node); } Pick choice Delete the tree from bottom to top Delete the tree from top to bottom Delete the leaf nodes from right to left Delete the leaf nodes from left to right I think it is 3 -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] amazon
@udit : thanx man...they were really helpful 2 allcan u plzz chk d answers 4 the qns : 18c,20b also how do i solve 14,16 ?? thanx On Mon, Aug 8, 2011 at 1:24 PM, Udit Gupta uditgupta...@gmail.com wrote: helloamazon's this year paper is attached with d mail cn u plz tell me what questions were there in adobe written and interviews?? On Thu, Aug 4, 2011 at 10:23 PM, Kamakshii Aggarwal kamakshi...@gmail.com wrote: Can anyone please tell what is the procedure for amazon campus recruitment? -- Regards, Kamakshi kamakshi...@gmail.com -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Samsung SISO Question
segmented trees?? On Sat, Aug 6, 2011 at 2:05 AM, Ankur Pandey ankur.0002...@gmail.comwrote: U can use merge sort for this.. try and picture the problem, u'll get my point.. On Fri, Aug 5, 2011 at 1:27 PM, amit kumar amitthecoo...@gmail.comwrote: can u plz xplain d qstn a litl more thanx On Fri, Aug 5, 2011 at 8:33 PM, bagaria.ka...@gmail.com bagaria.ka...@gmail.com wrote: Given a rope of 10m , numbered at 1m i.e like 0 1 2 3 4 5 6 7 8 9 10 ||---|---|---|---|---|---|---|---|---| |---10m| One dry out it clothes of various length like 4m from 0-4 then of 2m from 6-8 then 6m from 2-8 and so on ,one on top of another , then u need to construct a data structure such that when seeing from the top u have to give the number of clothes drying , at one particular instance. -- Thanks and Regards *Karan Bagaria* *MCA Final Year* Training and Placement Representative -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: AMAZON DIRECT-I !!!!!!
directi updated On Mon, Jul 25, 2011 at 10:53 PM, shady sinv...@gmail.com wrote: @all Microsoft Questions https://docs.google.com/document/d/1exjvawzl5PRefTu5umJM5KpMBJs15PZVDMzYG_C2FEA/edit?hl=en_US Amazon Questions https://docs.google.com/document/d/1VIpiRycjZpzyEg1vhlm01NW5KeF6Y3RCE4Lq3dVvFGE/edit?hl=en_US Adobe_Directi Questions https://docs.google.com/document/d/1GhsStHu3WaCpbGd2PzpiyTvg_IY53dxLc6g6LzhlyKo/edit?hl=en_US Actually i was only giving an example. I will add the questions for Amazon and Microsoft for tomorrow. Others can also add questions as and when they feel like doing so. @aashish i know a couple of people in BIT MESRA, but i dont think fb could be merged with this google group... still will look into matter... thanks On Mon, Jul 25, 2011 at 10:35 PM, AASHISH SUMAN aashish.barn...@gmail.com wrote: if u have any contact to the people of BIT MESRA plz ask dem or post in the group of bit mesra at fb.. -- WITH BEST REGARDS : AASHISH SUMAN MCA FINAL YEAR NIT DURGAPUR +91-9547969906 -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] MS Written Test
sorry if it seems to be off the topic, but any good resources for trie for a newbie?? thanks :) On Sat, Jul 23, 2011 at 11:02 PM, varun pahwa varunpahwa2...@gmail.com wrote: Use trie tree and store word count also along with the pointer. So, that search could take at max word size time. On Sat, Jul 23, 2011 at 10:4 4 PM, rajeev bharshetty rajeevr...@gmail.com wrote: Trie data structure can be used ? What you say guys?? On Sat, Jul 23, 2011 at 10:43 PM, ankit sambyal ankitsamb...@gmail.com wrote: Use hashing with the words as key. Store the string of the word as the value.. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards Rajeev N B -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- Varun Pahwa B.Tech (IT) 7th Sem. Indian Institute of Information Technology Allahabad. Ph : 09793899112 Official Email :: rit2008...@iiita.ac.in Another Email :: varunpahwa.ii...@gmail.com People who fail to plan are those who plan to fail. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] MS Written Test
@rajeev ty :) On Sun, Jul 24, 2011 at 4:24 PM, rajeev bharshetty rajeevr...@gmail.com wrote: http://www.youtube.com/watch?v=uhAUk63tLRM This would be helpful On Sun, Jul 24, 2011 at 4:21 PM, Akash Mukherjee akash...@gmail.com wrote: sorry if it seems to be off the topic, but any good resources for trie for a newbie?? thanks :) On Sat, Jul 23, 2011 at 11:02 PM, varun pahwa varunpahwa2...@gmail.com wrote: Use trie tree and store word count also along with the pointer. So, that search could take at max word size time. On Sat, Jul 23, 2011 at 10:4 4 PM, rajeev bharshetty rajeevr...@gmail.com wrote: Trie data structure can be used ? What you say guys?? On Sat, Jul 23, 2011 at 10:43 PM, ankit sambyal ankitsamb...@gmail.com wrote: Use hashing with the words as key. Store the string of the word as the value.. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards Rajeev N B -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- Varun Pahwa B.Tech (IT) 7th Sem. Indian Institute of Information Technology Allahabad. Ph : 09793899112 Official Email :: rit2008...@iiita.ac.in Another Email :: varunpahwa.ii...@gmail.com People who fail to plan are those who plan to fail. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards Rajeev N B -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Amazon
wud be glad if u cud post all the ms questions 2 :) On Sun, Jul 24, 2011 at 8:19 PM, Agyat jalsa.n.sa...@gmail.com wrote: recently, MS visited our campus ..and i saw that same questions were repeated in ANNA univ. so it will be helpful to post question if some company visits your campusi've heard that amazon is visiting nit warangal on 28 , so guys from warangal please post questionsas it might be helpful for us... -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: MS
already discussed many timestry using bitmasks On Sat, Jul 23, 2011 at 1:26 PM, Akshata Sharma akshatasharm...@gmail.com wrote: better than O(n^2).. On Sat, Jul 23, 2011 at 1:08 PM, Akshata Sharma akshatasharm...@gmail.com wrote: Given a string *Str of ASCII characters, write the pseudo code to remove the duplicate elements present in them. For example, if the given string is Potato, then, the output has to be Pota. Additional constraint is, the algorithm has to be in-place( no extra data structures allowed) . Extend your algorithm to remove duplicates in the string which consisted of UNICODE characters. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: STL MAP HELP
we could maybe keep an array of keys and sort them according to the values stored in the hashtablejust my 2 cents On Sat, Jun 18, 2011 at 6:10 PM, Harshal hc4...@gmail.com wrote: @KK, yes set is not indexed, but you can insert the map elements in set in sorted order( based on value, here by providing your own comparison class), and using an iterator over this set, you can access each element(each map element). say, from set.begin() to set.end(), you will have the map elements in required sorted order. On Sat, Jun 18, 2011 at 6:02 PM, DK divyekap...@gmail.com wrote: There is a data structure called a bimap. You can access the elements by key and value and they are interlinked. Do a quick google on it. I think that's what you're looking for. -- DK http://twitter.com/divyekapoor Http://www.divye.in -- 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/-/Vqlaqqm3ZzoJ. 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. -- Harshal Choudhary, Final Year B.Tech CSE, NIT Surathkal, Karnataka, India. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Cloud Project
+1 On Mon, Jun 13, 2011 at 4:47 AM, Supraja Jayakumar suprajasank...@gmail.com wrote: Hi All Can someone suggest a simple application that I can develop and host on Azure. I have very little web based programming experience and have some knowledge with .net but nothing major. I am trying to do a small nice project using azure but not sure about the application. Thanks Supraja J -- U -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Square of Large integer
search nd read chinese remainder theorem On Thu, Apr 14, 2011 at 7:04 PM, AAMIR KHAN ak4u2...@gmail.com wrote: *Output:* 0 0 On Thu, Apr 14, 2011 at 7:01 PM, AAMIR KHAN ak4u2...@gmail.com wrote: #includecstdio #define MOD (int)1e9 using namespace std; int main() { int A = 33554432; printf(%d\n,A*A); printf(%d\n,((A*A)%MOD)); return 0; } How can i calculate, lets say last 9 digits of square of 33554432 ? Thanks, Aamir -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] [brain teaser] Sequence Puzzle 13april
next row: 3 1 2 2 1 1 just read the previous row: THREE 1 TWO 2 ONE 1 Regards, Akash Agrawal http://tech-queries.blogspot.com/ On Wed, Apr 13, 2011 at 3:27 PM, vaibhav shukla vaibhav200...@gmail.comwrote: On Wed, Apr 13, 2011 at 1:02 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote: * Sequence Puzzle * * * *The below is a number puzzle. It should be read left to right, top to bottom. Question 1 What is the next two rows of numbers. Question 2 How was this reached. 1 1 2 1 1 2 1 1 1 1 1 2 2 1* next two rows: *3 1 2 2 1 1 1 3 1 1 2 2 2 1 * *Update Your Answers at* : Click Herehttp://dailybrainteaser.blogspot.com/2011/04/sequence-puzzle-13april.html?lavesh=lavesh Solution: Will be updated after 1 day -- Never explain yourself. Your friends don’t need it and your enemies won’t believe it . -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- best wishes!! Vaibhav Shukla 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 more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: [brain teaser] Sequence Puzzle 13april
@AKS: sure! See, first row is 1 1 We can clearly see that there are 2 ones in this row, so we read it aloud like TWO ONE. which id our next row: 2 1 Now we read this row as: ONE TWO ONE ONE (1 2 1 1) and so on... On 4/13/11, AKS abhijeet.k.s...@gmail.com wrote: @Akash : how , can u explain a bit more clearly ?? On Apr 13, 3:27 pm, Akash Agrawal akash.agrawa...@gmail.com wrote: next row: 3 1 2 2 1 1 just read the previous row: THREE 1 TWO 2 ONE 1 Regards, Akash Agrawalhttp://tech-queries.blogspot.com/ On Wed, Apr 13, 2011 at 3:27 PM, vaibhav shukla vaibhav200...@gmail.comwrote: On Wed, Apr 13, 2011 at 1:02 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote: * Sequence Puzzle * * * *The below is a number puzzle. It should be read left to right, top to bottom. Question 1 What is the next two rows of numbers. Question 2 How was this reached. 1 1 2 1 1 2 1 1 1 1 1 2 2 1* next two rows: *3 1 2 2 1 1 1 3 1 1 2 2 2 1 * *Update Your Answers at* : Click Herehttp://dailybrainteaser.blogspot.com/2011/04/sequence-puzzle-13april Solution: Will be updated after 1 day -- Never explain yourself. Your friends don’t need it and your enemies won’t believe it . -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- best wishes!! Vaibhav Shukla 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 more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards, Akash Agrawal http://tech-queries.blogspot.com/ -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Sort array with two subparts sorted
Given an array with two subparts sorted. How will you make a final sorted array. i/p: 1, 5, 7, 9, 11, 23, 2, 3, 8, 9, 21 o/p: 1, 2, 3, 5, 7, 8, 9, 9, 11, 21, 23 Regards, Akash Agrawal http://tech-queries.blogspot.com/ -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Sort array with two subparts sorted
This is obvious solution what if u have contant space? Regards, Akash Agrawal http://tech-queries.blogspot.com/ On Tue, Apr 12, 2011 at 3:48 PM, rajul jain rajuljain...@gmail.com wrote: use merge sort On Tue, Apr 12, 2011 at 3:07 PM, Akash Agrawal akash.agrawa...@gmail.comwrote: Given an array with two subparts sorted. How will you make a final sorted array. i/p: 1, 5, 7, 9, 11, 23, 2, 3, 8, 9, 21 o/p: 1, 2, 3, 5, 7, 8, 9, 9, 11, 21, 23 Regards, Akash Agrawal http://tech-queries.blogspot.com/ -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Sort array with two subparts sorted
since we are bubbling up, it's again is a O(n^2). Is there anything possible like O(n) in constant space. I tried on swapping values but mees it somewhere... here are intermediate steps in my approach. 1, 5, 7, 9, 11, 2, 3, 8, 9, 21 1, 2, 7, 9, 11, *5*, 3, 8, 9, 21 1, 2, 3, 9, 11, *5, 7*, 8, 9, 21 1, 2, 3, 5, 11, 9, 7, 8, 9, 21 1, 2, 3, 5, 7, 9, 11, 8, 9, 21 1, 2, 3, 5, 7, 8, 11, 9, 9, 21 1, 2, 3, 5, 7, 8, 9, 11, 9, 21 1, 2, 3, 5, 7, 8, 9, 9, 11, 21 Regards, Akash Agrawal http://tech-queries.blogspot.com/ On Tue, Apr 12, 2011 at 10:23 PM, powerideas arpitbhatnagarm...@gmail.comwrote: say we hav array {101,102,103,104(ptr1),1,2,3,4(ptr2)} 1.take end of 1 st array in ptr1end of 2nd array in ptr2 2.IF (ptr1ptr2) bubble up ptr1 to ptr2; ptr2-- ptr1-- ELSE ptr2--; 1.compare last element of both arrays ie 104 4 since 1044 bubble up 104 to end since it will be greater than whole 2 nd array so {101,102,103(ptr1),1,2,3,4(ptr2),104} moving on ex 2 : {1,3,5,7(ptr1),2,4,6,8(ptr2)} 78 so ptr2-- {1,3,5,7(pr1),2,4,6(ptr2), 8} {1,3,5(ptr1),2,4,6(ptr2),7,8} moving on.. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Interview Question
@ anurag temp - data = ( temp - next ) - data ; but data cannot be moved, ryt?? On 4/6/11, Anurag atri anu.anurag@gmail.com wrote: in case you are given a pointer to the first node simply do temp -next = ( temp - next ) - next . if you are given a pointer to the second node do , temp - data = ( temp - next ) - data ; temp - next = NULL ; correct me if I am wrong . On Mon, Apr 4, 2011 at 9:48 PM, Umer Farooq the.um...@gmail.com wrote: Hello friends, The following question has appeared in two top companies of my city. I'd appreciate if anyone is able to answer it. Given a singly liked list comprising of three nodes Delete the middle node such that: 1- A temp pointer is pointing to the first node 2- A temp pointer is pointing to the second node. You can not use any other pointer and you can not move data. -- Umer -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards Anurag Atri -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] [brain teaser ] 6april
throw opposite to gravity... Regards, Akash Agrawal http://tech-queries.blogspot.com/ On Wed, Apr 6, 2011 at 1:26 PM, balaji a peshwa.bal...@gmail.com wrote: when u throw it above u. On Wed, Apr 6, 2011 at 1:16 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote: * The Ball Puzzle *How can you throw a ball as hard as you can and have it come back to you, even if it doesn't bounce off anything? There is nothing attached to it, and no one else catches or throws it back to you. Update Your Answers at : Click Herehttp://dailybrainteaser.blogspot.com/2011/04/6april.html?lavesh=lavesh Solution: Will be updated after 1 day -- Never explain yourself. Your friends don’t need it and your enemies won’t believe it . -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- A.Balaji -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] [brain teaser ] 5april
14 Regards, Akash Agrawal http://tech-queries.blogspot.com/ On Tue, Apr 5, 2011 at 1:17 PM, DeboJeet Choudhury wildrahul.on...@gmail.com wrote: 34 roses @ the begining... On Tue, Apr 5, 2011 at 1:11 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote: *Roses Puzzle Solution* * *I have a number of roses for sale. The first buyer bought half of my roses then I gave him additional one for free. The second buyer bought half of the remaining roses then I gave him additional one also for free. The third buyer also bought half of the remaining roses then I gave him additional one also for free, this time all of my roses has been sold out. How many roses do I have? *Update Your Answers at *: Click Herehttp://dailybrainteaser.blogspot.com/2011/04/5april.html?lavesh=lavesh Solution: Will be updated after 1 day -- Never explain yourself. Your friends don’t need it and your enemies won’t believe it . -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- *Wishing you success in your endeavors * -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] graphs
wouldn't a modified dijkstra do the trick?? On 4/2/11, Tech id ilovea...@gmail.com wrote: Given a directed graph G, with V vertices and E edges. Each edge in E is associated with a real number ‘r’,a reliabilty factor with r between 0(exclusive) and 1(inclusive). You are also given a pair of nodes u and v. Find the most reliable path in the given graph from u to v. Input will be the graph represented as a matrix with the following format: * the number of vertices n. (therefore, A is an nxn matrix) * The elements of A, row-wise: (total n*n numbers) A(i,j) = 0 denotes that the edge (i,j) is not present A(i,j) between 0 (exclusive) and 1 (inclusive) indicates that the edge (i,j) is present with reliability A(i,j). Output: Your output will be a sequence of vertices giving the path from u to v such as 1,4,3,5,8,6,7 with u=1 and v=7. The output is thus a comma separated list of vertices giving the path from u to v. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] problem
dc nt givin tle?? On Mon, Mar 28, 2011 at 11:42 AM, sukhmeet singh sukhmeet2...@gmail.comwrote: Well this was asked by codechef on it's intern contest...!! Make a recursive algorithm using divide and conquer paradigm On Thu, Mar 10, 2011 at 11:20 AM, Akash Mukherjee akash...@gmail.comwrote: hi, can anybody plzz look at this problem. i tried a recursive greedy approach but it was too slow i guess You have a truck that you need to completely fill up with merchandise. You have an infinite supply of merchandise of dimension 1x1x1, 2x2x2, 4x4x4, 8x8x8, 16x16x16, ..., 2k x 2k x 2k for all k ≥ 0. (Infinite supply of merchandise of each dimension too!) You wish to fill the truck of dimension AxBxC completely using only these merchandise. Given A, B C, what is the smallest number of merchandise you will need to fill the truck completely? The first line of the input will contain a number T (1 ≤ T ≤ 1000) containing the number of test cases. Each line that follows is a separate test case which has exactly 3 space separated integers A B C (1 ≤ A, B, C 106) which denotes the dimensions of the truck. Additionally, min(A,B,C) 1000. For each case, output a single line containing the minimum number of items needed to fill the entire truck. *Sample Input:* 5 1 1 1 1 2 3 3 4 5 4 5 6 123 12345 123456 *Sample Output:* 1 6 32 29 1951997538 -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] [brain teaser ] 28march
7 races... Regards, Akash Agrawal http://tech-queries.blogspot.com/ On Mon, Mar 28, 2011 at 3:50 PM, anand karthik anandkarthik@gmail.comwrote: Evertime you conduct a race, you eliminate 2 horses. So, 11. On Mar 28, 2011 1:24 PM, Lavesh Rawat lavesh.ra...@gmail.com wrote: *Horse Race Problem Solution* * *Ok, so there are 25 horses and the race track only allows 5 horses to race at a given time. Given that there is no stop watch available your task is to determine the fastest 3 horses. Assume that each horses speed is constant in different races, what is the minimum number of races to determine the fastest 3? Update Your Answers at : Click Here http://dailybrainteaser.blogspot.com/2011/03/28march.html?lavesh=lavesh Solution: Will be updated after 1 day -- Never explain yourself. Your friends don’t need it and your enemies won’t believe it . -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: suggest data structure
what about a graph, edges represent the paths allowed for the knight?? On Sat, Mar 26, 2011 at 12:51 AM, Gene gene.ress...@gmail.com wrote: A knight can move 8 possible ways, so you need 3 bits to encode a movement. To convert these 3 bits into relative motion on a board, define integer board coordinates, then use a lookup table of (delta x, delta y) pairs to store the coordinate change of each possible move. All the elements of these pairs are +-1 and +-2. The current board position of a piece is just an (x,y) coordinate. One such pair is enough for a single knight. On Mar 24, 8:49 am, snehal jain learner@gmail.com wrote: Design a data structure to represent the movement of a knight on a chess board. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Find the first K smallest element from 1 million sized array ...Amazon Question..
http://tech-queries.blogspot.com/2009/05/find-largest-20-elements-from-billions.html Regards, Akash Agrawal http://tech-queries.blogspot.com/ On Tue, Mar 22, 2011 at 10:13 AM, Rajeev Kumar rajeevprasa...@gmail.comwrote: http://flexaired.blogspot.com/2011/03/big-file-containing-billions-of-numbers.html On Mon, Mar 21, 2011 at 4:05 AM, Natansh Verma natansh.ve...@gmail.comwrote: @dave -was this a constraint since the beginning? In case it was, I am sorry I didn't notice. In that case, the heap method ought to work better. I dont think the quicksort method will work. Sent from my iPhone On 20-Mar-2011, at 23:00, Dave dave_and_da...@juno.com wrote: @Natansh: How do you do this with the constraint that your RAM is so small that you cannot accomodate all of the numbers at once? Dave On Mar 20, 9:04 am, Natansh Verma natansh.ve...@gmail.com wrote: There's another way... use the partitioning method for quicksort to find the k smallest elements. Then it should take expected time as O(n + klogk). Plus, it is in-place. On Wed, Mar 16, 2011 at 7:26 PM, asit lipu...@gmail.com wrote: I agree with munna -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.- Hide quoted text - - Show quoted text - -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- Thank You Rajeev Kumar -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] ITRIX OPC 2011 -------Prizes worth 16000 INR to be won and exciting prizes
where to register?? On Fri, Mar 25, 2011 at 2:22 AM, radha krishnan radhakrishnance...@gmail.com wrote: ITRIX OPC 2011 ---Prizes worth 16000 INR to be won and exciting prizes The contest will be conducted in SPOJ. Participants must register in ITRIX WEBSITE(http://itrix.org.in) in order to be eligible for prizes.. Prizes worth 16000 INR to be won .. Link for Trial Run is https://www.spoj.pl/ITRIXTST/ All the best and Happy Coding :) -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Coding Round
kul man...wud appreciate if u cud post your question On Wed, Mar 23, 2011 at 11:28 PM, balaji a peshwa.bal...@gmail.com wrote: hi i got till the third round of technical interview out of the four rounds and got eliminated in third round.anyways thnx for ur support dude :-) On Tue, Mar 22, 2011 at 12:51 PM, balaji a peshwa.bal...@gmail.comwrote: Thnx :-) I am from SSN College of Engineering,Chennai On Tue, Mar 22, 2011 at 12:28 PM, Akash Mukherjee akash...@gmail.comwrote: u r welcome :), nd all the best for ur test.btw, which clg?? On Tue, Mar 22, 2011 at 11:45 AM, guru peshwa.bal...@gmail.com wrote: Thank you very much for the info friendAnd sure will give u a treat :-) On Mar 22, 11:02 am, Akash Mukherjee akash...@gmail.com wrote: hey, dis is what i was told by a friend working @ amazon - Sometimes they do go to the level of the subject basics like OS or DS but you should be able to tackle these if you had studied well. No separate prep is needed. Few Favs DS Algos ( i should get treat for revealing this.;)... ) 1) All Trees (Binary for sure) 2) Graphs 3) Sorting Algos 4) Heaps Let us C ... though clichéd gives a good insight. If you can find time. can u tell a bit more about your profile?? fresher?? On Tue, Mar 22, 2011 at 11:20 AM, guru peshwa.bal...@gmail.com wrote: Hi geeks, tomorrow i am having Amazon.com's Coding round followed by Interview...pls suggest some tips to help me out... -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- A.Balaji -- A.Balaji -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Coding Round
hey, dis is what i was told by a friend working @ amazon - Sometimes they do go to the level of the subject basics like OS or DS but you should be able to tackle these if you had studied well. No separate prep is needed. Few Favs DS Algos ( i should get treat for revealing this.;)... ) 1) All Trees (Binary for sure) 2) Graphs 3) Sorting Algos 4) Heaps Let us C ... though clichéd gives a good insight. If you can find time. can u tell a bit more about your profile?? fresher?? On Tue, Mar 22, 2011 at 11:20 AM, guru peshwa.bal...@gmail.com wrote: Hi geeks, tomorrow i am having Amazon.com's Coding round followed by Interview...pls suggest some tips to help me out... -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Coding Round
u r welcome :), nd all the best for ur test.btw, which clg?? On Tue, Mar 22, 2011 at 11:45 AM, guru peshwa.bal...@gmail.com wrote: Thank you very much for the info friendAnd sure will give u a treat :-) On Mar 22, 11:02 am, Akash Mukherjee akash...@gmail.com wrote: hey, dis is what i was told by a friend working @ amazon - Sometimes they do go to the level of the subject basics like OS or DS but you should be able to tackle these if you had studied well. No separate prep is needed. Few Favs DS Algos ( i should get treat for revealing this.;)... ) 1) All Trees (Binary for sure) 2) Graphs 3) Sorting Algos 4) Heaps Let us C ... though clichéd gives a good insight. If you can find time. can u tell a bit more about your profile?? fresher?? On Tue, Mar 22, 2011 at 11:20 AM, guru peshwa.bal...@gmail.com wrote: Hi geeks, tomorrow i am having Amazon.com's Coding round followed by Interview...pls suggest some tips to help me out... -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: chk dis out
@all : thank :) On Mon, Mar 21, 2011 at 5:45 PM, cegprakash cegprak...@gmail.com wrote: Anurag's method is better than saurabh's if u want to find the sum of digits from 1 to 1048 just apply Anurag's method from 1 to 1039 and saurabh's method from 1040 to 1048 -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] chk dis out
Majid is a 3rd-grade elementary student and quite well in mathematics. Once, Majid's teacher asked him to calculate the sum of numbers 1 through n. Majid quickly answered, and his teacher made him another challenge. He asked Majid to calculate the sum of the digits of numbers 1 through n. Majid did finally find the solution. Now it is your turn, can you find a solution? Input Two space-separated integers 0 = a = b = 109. Program terminates if a and b are -1. Output The sum of the digits of numbers a through b. Example *Input:* 1 10 100 777 -1 -1 *Output:* 46 8655 ne ideas?? -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] chk dis out
thanks, :) On Sun, Mar 20, 2011 at 8:21 PM, Anurag atri anu.anurag@gmail.comwrote: http://mathforum.org/library/drmath/view/57919.html check this out . On Sun, Mar 20, 2011 at 7:38 PM, Akash Mukherjee akash...@gmail.comwrote: Majid is a 3rd-grade elementary student and quite well in mathematics. Once, Majid's teacher asked him to calculate the sum of numbers 1 through n. Majid quickly answered, and his teacher made him another challenge. He asked Majid to calculate the sum of the digits of numbers 1 through n. Majid did finally find the solution. Now it is your turn, can you find a solution? Input Two space-separated integers 0 = a = b = 109. Program terminates if a and b are -1. Output The sum of the digits of numbers a through b. Example *Input:* 1 10 100 777 -1 -1 *Output:* 46 8655 ne ideas?? -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards Anurag Atri -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] [brain teaser ] 14march
shadow... Regards, Akash Agrawal http://tech-queries.blogspot.com/ On Mon, Mar 14, 2011 at 1:57 PM, Praveen praveen200...@gmail.com wrote: Wood On Mon, Mar 14, 2011 at 1:45 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote: * Riddle Problem Solution* ** * *The part of the bird that is not in the sky, which can swim in the ocean and always stay dry. *Update Your Answers at *: Click Herehttp://dailybrainteaser.blogspot.com/2011/03/14march.html Solution: Will be updated after 1 day -- Never explain yourself. Your friends don’t need it and your enemies won’t believe it . -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- B. Praveen -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] problem
hi, can anybody plzz look at this problem. i tried a recursive greedy approach but it was too slow i guess You have a truck that you need to completely fill up with merchandise. You have an infinite supply of merchandise of dimension 1x1x1, 2x2x2, 4x4x4, 8x8x8, 16x16x16, ..., 2k x 2k x 2k for all k ≥ 0. (Infinite supply of merchandise of each dimension too!) You wish to fill the truck of dimension AxBxC completely using only these merchandise. Given A, B C, what is the smallest number of merchandise you will need to fill the truck completely? The first line of the input will contain a number T (1 ≤ T ≤ 1000) containing the number of test cases. Each line that follows is a separate test case which has exactly 3 space separated integers A B C (1 ≤ A, B, C 106) which denotes the dimensions of the truck. Additionally, min(A,B,C) 1000. For each case, output a single line containing the minimum number of items needed to fill the entire truck. *Sample Input:* 5 1 1 1 1 2 3 3 4 5 4 5 6 123 12345 123456 *Sample Output:* 1 6 32 29 1951997538 -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] problem
Hi, I need some help. I am still a nube so if this is too easy, plz don't flame. I cannot understand how to approach the problem. Would appreciate any help. At CodeChef, The Chef can make 10 types of dishes numbered 0 through 9. He can however only make dishes one after another. Suppose The Chef made dishes 1, 4, 2, 1, 2, 1 on a given day, the number configuration that day would be 142121. On a given day, he makes any number of dishes as long as: 1. The number configuration for that day is greater than zero(0) and less than or equal to 'N'. 2. Dish 3 is never made *after* dish 1 has been made. 3. Dish 0 is never the first dish of the day, to be prepared. How many such unique number configurations exist for a given 'N'? Examples: - 1 is a valid configuration - 52 is a valid configuration - 12 is a valid configuration - 32 is a valid configuration - 321 is a valid configuration - 3231 is a valid configuration - 120 is a valid configuration - 012 is not a valid configuration - 123 is not a valid configuration - 32123 is not a valid configuration The first line of the input will contain a number T (1 ≤ T ≤ 1000) containing the number of test cases. Each line that follows is a separate test case which has exactly 1 integer 'N' (1 ≤ N 1018). For each case, output a single line containing the number of configurations possible for that 'N'. *Sample Input:* 5 10 15 115 1113 123456789 *Sample Output:* 10 14 112 1064 92470733 Thanks Akash -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Maximize the Time to see TV
U can always have a trackback array as we do in LIS. Regards, Akash Agrawal http://tech-queries.blogspot.com/ On Fri, Mar 4, 2011 at 5:48 PM, Vipin Agrawal vipin.iitr@gmail.comwrote: Solution is good, but its says only Max time that he can spend. How would he know that which program he should watch for Maximum utilization ? On Mar 4, 4:38 pm, Akash Agrawal akash.agrawa...@gmail.com wrote: http://tech-queries.blogspot.com/2011/03/avid-tv-watcher.html Regards, Akash Agrawalhttp://tech-queries.blogspot.com/ On Fri, Mar 4, 2011 at 2:25 PM, Akash Agrawal akash.agrawa...@gmail.com wrote: Example: Channel 1: Program id P1 P2 P3 Start time 8:00 9:00 10:30 End time 8:30 10:00 11:30 Channel 2: Program id P4 P5 P6 Start time 8:15 9:30 10:45 End time 9:15 10:15 11:15 Sort all programs based on their end time: Cnt 0 0 0 0 0 0 Pr id P1 P4 P2 P5 P6 P3 St time 8:00 8:15 9:00 9:30 10:45 10:30 End time 8:30 9:15 10:00 10:15 11:30 11:30 1st Iteration: Cnt 00:30 0 0 0 0 0 Pr id P1 P4 P2 P5 P6 P3 St time 8:00 8:15 9:00 9:30 10:45 10:30 End time 8:30 9:15 10:00 10:15 11:30 11:30 2nd Iteration: Cnt 00:30 01:00 0 0 0 0 Pr id P1 P4 P2 P5 P6 P3 St time 8:00 8:15 9:00 9:30 10:45 10:30 End time 8:30 9:15 10:00 10:15 11:30 11:30 3rd Iteration: Cnt 00:30 01:00 01:30 0 0 0 Pr id P1 P4 P2 P5 P6 P3 St time 8:00 8:15 9:00 9:30 10:45 10:30 End time 8:30 9:15 10:00 10:15 11:30 11:30 4th Iteration: Cnt 00:30 01:00 01:30 01:45 0 0 Pr id P1 P4 P2 P5 P6 P3 St time 8:00 8:15 9:00 9:30 10:45 10:30 End time 8:30 9:15 10:00 10:15 11:30 11:30 5th Iteration: Cnt 00:30 01:00 01:30 01:45 02:30 0 Pr id P1 P4 P2 P5 P6 P3 St time 8:00 8:15 9:00 9:30 10:45 10:30 End time 8:30 9:15 10:00 10:15 11:30 11:30 6th Iteration: Cnt 00:30 01:00 01:30 01:45 02:30 02:45 Pr id P1 P4 P2 P5 P6 P3 St time 8:00 8:15 9:00 9:30 10:45 10:30 End time 8:30 9:15 10:00 10:15 11:30 11:30 Answer will be 2:45 hrs as this is the biggest value in Cnt. Regards, Akash Agrawal http://tech-queries.blogspot.com/ On Fri, Mar 4, 2011 at 2:17 PM, Akash Agrawal akash.agrawa...@gmail.comwrote: Seems, it didn't preserve indentation. attached file. Regards, Akash Agrawal http://tech-queries.blogspot.com/ On Fri, Mar 4, 2011 at 2:16 PM, Akash Agrawal akash.agrawa...@gmail.comwrote: First try urself with thinking longest common subsequence if u r still not able to see below algo. I will write a blog post soon for the same. Funda is to see what is the max time I can spend on TV if I watch program X. 1. Merge all the programs of diff channels in sorted order of their end-time in prog[] array. (need O(nlogk)) 2. n ← length(prog) - 1 3. for i ← 1 to n a. do prog[i].cnt ← 0 b. max ← 0 c. j ← 0 d. while prog[j].end prog[i].start i. if max prog[j].cnt 1. do max ← proj[j].cnt ii. j ← j + 1 e. do prog[i].cnt ← max + prog[i].end – prog[i].start 4. do res ← 0 5. for i ← 1 to n a. if res prog[i].cnt i. do res ←prog[i].cnt 6. return res PS: Hope it saved indentation. Regards, Akash Agrawal http://tech-queries.blogspot.com/ On Tue, Feb 1, 2011 at 2:46 PM, Vikas Kumar dev.vika...@gmail.com wrote: @Snehal just a hint: there is no need of that channel 1 channel 2. just treat each program as independent program. On Mon, Jan 31, 2011 at 10:44 PM, snehal jain learner@gmail.comwrote: or provide some link On Mon, Jan 31, 2011 at 10:44 PM, snehal jain learner@gmail.comwrote: @ juver++ can you please share
Re: [algogeeks] Search element in 2D row-wise colum-wise sorted matrix
hi, i implemented something i called bin2d, here's the pseudo code : int binSearch2D(int key, int p, int q) //here we are using binary search on the first row if(p == q) if (a[0][p] == key) i = 0; j = p; int mid_row = (p + q) / 2; if (a[0][mid_row] == key) i = 0; j = mid_row; else if(a[0][mid_row] key) binSearch2D(key, p, mid_row-1); // we check out the earlier row elements only, no need to check elements of the column else binSearch2D(key, mid_row+1, q); // here we are then check the elements of the column using binary search for(int lower = 0, upper = 3; lower = upper;) mid_col = (lower + upper) / 2; if(a[mid_col][mid_row] == key) i = mid_col; j = mid_row; return else if(a[mid_col][mid_row] key) lower = mid_col + 1; else upper = mid_col - 1; Since i am nube, i'd appreciate your +/- feedback thanks, Akash On Sun, Feb 27, 2011 at 3:32 PM, gaurav gupta 1989.gau...@googlemail.comwrote: A 2D matrix is given which is sorted row-wise and column-wise in ascending order. Search a given element in minimum possible time. like matrix is : 1 2 3 4 6 9 12 15 7 13 16 19 20 21 22 26 and you have to search for 7. Please don't provide codes, algorithm or pseudo code will be really great. -- Thanks Regards, Gaurav Gupta Quality is never an accident. It is always result of intelligent effort - John Ruskin -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: SPOJ PROBLEM
hi, i have a slightly different but related probelm, i am trying to implement djiktra's in c++ how should i deal with the infinity weights( i mean does c++ have infinity)? thanx in advance :) On Fri, Feb 18, 2011 at 10:16 PM, Balaji S balaji.ceg...@gmail.com wrote: just output..unicode of infinity.. :) -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: SPOJ PROBLEM
@jhosimar : LONG_MAX ain't working :( , LONG_MAX + 1 returns a new number ne ideas?? thanx again On Sat, Feb 19, 2011 at 9:36 AM, Jhosimar Arias jarias...@gmail.com wrote: Infinity in c++ you can use this - std::cout std::numeric_limitsdouble::infinity ()endl; But for dijkstra you can represent infinity by a long value like INT_MAX or LONG_MAX, not necesarily infinity. 2011/2/18 Akash Mukherjee akash...@gmail.com hi, i have a slightly different but related probelm, i am trying to implement djiktra's in c++ how should i deal with the infinity weights( i mean does c++ have infinity)? thanx in advance :) On Fri, Feb 18, 2011 at 10:16 PM, Balaji S balaji.ceg...@gmail.comwrote: just output..unicode of infinity.. :) -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en. -- 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 this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: DP Problem: minimum Cost
Hi, Can u please explain. I couldn't get what do u mean by after processing K bundles? I wrote following code (which is inefficient) which is goving correct result for 140. But how to get the value 1400. #includeiostream using namespace std; //#define MAX 0x7FFF int main() { int weight[] = {8, 20, 70, 130}; int cost[] = {1025, 325, 475, 1050}; int ans[10]; for (int i=1; i 1; i++) ans[i] = 21474836; ans[0] = 0; int i; cout ans[1250] endl; for (i=1; i10; i++) { for (int j=0; j4; j++) { if((i-weight[j]) = 0) { int cos = ans[i-weight[j]] + cost[j]; if (cos ans[i]) { ans[i] = cos; // cout ans[i]iendl; } } } if (i=140 ans[i] INT_MAX) break; } cout ans[i] i endl; return 0; } Regards, Akash Agrawal http://tech-queries.blogspot.com/ On Thu, Dec 30, 2010 at 6:03 PM, juver++ avpostni...@gmail.com wrote: DP[K][N] - minimal cost choosing N balls and after processing K bundles. -- 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+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Strings search problem
http://tech-queries.blogspot.com/2010/12/finding-minimum-window-in-array-which.html just use words in place of chars... Regards, Akash Agrawal http://tech-queries.blogspot.com/ On Fri, Dec 31, 2010 at 11:00 AM, Davin dkthar...@googlemail.com wrote: Find the area with less distance between words. Distance is measured words count in between two words. On Dec 30, 4:08 pm, 周翔 csepark...@gmail.com wrote: Distance is measured on number of words. what is your meaning ? can you explain it? 2010/12/29 Davin dkthar...@googlemail.com Given set of words, find an area of the text where these words are as close to each other as possible. Distance is measured on number of words. e.g. for words [rat”, “jat”, “pat”] and text “rat stop the pat blah blah jat by pat jat tra la la” such area is “cat by mat bat” -- 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+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com algogeeks%2bunsubscr...@googlegroups .com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] DP Problem: minimum Cost
You have different bundles of balls, which have different number of balls and different price tags. You have unlimited supplies of each of these bundles. Now if I want to get x number of balls, how should I choose bundles which cost me minimum. I am just looking for cost to be minimum, doesn't matter if I get more balls than x. But number of balls should not be less than x. Example: Bundle 1 Cost: 1050 no of balls: 130 Bundle 2 Cost: 475 no of balls: 70 Bundle 3 Cost: 325 no of balls: 20 Bundle 4 Cost: 1025 no of balls: 8 So if I want 125 balls, I will choose 2 packets of 70 balls each to minimize cost. Regards, Akash Agrawal http://tech-queries.blogspot.com/ -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Pythagorean triples
http://tech-queries.blogspot.com/2010/12/find-pythagorean-triples-in-unsorted.html Regards, Akash Agrawal http://tech-queries.blogspot.com/ On Mon, Dec 20, 2010 at 8:12 PM, Dave dave_and_da...@juno.com wrote: Unless sorting the array is forbidden, sort it and then use the obvious O(n^2) algorithm. This can be done with only O(1) extra space. If O(n) extra space is available, either use it to copy and sort the original array, or use it as a hash table, again achieving O(n^2) in either case. If sorting is forbidden and using extra space is forbidden, then I doubt that any algorithm less than O(n^3) exists. Dave On Dec 20, 4:41 am, bittu shashank7andr...@gmail.com wrote: can we find Pythagorean triples in an unsorted array in write program so that have minimum time complexity. regards Shashank -- 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+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Amazon Question
2D matrix sum is a simple DP problem, but U need n*n extra space as well or have to change the i/p. (u can get the i/p back once if required) If this is acceptable, let me explain. Regards, Akash Agrawal http://tech-queries.blogspot.com/ On Sun, Dec 19, 2010 at 7:01 PM, juver++ avpostni...@gmail.com wrote: There is a linear solution in terms of the matrix's size. So in a whole it has O(n^2) time complexity. -- 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+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] DP problem
Hey Amir, Can u please throw some more light on this. I am not able to find a good solution for subset sum problem as well. Regards, Akash Agrawal http://tech-queries.blogspot.com/ On Fri, Dec 17, 2010 at 7:29 PM, Amir hossein Shahriari amir.hossein.shahri...@gmail.com wrote: sort jewelries in decreasing order and then the problem can be solved in a way similar to subset sum problem On Mon, Dec 13, 2010 at 7:40 PM, Akash Agrawal akash.agrawa...@gmail.comwrote: You have been given a list of jewelry items that must be split amongst two people: Frank and Bob. Frank likes very expensive jewelry. Bob doesn't care how expensive the jewelry is, as long as he gets a lot of jewelry. Based on these criteria you have devised the following policy: 1) Each piece of jewelry given to Frank must be valued greater than or equal to each piece of jewelry given to Bob. In other words, Frank's least expensive piece of jewelry must be valued greater than or equal to Bob's most expensive piece of jewelry. 2) The total value of the jewelry given to Frank must exactly equal the total value of the jewelry given to Bob. 3) There can be pieces of jewelry given to neither Bob nor Frank. 4) Frank and Bob must each get at least 1 piece of jewelry. Given the value of each piece, you will determine the number of different ways you can allocate the jewelry to Bob and Frank following the above policy. For example: values = {1,2,5,3,4,5} Valid allocations are: BobFrank 1,2 3 1,3 4 1,4 5 (first 5) 1,4 5 (second 5) 2,3 5 (first 5) 2,3 5 (second 5)5 (first 5) 5 (second 5) 5 (second 5) 5 (first 5) 1,2,3,45,5Note that each '5' is a different piece of jewelry and needs to be accounted for separately. There are 9 legal ways of allocating the jewelry to Bob and Frank given the policy, so your method would return 9. Regards, Akash Agrawal http://tech-queries.blogspot.com/ -- 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+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] DP problem
You have been given a list of jewelry items that must be split amongst two people: Frank and Bob. Frank likes very expensive jewelry. Bob doesn't care how expensive the jewelry is, as long as he gets a lot of jewelry. Based on these criteria you have devised the following policy: 1) Each piece of jewelry given to Frank must be valued greater than or equal to each piece of jewelry given to Bob. In other words, Frank's least expensive piece of jewelry must be valued greater than or equal to Bob's most expensive piece of jewelry. 2) The total value of the jewelry given to Frank must exactly equal the total value of the jewelry given to Bob. 3) There can be pieces of jewelry given to neither Bob nor Frank. 4) Frank and Bob must each get at least 1 piece of jewelry. Given the value of each piece, you will determine the number of different ways you can allocate the jewelry to Bob and Frank following the above policy. For example: values = {1,2,5,3,4,5} Valid allocations are: BobFrank 1,2 3 1,3 4 1,4 5 (first 5) 1,4 5 (second 5) 2,3 5 (first 5) 2,3 5 (second 5)5 (first 5) 5 (second 5) 5 (second 5) 5 (first 5) 1,2,3,4 5,5Note that each '5' is a different piece of jewelry and needs to be accounted for separately. There are 9 legal ways of allocating the jewelry to Bob andFrank given the policy, so your method would return 9. Regards, Akash Agrawal http://tech-queries.blogspot.com/ -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] file handling
use FILE * Can u elaborate on the probelm? Regards, Akash Agrawal http://tech-queries.blogspot.com/ On Mon, Dec 13, 2010 at 1:03 PM, neeraj agarwal itsneerajagar...@gmail.comwrote: i am facing problem in file handling in C can any one suggest me how to implement them. -- 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+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Google questions
It is like finding the in order successor. See it here (using parent pointer) http://tech-queries.blogspot.com/2010/04/inorder-succesor-in-binary-tree.html w/0 Parent pointer: http://tech-queries.blogspot.com/2010/04/inorder-succesor-in-binary-tree-wo.html Regards, Akash Agrawal http://tech-queries.blogspot.com/ On Thu, Dec 9, 2010 at 11:33 PM, GOBIND KUMAR gobind@gmail.com wrote: Code for question no.--2 #includestdio.h #includeconio.h #includetime.h struct test{ clock_t endwait; void (*print_ptr)(); }; void print() {printf(\nHello World\n);} void wait ( int seconds ) { struct test *g=(struct test *)malloc(sizeof(struct test)); g-endwait= clock () + seconds * CLOCKS_PER_SEC ; while (clock() g-endwait) {} (g-print_ptr)=print; (*(g-print_ptr))(); } int main(){ int sec; printf(Enter the time after which you want output:); scanf(%d,sec); wait(sec); getch(); return; } -- 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+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] matrix sum
You have given a matrix of n*m integer. A query will come to you with two co-ordinate (x1,y1) (x2,y2). You need to find sum of all elements which falls inside rectangle. As you will be bombarded with such query, you solution should be very very quick. Ans should be in O(1) Regards, Akash Agrawal http://tech-queries.blogspot.com/ -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] find triplets in an integer array A[] which satisfy condition: a[i]^2 + a[j]^2 = a[k]^2
Thanks everyone; that O(n^2) is an awesome solution. Regards, Akash Agrawal http://tech-queries.blogspot.com/ On Thu, Dec 2, 2010 at 12:21 PM, fenghuang fenghaungyuyi...@gmail.comwrote: @anoop when you find some i and j(i j) meet the condition i.e. asq[i] + asq[j] == asq[k], you can merge the same value without rollback. in this sense, you are right. On Thu, Dec 2, 2010 at 2:26 PM, anoop chaurasiya anoopchaurasi...@gmail.com wrote: @fenghuang try this array: a[]={3,3,3,3,3,3,4,4,4,4,4,4,5} so asq[]={9,9,9,9,9,9,16,16,16,16,16,16,25} here as u can see the total number of requisite triple pairs are 6*6=36, in general for above array total number of pairs is (n/2)*(n/2) i.e. n^2/4 where n is the size of the array. by using O(n) algo and since you are choosing them one by one,u can't include all of them as they are of order O(n^2). so removing repetitions is the only option i think.. On Wed, Dec 1, 2010 at 11:37 PM, fenghuang fenghaungyuyi...@gmail.comwrote: @anoop in fact, it always work even if there are repeated elements, because they don't change the decision. in detail, assume ii, ,jj, kk is one of the answers, then a[ii]+a[jj]=a[kk]. since the array is sorted, so a[ii-1]+a[jj] = a[kk] and a[ii] + a[jj+1] = a[kk]. so when you try the pair of 'ii-1' and 'jj', the next step must be calculate a[ii] + a[jj] as long as a[ii-1]+a[jj] is not equal to a[kk]. the same to the pair 'ii' and 'jj+1'. the algorithm is correct and in the whole procedure, repeated elements don't affect the decision. I'm sorry for my poor English. Thank You! On Thu, Dec 2, 2010 at 12:14 PM, anoop chaurasiya anoopchaurasi...@gmail.com wrote: sorry for the interruption,we can make it work even if the elements are repeated, by removing the duplicacy in linear time(as the array is already sorted) and taking a count of no. of duplicates in the seperate array. On Wed, Dec 1, 2010 at 9:37 PM, Senthilnathan Maadasamy senthilnathan.maadas...@gmail.com wrote: A small correction to the algorithm above. In Step 3, instead of finding *any* pair (a,b) such that a+b = x we need to find *all* such pairs. However the complexity remains the same. -- 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+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Anoop Chaurasiya CSE (2008-2012) NIT DGP -- 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+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Anoop Chaurasiya CSE (2008-2012) NIT DGP -- 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+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] DeShaw Question....tough One
Ashim, looks good :) nice work On Mon, Sep 6, 2010 at 4:44 PM, Ashim Kapoor ashimkap...@gmail.com wrote: int a[]={11,9,8,2,10,7,3,4,5} max_length = 1 ; current_length = 1; first_position=0 ; last_position = 0 ; first_position_max=0; // Sweep one to find the length of the longest subsequence. for ( i = 1 ; i n ; i++ ) { if ( a[i] a[i-1] ) { last_position=i-1; current_length=last_position- first_position+1; max_length = current_length max_length ? current_length : max_length; first_position_max = current_length max_length ? first_position : first_position_max; first_position= i; } } // Sweep two to print the longest subsequence. for ( i = first_position ; i max_length ; i ++ ) { cout a[i]; } On Mon, Sep 6, 2010 at 2:01 PM, bittu shashank7andr...@gmail.com wrote: u are given an array and u have to print the longest increasing scattered subsequence...eg..{11,9,8,2,10,7,3,4,5}. Solve it 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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- --- Akash \m/ -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] random clicks
A website has n questions. If you're shown one random question per click, prove that it takes O(n log n) clicks on avg to see all questions. How should I approach this problem. This sounds easy but till now I am not able to get any headway. Any help is appreciated. Thanks. -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] array
Hi Amir On Fri, Jul 2, 2010 at 10:13 PM, Amir hossein Shahriari amir.hossein.shahri...@gmail.com wrote: both problems can be done in O(n) pick the first two elements count the number of their appearances in the array ( O(n) ) if they are not the result we now that there is an element that is repeated n times in 2n-1 elements and we can do the moore's algorithm for finding it here's a link to this algorithm: userweb.cs.utexas.edu/~moore/best-ideas/mjrty/index.html I didnt understand the algo correctly what is the sequence is C C C C C A A B B A B now the last current candidate is B 1 but B is certainly not in majority. Can you please explain that to me? -- 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+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Best Regards Akash Gangil -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] array
On Fri, Jul 2, 2010 at 3:41 PM, jalaj jaiswal jalaj.jaiswa...@gmail.comwrote: make a bst of all numbers (nlogn) include a count in the structure..as soon as the count become n return the data of that node Can you please tell me why you chose a bst, simply traversing the array and incrementing the count would have also worked in this case and it would have been O(n). On Thu, Jul 1, 2010 at 10:13 PM, sharad sharad20073...@gmail.com wrote: 1.an array of 2n+1 elements is given .one element is repeated n times and rest all are different.find the no repeated. 2.same question as above but this time other no's are not different ..i.e they can repeat. -- 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+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- With Regards, Jalaj Jaiswal +919026283397 B.TECH IT IIIT ALLAHABAD -- 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+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Best Regards Akash Gangil -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Invitation to connect on LinkedIn
LinkedIn Akash Mankar requested to add you as a connection on LinkedIn: -- Phani, I'd like to add you to my professional network on LinkedIn. - Akash Accept invitation from Akash Mankar http://www.linkedin.com/e/snzJYTL1ELzmJnD4gKz4JCvPSMMdJnhesLKjdXOq/blk/I1728792019_2/pmpxnSRJrSdvj4R5fnhv9ClRsDgZp6lQs6lzoQ5AomZIpn8_cBYVcj0OejsUczsNiiZDlmYMoQdbtiYVcPoOcjARejALrCBxbOYWrSlI/EML_comm_afe/ View invitation from Akash Mankar http://www.linkedin.com/e/snzJYTL1ELzmJnD4gKz4JCvPSMMdJnhesLKjdXOq/blk/I1728792019_2/39vej4MczATe38TckALqnpPbOYWrSlI/svi/ -- Why might connecting with Akash Mankar be a good idea? Akash Mankar's connections could be useful to you: After accepting Akash Mankar's invitation, check Akash Mankar's connections to see who else you may know and who you might want an introduction to. Building these connections can create opportunities in the future. -- (c) 2010, LinkedIn Corporation -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: data structure for median
can v use AVL trees for this/? On Sun, Jul 6, 2008 at 1:16 PM, Balachander [EMAIL PROTECTED] wrote: How Do u basically find the Median of BST in place ? Are u trying to find the median just by traversing once ? / Bala --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/algogeeks -~--~~~~--~~--~--~---