[algogeeks] books

2011-04-21 Thread kamlesh yadav
can anyone give me list of books like ( cracking the coding interview ) for placement preparation thanks in advance. -- 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

Re: [algogeeks] Re: Reading Huge input from the terminal in least time.

2011-04-21 Thread Mayur
If you're working on Linux then there's asynchronous I/O functions that do well.. http://www.gnu.org/s/libc/manual/html_node/Asynchronous-I_002fO.html#Asynchronous-I_002fO http://www.gnu.org/s/libc/manual/html_node/Asynchronous-I_002fO.html#Asynchronous-I_002fOWindows might have similar

[algogeeks] [brain teaser] Pirate Puzzle 21april

2011-04-21 Thread Lavesh Rawat
* Pirate Puzzle 5 pirates of different ages have a treasure of 100 gold coins. On their ship, they decide to split the coins using this scheme: The oldest pirate proposes how to share the coins, and all pirates remaining will vote for or against it. If 50% or more of the pirates vote for it,

Re: [algogeeks] books

2011-04-21 Thread LALIT SHARMA
Please mail me 2 , my id is lks.ru...@gmail.com thnX in Advance .. On Thu, Apr 21, 2011 at 12:45 PM, kamlesh yadav kamleshlu2...@gmail.com wrote: can anyone give me  list of books  like ( cracking the coding interview )  for placement preparation thanks in advance. -- You received this

[algogeeks] Implementing a BTree

2011-04-21 Thread Praveen Kumar
Hi, I have to implement BTree and B+ Tree as part of a project. But, I am finding it difficult to do that. Can anyone share his/her code if one has implemented it or share resources where I can find the implementation? Praveen -- You received this message because you are subscribed to the

Re: [algogeeks] [brain teaser] Pirate Puzzle 21april

2011-04-21 Thread Anders Ma
the coins will be shared the way the oldest pirate proposes. On Thu, Apr 21, 2011 at 3:51 PM, Lavesh Rawat lavesh.ra...@gmail.com wrote: Pirate Puzzle 5 pirates of different ages have a treasure of 100 gold coins. On their ship, they decide to split the coins using this scheme: The oldest

Re: [algogeeks] [brain teaser] Pirate Puzzle 21april

2011-04-21 Thread harshit agrawal
thwy will be shared according to senior most pirate(5th)=98 4th =0 3rd =1 2nd=0 1st =1 On Thu, Apr 21, 2011 at 2:54 PM, Anders Ma xuejiao...@gmail.com wrote: the coins will be shared the way the oldest pirate proposes. On Thu, Apr 21, 2011 at 3:51 PM, Lavesh Rawat lavesh.ra...@gmail.com

Re: [algogeeks] [brain teaser] Pirate Puzzle 21april

2011-04-21 Thread vaibhav agrawal
Why the two pirates would agree when they are getting only one coins each? On Thu, Apr 21, 2011 at 3:05 PM, harshit agrawal hagrawal.250...@gmail.comwrote: thwy will be shared according to senior most pirate(5th)=98 4th =0 3rd =1 2nd=0 1st =1 On Thu, Apr 21, 2011 at 2:54 PM, Anders Ma

Re: [algogeeks] [brain teaser] Pirate Puzzle 21april

2011-04-21 Thread durgaprasad k
@vaibhav : if they dont agree for 1 gold icon they will be thrown out. so they will accept the 1 gold coin to stay on . On Thu, Apr 21, 2011 at 3:10 PM, vaibhav agrawal agrvaib...@gmail.comwrote: Why the two pirates would agree when they are getting only one coins each? On Thu, Apr 21,

Re: [algogeeks] [brain teaser] Pirate Puzzle 21april

2011-04-21 Thread vaibhav agrawal
They can still disagree and the pirate would be thrown out as the puzzle states On Thu, Apr 21, 2011 at 3:21 PM, durgaprasad k durga...@gmail.com wrote: @vaibhav : if they dont agree for 1 gold icon they will be thrown out. so they will accept the 1 gold coin to stay on . On Thu, Apr

Re: [algogeeks] [brain teaser] Pirate Puzzle 21april

2011-04-21 Thread Kunal Yadav
So the explanation is:- Lets say,, there were only 2. Then the top guy does not need any vote. He will keep all 100. But the bottom guy can see this. So when 3 people were alive, he will support the 3rd guy. The third guy is greedy and he will keep 99 and give 1 to bottom guy. Bottom fellow will

Re: [algogeeks] [brain teaser] Pirate Puzzle 21april

2011-04-21 Thread Shuaib
Not necessarily. Whatever the senior pirate proposes will have to be accepted by pirate 4th and 2nd (assuming 5th is senior most) otherwise pirate 1st gets everything. So it is oldest pirate's call. He can I guess take it all. Shuaib http://twitter.com/ShuaibKhan http://www.bytehood.com/ On

[algogeeks] Re: finding n numbers having particular sum

2011-04-21 Thread AmitMIST
Thanx @DON, was looking for it for a bit of time... I myself wrote some piece of code though urs is the better one On Apr 19, 10:21 am, Don dondod...@gmail.com wrote: Here is the program with better documentation and a fix for the case when sum is zero. // Number of elements to select

[algogeeks]

2011-04-21 Thread riti gupta
is there any error in following code? main { char *p=hello; p[0]='j'; p[1]='j'; puts(p); } -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send

Re: [algogeeks]

2011-04-21 Thread rahul
will crash... :) On Thu, Apr 21, 2011 at 4:14 PM, riti gupta ritigupt...@gmail.com wrote: is there any error in following code? main { char *p=hello; p[0]='j'; p[1]='j'; puts(p); } -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group.

Re: [algogeeks]

2011-04-21 Thread riti gupta
why?can u please explain? On Thu, Apr 21, 2011 at 4:15 PM, rahul rahulr...@gmail.com wrote: will crash... :) On Thu, Apr 21, 2011 at 4:14 PM, riti gupta ritigupt...@gmail.com wrote: is there any error in following code? main { char *p=hello; p[0]='j'; p[1]='j'; puts(p); } --

Re: [algogeeks]

2011-04-21 Thread Anders Ma
the segment which stores hello may be read only, so writing to it may cause unexpected result. On Thu, Apr 21, 2011 at 6:45 PM, rahul rahulr...@gmail.com wrote: will crash... :) On Thu, Apr 21, 2011 at 4:14 PM, riti gupta ritigupt...@gmail.com wrote: is there any error in following code?

RE: [algogeeks]

2011-04-21 Thread Keybo13
' Hello ' is a literal.. Its allotted memory and a reference is made to 'p' you can not alter value like this... Regards, Keybo -Original message- From: riti gupta Sent: 21/04/2011, 4:14 pm To: algogeeks@googlegroups.com Subject: [algogeeks] is there any error in following code?

Re: [algogeeks]

2011-04-21 Thread rahul
char * is pointer to constant data...here...that's y it would crash...dear.. do somedebugging On Thu, Apr 21, 2011 at 4:16 PM, riti gupta ritigupt...@gmail.com wrote: why?can u please explain? On Thu, Apr 21, 2011 at 4:15 PM, rahul rahulr...@gmail.com wrote: will crash... :) On Thu,

Re: [algogeeks]

2011-04-21 Thread Sudhir mishra
yes there is error; first allocate memory for p; On Thu, Apr 21, 2011 at 6:44 AM, riti gupta ritigupt...@gmail.com wrote: is there any error in following code? main { char *p=hello; p[0]='j'; p[1]='j'; puts(p); } -- You received this message because you are subscribed to the Google

Re: [algogeeks]

2011-04-21 Thread riti gupta
Than y r we able to do the following main() { char *p=hello; p=bye; } On Thu, Apr 21, 2011 at 4:21 PM, Sudhir mishra sudhir08.mis...@gmail.comwrote: yes there is error; first allocate memory for p; On Thu, Apr 21, 2011 at 6:44 AM, riti gupta ritigupt...@gmail.com wrote: is there any

Re: [algogeeks]

2011-04-21 Thread amit singh
yes p points to the base adress of constant string hello so you cannot change this string . On Thu, Apr 21, 2011 at 4:14 PM, riti gupta ritigupt...@gmail.com wrote: is there any error in following code? main { char *p=hello; p[0]='j'; p[1]='j'; puts(p); } -- You received this

Re: [algogeeks] [brain teaser] Pirate Puzzle 21april

2011-04-21 Thread vaibhav shukla
lets consider if there were only 1 pirate. obviously he would take it all for himself and no one would complain. if there were 2 pirates, pirate 2 being the most senior, he would just vote for himself and that would be 50% of the vote, so he’s obviously going to keep all the money for himself.

[algogeeks] Problem; print the largest subset of negative number in array of integers

2011-04-21 Thread hary rathor
Problem; print the largest subset of negative number in array of integers i have code it in following way which is give solution in O(n) and and required memory in O(n) any tell me other method better then this O(n) . pls tell me is it any bug in the code #includestdio.h int

Re: [algogeeks]

2011-04-21 Thread hary rathor
main() { char *p=(char *)hello; p[0]='j'; p[1]='j'; puts(p); return 0; } will run currectlly but u can not change contain of literal because of its type is (const char *) . -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this

Re: [algogeeks]

2011-04-21 Thread Charles Turner
On 21/04/2011 11:55, riti gupta wrote: Than y r we able to do the following main() { char *p=hello; p=bye; } Because you're changing the binding of p, not the value (which is immutable, as explained already). -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks]

2011-04-21 Thread Kunal Patil
@Hary rathor: Your program also crash on my Dev-Cpp (Version 4.9.9.2)..Make sure whether it runs on your PC !! I don't know whether Literal can be type-casted... -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email

Re: [algogeeks]

2011-04-21 Thread hary rathor
#includestdio.h #includeconio.h int count=0,ind=-1,len,i=0; void largestNegSubset(int arr[]) { if(ilen) return ; int t=0; while(arr[i++]0i=len)t++; if(tcount){count=t;ind=i-1;} largestNegSubset(arr); } int main() { int arr[]={1,0,1,-6,-7,-2,-2,4,-3,-5,-6,7,-8,-9};

Re: [algogeeks]

2011-04-21 Thread hary rathor
@ kunal: above code is not for you i have run this on http://codepad.org/TiOQBKU8 check it then tell me -- 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

[algogeeks] CKY parse tree algorithm

2011-04-21 Thread sandeeparapindi
Hello, In the CKY algorithm for PCFGs and finding the most probable parse tree, when exactly can it fail to parse? I didn't think it could but I was informed that I'm mistaken. Thanks, Richard -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group.

Re: [algogeeks]

2011-04-21 Thread Rujin Cao
@riti: You can change *char *p=hello;* to *char p[] = hello;* then everything should be fine. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send

Re: [algogeeks] books

2011-04-21 Thread Rujin Cao
FYI. Someone is starting to translate the Chinese version in http://pro.yeeyan.org/CRACKINGTHECODINGINTERVIEW 2011/4/21 LALIT SHARMA lks.ru...@gmail.com Please mail me 2 , my id is lks.ru...@gmail.com thnX in Advance .. On Thu, Apr 21, 2011 at 12:45 PM, kamlesh yadav

[algogeeks] Fwd: Fw: Building a Binary tree with XOR

2011-04-21 Thread ravi maggon
Plz help out the with the below mentioned problem (Query by Someone else, i was not able to understand) Building a Binary tree with XOR Hi All, Before starting any binary tree problem I will be creating such kind of binary tree and will be solving that problem accordingly. From the last few

Re: [algogeeks] Problem; print the largest subset of negative number in array of integers

2011-04-21 Thread Rujin Cao
I think O(n) is the best time complexity. Try to think about one sequence with all negative numbers or positive numbers. we can't get the full information without one time iteration, or we can just say the data reading time will cost O(n). 2011/4/21 hary rathor harry.rat...@gmail.com Problem;

[algogeeks] A Global MBA Experience

2011-04-21 Thread Geo News
*A Global MBA Experience Latin America – Europe - Asia. Top ranked MBA http://bit.ly/AsianEdu http://bit.ly/AsianEdu -- * If you would like to get daily pictures We've started a Google Group to allow our visitors to get daily funny and Crazy Pictures , You can join this group for free , go

Re: [algogeeks] books

2011-04-21 Thread Manish Pathak
Thank you On Thu, Apr 21, 2011 at 8:50 PM, Rujin Cao drizzle...@gmail.com wrote: FYI. Someone is starting to translate the Chinese version in http://pro.yeeyan.org/CRACKINGTHECODINGINTERVIEW 2011/4/21 LALIT SHARMA lks.ru...@gmail.com Please mail me 2 , my id is lks.ru...@gmail.com

Re: [algogeeks] [brain teaser] Pirate Puzzle 21april

2011-04-21 Thread Shuaib
I think the original statement says that The oldest pirate proposes how to share the coins, and all pirates remaining will vote for or against it. So the pirate proposing the distribution can't vote for himself. -- Shuaib http://twitter.com/ShuaibKhan http://bytehood.com/ On Thursday, April

Re: [algogeeks] [brain teaser] Pirate Puzzle 21april

2011-04-21 Thread vaibhav shukla
nopesdats not the point.in every election one can vote for himself also On Thu, Apr 21, 2011 at 11:12 PM, Shuaib aries.shu...@gmail.com wrote: I think the original statement says that * The oldest pirate proposes how to share the coins, and all pirates remaining will vote for or

[algogeeks] Ebooks Sites

2011-04-21 Thread KK
Hello people please share sites from where good programming ebooks can be downloaded... i use library.nu and 4shared.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

[algogeeks] Flipping Coins

2011-04-21 Thread KK
Pls have a look at this Question on codechef http://www.codechef.com/problems/FLIPCOIN/ i tried this using Segment tree... i implemented segment updating properly but dont know how to do segment Querying in this particular Question although point Querying is easy.. and please suggest links and

[algogeeks]

2011-04-21 Thread mihir kulkarni
http://huggallart.com/surprise11.html -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For

Re: [algogeeks] Ebooks Sites

2011-04-21 Thread D.N.Vishwakarma@IITR
www.etwist.net On Fri, Apr 22, 2011 at 12:53 AM, KK kunalkapadi...@gmail.com wrote: Hello people please share sites from where good programming ebooks can be downloaded... i use library.nu and 4shared.com -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] [brain teaser] Pirate Puzzle 21april

2011-04-21 Thread Anders Ma
excellent analysis! On Thu, Apr 21, 2011 at 7:43 PM, vaibhav shukla vaibhav200...@gmail.com wrote: lets consider if there were only 1 pirate. obviously he would take it all for himself and no one would complain. if there were 2 pirates, pirate 2 being the most senior, he would just vote for