Re: [algogeeks] Re: Intersection of 2 linked lists -
@naveen ,ross and ankit - I know that linked list has only one next pointer and it can point to single point only. Sorry that i didn't explained my example actually it is like LL1 = 1 - 2 - 3 - 4 LL2 = 5 - 7 - 3 - 9 and i mean to said that LL1 and LL2 have node (whose value is 3) are common, so can't we say that LL1 and LL2 are intersecting each other. but by all of your explanations, now i have understand that after node(having digit value 3) in both linked list they must have the same value. LL1 = 1 2 3 4 LL2 = 5 7 3 4 now am i right guys? :) On Thu, Jun 2, 2011 at 10:56 PM, ankit sambyal ankitsamb...@gmail.comwrote: @Arpit : By intersection of the 2 linked lists, we mean that the pointers to a node are common. It does not mean that if 2 nodes have the same data value, they intersect. Also a node can have only 1 next node, not 2. So, in the example provided by u, how can node having data value 3 point to 2 node Thats not possible !! On Thu, Jun 2, 2011 at 10:33 PM, ross jagadish1...@gmail.com wrote: Hi Arpit, I dont think this sort of intersection is possible.. A linked list has only one next pointer and it can point to single node only. In the counter example you gave, the next ptr of node 3 points to two nodes. So, such a case does not arise. On Jun 3, 9:26 am, Arpit Mittal mrmittalro...@gmail.com wrote: L1 L2 1 5 27 3 94 Is this situation not possible? On Thu, Jun 2, 2011 at 10:23 PM, anand karthik anandkarthik@gmail.comwrote: How can that be unless 3 has two next nodes? -- 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. -- -Arpit Mittal 6th Semester, Indian Institute of Information Technology,Allahabad Email : arpitmittal.ii...@gmail.com rit2008...@iiita.ac.in Contact : +91-8853049787 Let every man be respected as an individual and no man idolized. -- 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. -- -Arpit Mittal 6th Semester, Indian Institute of Information Technology,Allahabad Email : arpitmittal.ii...@gmail.com rit2008...@iiita.ac.in Contact : +91-8853049787 Let every man be respected as an individual and no man idolized. -- 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: Intersection of 2 linked lists -
I have explained what intersection means in my previous post Ankit On Thu, Jun 2, 2011 at 11:07 PM, Arpit Mittal mrmittalro...@gmail.com wrote: @naveen ,ross and ankit - I know that linked list has only one next pointer and it can point to single point only. Sorry that i didn't explained my example actually it is like LL1 = 1 - 2 - 3 - 4 LL2 = 5 - 7 - 3 - 9 and i mean to said that LL1 and LL2 have node (whose value is 3) are common, so can't we say that LL1 and LL2 are intersecting each other. but by all of your explanations, now i have understand that after node(having digit value 3) in both linked list they must have the same value. LL1 = 1 2 3 4 LL2 = 5 7 3 4 now am i right guys? :) On Thu, Jun 2, 2011 at 10:56 PM, ankit sambyal ankitsamb...@gmail.com wrote: @Arpit : By intersection of the 2 linked lists, we mean that the pointers to a node are common. It does not mean that if 2 nodes have the same data value, they intersect. Also a node can have only 1 next node, not 2. So, in the example provided by u, how can node having data value 3 point to 2 node Thats not possible !! On Thu, Jun 2, 2011 at 10:33 PM, ross jagadish1...@gmail.com wrote: Hi Arpit, I dont think this sort of intersection is possible.. A linked list has only one next pointer and it can point to single node only. In the counter example you gave, the next ptr of node 3 points to two nodes. So, such a case does not arise. On Jun 3, 9:26 am, Arpit Mittal mrmittalro...@gmail.com wrote: L1 L2 1 5 2 7 3 9 4 Is this situation not possible? On Thu, Jun 2, 2011 at 10:23 PM, anand karthik anandkarthik@gmail.comwrote: How can that be unless 3 has two next nodes? -- 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. -- -Arpit Mittal 6th Semester, Indian Institute of Information Technology,Allahabad Email : arpitmittal.ii...@gmail.com rit2008...@iiita.ac.in Contact : +91-8853049787 Let every man be respected as an individual and no man idolized. -- 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. -- -Arpit Mittal 6th Semester, Indian Institute of Information Technology,Allahabad Email : arpitmittal.ii...@gmail.com rit2008...@iiita.ac.in Contact : +91-8853049787 Let every man be respected as an individual and no man idolized. -- 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: Intersection of 2 linked lists -
yeah ok, thanks On Thu, Jun 2, 2011 at 11:13 PM, ankit sambyal ankitsamb...@gmail.comwrote: I have explained what intersection means in my previous post Ankit On Thu, Jun 2, 2011 at 11:07 PM, Arpit Mittal mrmittalro...@gmail.com wrote: @naveen ,ross and ankit - I know that linked list has only one next pointer and it can point to single point only. Sorry that i didn't explained my example actually it is like LL1 = 1 - 2 - 3 - 4 LL2 = 5 - 7 - 3 - 9 and i mean to said that LL1 and LL2 have node (whose value is 3) are common, so can't we say that LL1 and LL2 are intersecting each other. but by all of your explanations, now i have understand that after node(having digit value 3) in both linked list they must have the same value. LL1 = 1 2 3 4 LL2 = 5 7 3 4 now am i right guys? :) On Thu, Jun 2, 2011 at 10:56 PM, ankit sambyal ankitsamb...@gmail.com wrote: @Arpit : By intersection of the 2 linked lists, we mean that the pointers to a node are common. It does not mean that if 2 nodes have the same data value, they intersect. Also a node can have only 1 next node, not 2. So, in the example provided by u, how can node having data value 3 point to 2 node Thats not possible !! On Thu, Jun 2, 2011 at 10:33 PM, ross jagadish1...@gmail.com wrote: Hi Arpit, I dont think this sort of intersection is possible.. A linked list has only one next pointer and it can point to single node only. In the counter example you gave, the next ptr of node 3 points to two nodes. So, such a case does not arise. On Jun 3, 9:26 am, Arpit Mittal mrmittalro...@gmail.com wrote: L1 L2 1 5 27 3 94 Is this situation not possible? On Thu, Jun 2, 2011 at 10:23 PM, anand karthik anandkarthik@gmail.comwrote: How can that be unless 3 has two next nodes? -- 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. -- -Arpit Mittal 6th Semester, Indian Institute of Information Technology,Allahabad Email : arpitmittal.ii...@gmail.com rit2008...@iiita.ac.in Contact : +91-8853049787 Let every man be respected as an individual and no man idolized. -- 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. -- -Arpit Mittal 6th Semester, Indian Institute of Information Technology,Allahabad Email : arpitmittal.ii...@gmail.com rit2008...@iiita.ac.in Contact : +91-8853049787 Let every man be respected as an individual and no man idolized. -- 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. -- -Arpit Mittal 6th Semester, Indian Institute of Information Technology,Allahabad Email : arpitmittal.ii...@gmail.com rit2008...@iiita.ac.in Contact : +91-8853049787 Let every man be respected as an individual and no man idolized. -- 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] A simple C question
Please help me in this question. What's the condition so that the following code prints both HelloWorld ! if condition printf (Hello); else printf(World); -- -Arpit Mittal 6th Semester, Indian Institute of Information Technology,Allahabad Email : arpitmittal.ii...@gmail.com rit2008...@iiita.ac.in Contact : +91-8853049787 Let every man be respected as an individual and no man idolized. -- 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] 3 stacks using one array?
Can you give an efficient way of implementing 3 stacks using a single array? -- 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] A simple C question
if (!printf(Hello) printf(Hello); else printf(World); On Fri, Jun 3, 2011 at 11:52 AM, Arpit Mittal mrmittalro...@gmail.comwrote: Please help me in this question. What's the condition so that the following code prints both HelloWorld ! if condition printf (Hello); else printf(World); -- -Arpit Mittal 6th Semester, Indian Institute of Information Technology,Allahabad Email : arpitmittal.ii...@gmail.com rit2008...@iiita.ac.in Contact : +91-8853049787 Let every man be respected as an individual and no man idolized. -- 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. -- Cheers Naveen 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.
Re: [algogeeks] A simple C question
(!printf(Hello)) On Jun 3, 2011 11:52 AM, Arpit Mittal mrmittalro...@gmail.com wrote: Please help me in this question. What's the condition so that the following code prints both HelloWorld ! if condition printf (Hello); else printf(World); -- -Arpit Mittal 6th Semester, Indian Institute of Information Technology,Allahabad Email : arpitmittal.ii...@gmail.com rit2008...@iiita.ac.in Contact : +91-8853049787 Let every man be respected as an individual and no man idolized. -- 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] A simple C question
can use fork() also.. On Fri, Jun 3, 2011 at 11:57 AM, anand karthik anandkarthik@gmail.com wrote: (!printf(Hello)) On Jun 3, 2011 11:52 AM, Arpit Mittal mrmittalro...@gmail.com wrote: Please help me in this question. What's the condition so that the following code prints both HelloWorld ! if condition printf (Hello); else printf(World); -- -Arpit Mittal 6th Semester, Indian Institute of Information Technology,Allahabad Email : arpitmittal.ii...@gmail.com rit2008...@iiita.ac.in Contact : +91-8853049787 Let every man be respected as an individual and no man idolized. -- 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] A simple C question
Hi Vishal, Can you show us how it be done with fork? On Fri, Jun 3, 2011 at 12:02 PM, Vishal Thanki vishaltha...@gmail.comwrote: can use fork() also.. On Fri, Jun 3, 2011 at 11:57 AM, anand karthik anandkarthik@gmail.com wrote: (!printf(Hello)) On Jun 3, 2011 11:52 AM, Arpit Mittal mrmittalro...@gmail.com wrote: Please help me in this question. What's the condition so that the following code prints both HelloWorld ! if condition printf (Hello); else printf(World); -- -Arpit Mittal 6th Semester, Indian Institute of Information Technology,Allahabad Email : arpitmittal.ii...@gmail.com rit2008...@iiita.ac.in Contact : +91-8853049787 Let every man be respected as an individual and no man idolized. -- 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. -- Cheers Naveen 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.
Re: [algogeeks] A simple C question
vishal@ubuntu:~/progs/c\ 12:11:53 PM $ cat fork.c #include stdio.h #include stdlib.h int main() { if (fork()) { printf(hello ); } else { printf(world\n); } return 0; } vishal@ubuntu:~/progs/c\ 12:11:56 PM $ gcc fork.c vishal@ubuntu:~/progs/c\ 12:12:06 PM $ ./a.out hello world On Fri, Jun 3, 2011 at 12:09 PM, Naveen Kumar naveenkumarve...@gmail.com wrote: Hi Vishal, Can you show us how it be done with fork? On Fri, Jun 3, 2011 at 12:02 PM, Vishal Thanki vishaltha...@gmail.com wrote: can use fork() also.. On Fri, Jun 3, 2011 at 11:57 AM, anand karthik anandkarthik@gmail.com wrote: (!printf(Hello)) On Jun 3, 2011 11:52 AM, Arpit Mittal mrmittalro...@gmail.com wrote: Please help me in this question. What's the condition so that the following code prints both HelloWorld ! if condition printf (Hello); else printf(World); -- -Arpit Mittal 6th Semester, Indian Institute of Information Technology,Allahabad Email : arpitmittal.ii...@gmail.com rit2008...@iiita.ac.in Contact : +91-8853049787 Let every man be respected as an individual and no man idolized. -- 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. -- Cheers Naveen 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] A simple C question
oh yes, gud one On Fri, Jun 3, 2011 at 12:12 PM, Vishal Thanki vishaltha...@gmail.comwrote: vishal@ubuntu:~/progs/c\ 12:11:53 PM $ cat fork.c #include stdio.h #include stdlib.h int main() { if (fork()) { printf(hello ); } else { printf(world\n); } return 0; } vishal@ubuntu:~/progs/c\ 12:11:56 PM $ gcc fork.c vishal@ubuntu:~/progs/c\ 12:12:06 PM $ ./a.out hello world On Fri, Jun 3, 2011 at 12:09 PM, Naveen Kumar naveenkumarve...@gmail.com wrote: Hi Vishal, Can you show us how it be done with fork? On Fri, Jun 3, 2011 at 12:02 PM, Vishal Thanki vishaltha...@gmail.com wrote: can use fork() also.. On Fri, Jun 3, 2011 at 11:57 AM, anand karthik anandkarthik@gmail.com wrote: (!printf(Hello)) On Jun 3, 2011 11:52 AM, Arpit Mittal mrmittalro...@gmail.com wrote: Please help me in this question. What's the condition so that the following code prints both HelloWorld ! if condition printf (Hello); else printf(World); -- -Arpit Mittal 6th Semester, Indian Institute of Information Technology,Allahabad Email : arpitmittal.ii...@gmail.com rit2008...@iiita.ac.in Contact : +91-8853049787 Let every man be respected as an individual and no man idolized. -- 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. -- Cheers Naveen 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. -- Cheers Naveen 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.
Re: [algogeeks] A simple C question
but we can't be sure that it will print hello world or world hello :P On Fri, Jun 3, 2011 at 12:14 PM, Naveen Kumar naveenkumarve...@gmail.comwrote: oh yes, gud one On Fri, Jun 3, 2011 at 12:12 PM, Vishal Thanki vishaltha...@gmail.comwrote: vishal@ubuntu:~/progs/c\ 12:11:53 PM $ cat fork.c #include stdio.h #include stdlib.h int main() { if (fork()) { printf(hello ); } else { printf(world\n); } return 0; } vishal@ubuntu:~/progs/c\ 12:11:56 PM $ gcc fork.c vishal@ubuntu:~/progs/c\ 12:12:06 PM $ ./a.out hello world On Fri, Jun 3, 2011 at 12:09 PM, Naveen Kumar naveenkumarve...@gmail.com wrote: Hi Vishal, Can you show us how it be done with fork? On Fri, Jun 3, 2011 at 12:02 PM, Vishal Thanki vishaltha...@gmail.com wrote: can use fork() also.. On Fri, Jun 3, 2011 at 11:57 AM, anand karthik anandkarthik@gmail.com wrote: (!printf(Hello)) On Jun 3, 2011 11:52 AM, Arpit Mittal mrmittalro...@gmail.com wrote: Please help me in this question. What's the condition so that the following code prints both HelloWorld ! if condition printf (Hello); else printf(World); -- -Arpit Mittal 6th Semester, Indian Institute of Information Technology,Allahabad Email : arpitmittal.ii...@gmail.com rit2008...@iiita.ac.in Contact : +91-8853049787 Let every man be respected as an individual and no man idolized. -- 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. -- Cheers Naveen 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. -- Cheers Naveen Kumar -- Cheers Naveen 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.
Re: [algogeeks] A simple C question
There can be some synchronisation problems with fork() right? say world might get printed first...or maybe the letters can get jumbled too...We cannot guarantee the order of execution unless we use semaphores. On Fri, Jun 3, 2011 at 12:14 PM, Naveen Kumar naveenkumarve...@gmail.comwrote: oh yes, gud one On Fri, Jun 3, 2011 at 12:12 PM, Vishal Thanki vishaltha...@gmail.comwrote: vishal@ubuntu:~/progs/c\ 12:11:53 PM $ cat fork.c #include stdio.h #include stdlib.h int main() { if (fork()) { printf(hello ); } else { printf(world\n); } return 0; } vishal@ubuntu:~/progs/c\ 12:11:56 PM $ gcc fork.c vishal@ubuntu:~/progs/c\ 12:12:06 PM $ ./a.out hello world On Fri, Jun 3, 2011 at 12:09 PM, Naveen Kumar naveenkumarve...@gmail.com wrote: Hi Vishal, Can you show us how it be done with fork? On Fri, Jun 3, 2011 at 12:02 PM, Vishal Thanki vishaltha...@gmail.com wrote: can use fork() also.. On Fri, Jun 3, 2011 at 11:57 AM, anand karthik anandkarthik@gmail.com wrote: (!printf(Hello)) On Jun 3, 2011 11:52 AM, Arpit Mittal mrmittalro...@gmail.com wrote: Please help me in this question. What's the condition so that the following code prints both HelloWorld ! if condition printf (Hello); else printf(World); -- -Arpit Mittal 6th Semester, Indian Institute of Information Technology,Allahabad Email : arpitmittal.ii...@gmail.com rit2008...@iiita.ac.in Contact : +91-8853049787 Let every man be respected as an individual and no man idolized. -- 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. -- Cheers Naveen 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. -- Cheers Naveen 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. -- Regards, Shachindra A C -- 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] A simple C question
@vishal: can u explain the fork() solution?? On Fri, Jun 3, 2011 at 12:16 PM, Shachindra A C sachindr...@gmail.comwrote: There can be some synchronisation problems with fork() right? say world might get printed first...or maybe the letters can get jumbled too...We cannot guarantee the order of execution unless we use semaphores. On Fri, Jun 3, 2011 at 12:14 PM, Naveen Kumar naveenkumarve...@gmail.comwrote: oh yes, gud one On Fri, Jun 3, 2011 at 12:12 PM, Vishal Thanki vishaltha...@gmail.comwrote: vishal@ubuntu:~/progs/c\ 12:11:53 PM $ cat fork.c #include stdio.h #include stdlib.h int main() { if (fork()) { printf(hello ); } else { printf(world\n); } return 0; } vishal@ubuntu:~/progs/c\ 12:11:56 PM $ gcc fork.c vishal@ubuntu:~/progs/c\ 12:12:06 PM $ ./a.out hello world On Fri, Jun 3, 2011 at 12:09 PM, Naveen Kumar naveenkumarve...@gmail.com wrote: Hi Vishal, Can you show us how it be done with fork? On Fri, Jun 3, 2011 at 12:02 PM, Vishal Thanki vishaltha...@gmail.com wrote: can use fork() also.. On Fri, Jun 3, 2011 at 11:57 AM, anand karthik anandkarthik@gmail.com wrote: (!printf(Hello)) On Jun 3, 2011 11:52 AM, Arpit Mittal mrmittalro...@gmail.com wrote: Please help me in this question. What's the condition so that the following code prints both HelloWorld ! if condition printf (Hello); else printf(World); -- -Arpit Mittal 6th Semester, Indian Institute of Information Technology,Allahabad Email : arpitmittal.ii...@gmail.com rit2008...@iiita.ac.in Contact : +91-8853049787 Let every man be respected as an individual and no man idolized. -- 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. -- Cheers Naveen 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. -- Cheers Naveen 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. -- Regards, Shachindra A C -- 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, Vιиodh -- 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] 3 stacks using one array?
Divide the array into 3 equal parts and allow each stack to grow in its space (1/3 of total.) On Fri, Jun 3, 2011 at 11:54 AM, kumar vr kumarg...@gmail.com wrote: Can you give an efficient way of implementing 3 stacks using a single array? -- 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. -- Harshal Choudhary, III 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.
Re: [algogeeks] A simple C question
@sachindra, @naveen, this was just a plain trick to execute if and else block. i agree with your concerns :) 2011/6/3 Vιиodh vinodh...@gmail.com: @vishal: can u explain the fork() solution?? On Fri, Jun 3, 2011 at 12:16 PM, Shachindra A C sachindr...@gmail.com wrote: There can be some synchronisation problems with fork() right? say world might get printed first...or maybe the letters can get jumbled too...We cannot guarantee the order of execution unless we use semaphores. On Fri, Jun 3, 2011 at 12:14 PM, Naveen Kumar naveenkumarve...@gmail.com wrote: oh yes, gud one On Fri, Jun 3, 2011 at 12:12 PM, Vishal Thanki vishaltha...@gmail.com wrote: vishal@ubuntu:~/progs/c\ 12:11:53 PM $ cat fork.c #include stdio.h #include stdlib.h int main() { if (fork()) { printf(hello ); } else { printf(world\n); } return 0; } vishal@ubuntu:~/progs/c\ 12:11:56 PM $ gcc fork.c vishal@ubuntu:~/progs/c\ 12:12:06 PM $ ./a.out hello world On Fri, Jun 3, 2011 at 12:09 PM, Naveen Kumar naveenkumarve...@gmail.com wrote: Hi Vishal, Can you show us how it be done with fork? On Fri, Jun 3, 2011 at 12:02 PM, Vishal Thanki vishaltha...@gmail.com wrote: can use fork() also.. On Fri, Jun 3, 2011 at 11:57 AM, anand karthik anandkarthik@gmail.com wrote: (!printf(Hello)) On Jun 3, 2011 11:52 AM, Arpit Mittal mrmittalro...@gmail.com wrote: Please help me in this question. What's the condition so that the following code prints both HelloWorld ! if condition printf (Hello); else printf(World); -- -Arpit Mittal 6th Semester, Indian Institute of Information Technology,Allahabad Email : arpitmittal.ii...@gmail.com rit2008...@iiita.ac.in Contact : +91-8853049787 Let every man be respected as an individual and no man idolized. -- 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. -- Cheers Naveen 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. -- Cheers Naveen 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. -- Regards, Shachindra A C -- 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, Vιиodh -- 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
Re: [algogeeks] [brain teaser ] Life Or Death 3 june
1 white marble in one bowl...rest all marbles in the other bowl.. On Fri, Jun 3, 2011 at 12:44 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote: *life or death Puzzle * * * ** *You are a prisoner sentenced to death. The Emperor offers you a chance to live by playing a simple game. He gives you 50 black marbles, 50 white marbles and 2 empty bowls. He then says, 'Divide these 100 marbles into these 2 bowls. You can divide them any way you like as long as you use all the marbles. Then I will blindfold you and mix the bowls around. You then can choose one bowl and remove ONE marble. If the marble is WHITE you will live, but if the marble is BLACK... you will die.' How do you divide the marbles up so that you have the greatest probability of choosing a WHITE marble? * * * *Update Your Answers at* : Click Herehttp://dailybrainteaser.blogspot.com/2011/06/life-or-death-3-june.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.
Re: [algogeeks] 3 stacks using one array?
@Harshal Your Solution is optimal but i think in this question whenever there is some space available in array we should be able to use that space for either of the stack. in your solution this thing is missing. I don't know the solution but i think it can be improved in a way to get the required On Fri, Jun 3, 2011 at 12:31 PM, Harshal hc4...@gmail.com wrote: Divide the array into 3 equal parts and allow each stack to grow in its space (1/3 of total.) On Fri, Jun 3, 2011 at 11:54 AM, kumar vr kumarg...@gmail.com wrote: Can you give an efficient way of implementing 3 stacks using a single array? -- 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. -- Harshal Choudhary, III 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. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- 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] 3 stacks using one array?
@Sunny: yes, you are right. If any stack is allowed to grow as long as there is any free space in the array, we will have to allocate space to stacks sequentially in the array maintaining a pointer to the previous top element of a particular stack, and updating the new top. Thus any new element in a stack will keep a pointer 'prev'. However, we face a problem of unused space on deleting an element. The deleted elements may not necessarily appear at the end of the ar- ray. To cope with this, we can maintain an array (call it free_array) and initially the whole array is in free_array. For every push operation, we would delete an entry from this free_array . On pop, we would simply add the index of popped element to the free_array. On Fri, Jun 3, 2011 at 1:01 PM, sunny agrawal sunny816.i...@gmail.comwrote: @Harshal Your Solution is optimal but i think in this question whenever there is some space available in array we should be able to use that space for either of the stack. in your solution this thing is missing. I don't know the solution but i think it can be improved in a way to get the required On Fri, Jun 3, 2011 at 12:31 PM, Harshal hc4...@gmail.com wrote: Divide the array into 3 equal parts and allow each stack to grow in its space (1/3 of total.) On Fri, Jun 3, 2011 at 11:54 AM, kumar vr kumarg...@gmail.com wrote: Can you give an efficient way of implementing 3 stacks using a single array? -- 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. -- Harshal Choudhary, III 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. -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- 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. -- Harshal Choudhary, III 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.
Re: [algogeeks] [brain teaser ] Life Or Death 3 june
@bhavana- what if u choose bowl full of black marbles when u r blindfold ?? in that case u will surely die... According to me, i will place all white marbles in top layer of both bowls and all black marbles at below layer in both bowl. so that when i am blindfold whichever the bowl i will choose i will pickup white marble only, since it is on top layer of both the bowl. On Fri, Jun 3, 2011 at 12:55 PM, bhavana bhavana@gmail.com wrote: 1 white marble in one bowl...rest all marbles in the other bowl.. On Fri, Jun 3, 2011 at 12:44 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote: *life or death Puzzle * * * ** *You are a prisoner sentenced to death. The Emperor offers you a chance to live by playing a simple game. He gives you 50 black marbles, 50 white marbles and 2 empty bowls. He then says, 'Divide these 100 marbles into these 2 bowls. You can divide them any way you like as long as you use all the marbles. Then I will blindfold you and mix the bowls around. You then can choose one bowl and remove ONE marble. If the marble is WHITE you will live, but if the marble is BLACK... you will die.' How do you divide the marbles up so that you have the greatest probability of choosing a WHITE marble? * * * *Update Your Answers at* : Click Herehttp://dailybrainteaser.blogspot.com/2011/06/life-or-death-3-june.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] [brain teaser ] Life Or Death 3 june
there is no concept of top bottom layer bcoz it is assumed that probablity of drawing every marble is same. Please read my solution carefully...i wrote only 1 white marble in 1 bowl...rest all marbles(i.e. rest white all black) in the other bowl.. On Fri, Jun 3, 2011 at 1:28 PM, Pragya lal sheelub...@gmail.com wrote: @bhavana- what if u choose bowl full of black marbles when u r blindfold ?? in that case u will surely die... According to me, i will place all white marbles in top layer of both bowls and all black marbles at below layer in both bowl. so that when i am blindfold whichever the bowl i will choose i will pickup white marble only, since it is on top layer of both the bowl. On Fri, Jun 3, 2011 at 12:55 PM, bhavana bhavana@gmail.com wrote: 1 white marble in one bowl...rest all marbles in the other bowl.. On Fri, Jun 3, 2011 at 12:44 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote: *life or death Puzzle * * * ** *You are a prisoner sentenced to death. The Emperor offers you a chance to live by playing a simple game. He gives you 50 black marbles, 50 white marbles and 2 empty bowls. He then says, 'Divide these 100 marbles into these 2 bowls. You can divide them any way you like as long as you use all the marbles. Then I will blindfold you and mix the bowls around. You then can choose one bowl and remove ONE marble. If the marble is WHITE you will live, but if the marble is BLACK... you will die.' How do you divide the marbles up so that you have the greatest probability of choosing a WHITE marble? * * * *Update Your Answers at* : Click Herehttp://dailybrainteaser.blogspot.com/2011/06/life-or-death-3-june.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. -- 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 ] Life Or Death 3 june
u r blindfold , so how can u b so sure that u will be choosing bowl having one white marble ? u can choose other bowl also and in that case probability of picking white marble is 1/2. where as in my case it doesnt matter which bowl i choose... i will be picking white marble only even if i am blindfold so in every case higher probability of wining life is there.. On Fri, Jun 3, 2011 at 1:35 PM, bhavana bhavana@gmail.com wrote: there is no concept of top bottom layer bcoz it is assumed that probablity of drawing every marble is same. Please read my solution carefully...i wrote only 1 white marble in 1 bowl...rest all marbles(i.e. rest white all black) in the other bowl.. On Fri, Jun 3, 2011 at 1:28 PM, Pragya lal sheelub...@gmail.com wrote: @bhavana- what if u choose bowl full of black marbles when u r blindfold ?? in that case u will surely die... According to me, i will place all white marbles in top layer of both bowls and all black marbles at below layer in both bowl. so that when i am blindfold whichever the bowl i will choose i will pickup white marble only, since it is on top layer of both the bowl. On Fri, Jun 3, 2011 at 12:55 PM, bhavana bhavana@gmail.com wrote: 1 white marble in one bowl...rest all marbles in the other bowl.. On Fri, Jun 3, 2011 at 12:44 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote: *life or death Puzzle * * * ** *You are a prisoner sentenced to death. The Emperor offers you a chance to live by playing a simple game. He gives you 50 black marbles, 50 white marbles and 2 empty bowls. He then says, 'Divide these 100 marbles into these 2 bowls. You can divide them any way you like as long as you use all the marbles. Then I will blindfold you and mix the bowls around. You then can choose one bowl and remove ONE marble. If the marble is WHITE you will live, but if the marble is BLACK... you will die.' How do you divide the marbles up so that you have the greatest probability of choosing a WHITE marble? * * * *Update Your Answers at* : Click Herehttp://dailybrainteaser.blogspot.com/2011/06/life-or-death-3-june.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. -- 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] A simple C question
Hi Shachindra, I don't think letters will be jumbled because we a calling one api to output on console tty's driver takes whole line and output it at once. On Fri, Jun 3, 2011 at 12:40 PM, Vishal Thanki vishaltha...@gmail.comwrote: @sachindra, @naveen, this was just a plain trick to execute if and else block. i agree with your concerns :) 2011/6/3 Vιиodh vinodh...@gmail.com: @vishal: can u explain the fork() solution?? On Fri, Jun 3, 2011 at 12:16 PM, Shachindra A C sachindr...@gmail.com wrote: There can be some synchronisation problems with fork() right? say world might get printed first...or maybe the letters can get jumbled too...We cannot guarantee the order of execution unless we use semaphores. On Fri, Jun 3, 2011 at 12:14 PM, Naveen Kumar naveenkumarve...@gmail.com wrote: oh yes, gud one On Fri, Jun 3, 2011 at 12:12 PM, Vishal Thanki vishaltha...@gmail.com wrote: vishal@ubuntu:~/progs/c\ 12:11:53 PM $ cat fork.c #include stdio.h #include stdlib.h int main() { if (fork()) { printf(hello ); } else { printf(world\n); } return 0; } vishal@ubuntu:~/progs/c\ 12:11:56 PM $ gcc fork.c vishal@ubuntu:~/progs/c\ 12:12:06 PM $ ./a.out hello world On Fri, Jun 3, 2011 at 12:09 PM, Naveen Kumar naveenkumarve...@gmail.com wrote: Hi Vishal, Can you show us how it be done with fork? On Fri, Jun 3, 2011 at 12:02 PM, Vishal Thanki vishaltha...@gmail.com wrote: can use fork() also.. On Fri, Jun 3, 2011 at 11:57 AM, anand karthik anandkarthik@gmail.com wrote: (!printf(Hello)) On Jun 3, 2011 11:52 AM, Arpit Mittal mrmittalro...@gmail.com wrote: Please help me in this question. What's the condition so that the following code prints both HelloWorld ! if condition printf (Hello); else printf(World); -- -Arpit Mittal 6th Semester, Indian Institute of Information Technology,Allahabad Email : arpitmittal.ii...@gmail.com rit2008...@iiita.ac.in Contact : +91-8853049787 Let every man be respected as an individual and no man idolized. -- 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. -- Cheers Naveen 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. -- Cheers Naveen 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. -- Regards, Shachindra A C -- 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, Vιиodh -- You received this message
Re: [algogeeks] [brain teaser ] Life Or Death 3 june
all white marble in one bowl... all black in other bowl.. On Fri, Jun 3, 2011 at 1:51 PM, Naveen Kumar naveenkumarve...@gmail.comwrote: I think *mix the bowls around* will shift layers too. On Fri, Jun 3, 2011 at 1:43 PM, Pragya lal sheelub...@gmail.com wrote: u r blindfold , so how can u b so sure that u will be choosing bowl having one white marble ? u can choose other bowl also and in that case probability of picking white marble is 1/2. where as in my case it doesnt matter which bowl i choose... i will be picking white marble only even if i am blindfold so in every case higher probability of wining life is there.. On Fri, Jun 3, 2011 at 1:35 PM, bhavana bhavana@gmail.com wrote: there is no concept of top bottom layer bcoz it is assumed that probablity of drawing every marble is same. Please read my solution carefully...i wrote only 1 white marble in 1 bowl...rest all marbles(i.e. rest white all black) in the other bowl.. On Fri, Jun 3, 2011 at 1:28 PM, Pragya lal sheelub...@gmail.com wrote: @bhavana- what if u choose bowl full of black marbles when u r blindfold ?? in that case u will surely die... According to me, i will place all white marbles in top layer of both bowls and all black marbles at below layer in both bowl. so that when i am blindfold whichever the bowl i will choose i will pickup white marble only, since it is on top layer of both the bowl. On Fri, Jun 3, 2011 at 12:55 PM, bhavana bhavana@gmail.com wrote: 1 white marble in one bowl...rest all marbles in the other bowl.. On Fri, Jun 3, 2011 at 12:44 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote: *life or death Puzzle * * * ** *You are a prisoner sentenced to death. The Emperor offers you a chance to live by playing a simple game. He gives you 50 black marbles, 50 white marbles and 2 empty bowls. He then says, 'Divide these 100 marbles into these 2 bowls. You can divide them any way you like as long as you use all the marbles. Then I will blindfold you and mix the bowls around. You then can choose one bowl and remove ONE marble. If the marble is WHITE you will live, but if the marble is BLACK... you will die.' How do you divide the marbles up so that you have the greatest probability of choosing a WHITE marble? * * * *Update Your Answers at* : Click Herehttp://dailybrainteaser.blogspot.com/2011/06/life-or-death-3-june.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. -- 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. -- Cheers Naveen 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. -- Dileep Kumar Gupta B-Tech 2nd year Computer Science n Engineering 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
Re: [algogeeks] [brain teaser ] Life Or Death 3 june
with bhavana's solution we get 1/2 + 1/2 * 49/99 = .5 + .247 = .747 probability to live. I think that's the best we can get. On Fri, Jun 3, 2011 at 2:38 PM, D!leep Gupta dileep.smil...@gmail.comwrote: all white marble in one bowl... all black in other bowl.. On Fri, Jun 3, 2011 at 1:51 PM, Naveen Kumar naveenkumarve...@gmail.comwrote: I think *mix the bowls around* will shift layers too. On Fri, Jun 3, 2011 at 1:43 PM, Pragya lal sheelub...@gmail.com wrote: u r blindfold , so how can u b so sure that u will be choosing bowl having one white marble ? u can choose other bowl also and in that case probability of picking white marble is 1/2. where as in my case it doesnt matter which bowl i choose... i will be picking white marble only even if i am blindfold so in every case higher probability of wining life is there.. On Fri, Jun 3, 2011 at 1:35 PM, bhavana bhavana@gmail.com wrote: there is no concept of top bottom layer bcoz it is assumed that probablity of drawing every marble is same. Please read my solution carefully...i wrote only 1 white marble in 1 bowl...rest all marbles(i.e. rest white all black) in the other bowl.. On Fri, Jun 3, 2011 at 1:28 PM, Pragya lal sheelub...@gmail.comwrote: @bhavana- what if u choose bowl full of black marbles when u r blindfold ?? in that case u will surely die... According to me, i will place all white marbles in top layer of both bowls and all black marbles at below layer in both bowl. so that when i am blindfold whichever the bowl i will choose i will pickup white marble only, since it is on top layer of both the bowl. On Fri, Jun 3, 2011 at 12:55 PM, bhavana bhavana@gmail.comwrote: 1 white marble in one bowl...rest all marbles in the other bowl.. On Fri, Jun 3, 2011 at 12:44 PM, Lavesh Rawat lavesh.ra...@gmail.com wrote: *life or death Puzzle * * * ** *You are a prisoner sentenced to death. The Emperor offers you a chance to live by playing a simple game. He gives you 50 black marbles, 50 white marbles and 2 empty bowls. He then says, 'Divide these 100 marbles into these 2 bowls. You can divide them any way you like as long as you use all the marbles. Then I will blindfold you and mix the bowls around. You then can choose one bowl and remove ONE marble. If the marble is WHITE you will live, but if the marble is BLACK... you will die.' How do you divide the marbles up so that you have the greatest probability of choosing a WHITE marble? * * * *Update Your Answers at* : Click Herehttp://dailybrainteaser.blogspot.com/2011/06/life-or-death-3-june.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. -- 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. -- Cheers Naveen 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. -- Dileep Kumar Gupta B-Tech 2nd year Computer Science n Engineering MNNIT
Re: [algogeeks] [brain teaser ] Life Or Death 3 june
According to my solutionprobablity of choosing any bowl is 1/2 So, if bowl with only 1 white marble is chosen...we wll definitely get white so P=1 if other bowl chosen..it consists of 49 white 50 black marbles...so probablity of drawing a white ball is approx 1/2. Hence the total probablity of drawing a white ball is P(W) = (1/2)(1) + (1/2)*(1/2) = 3/4 On Fri, Jun 3, 2011 at 2:38 PM, D!leep Gupta dileep.smil...@gmail.comwrote: all white marble in one bowl... all black in other bowl.. On Fri, Jun 3, 2011 at 1:51 PM, Naveen Kumar naveenkumarve...@gmail.comwrote: I think *mix the bowls around* will shift layers too. On Fri, Jun 3, 2011 at 1:43 PM, Pragya lal sheelub...@gmail.com wrote: u r blindfold , so how can u b so sure that u will be choosing bowl having one white marble ? u can choose other bowl also and in that case probability of picking white marble is 1/2. where as in my case it doesnt matter which bowl i choose... i will be picking white marble only even if i am blindfold so in every case higher probability of wining life is there.. On Fri, Jun 3, 2011 at 1:35 PM, bhavana bhavana@gmail.com wrote: there is no concept of top bottom layer bcoz it is assumed that probablity of drawing every marble is same. Please read my solution carefully...i wrote only 1 white marble in 1 bowl...rest all marbles(i.e. rest white all black) in the other bowl.. On Fri, Jun 3, 2011 at 1:28 PM, Pragya lal sheelub...@gmail.comwrote: @bhavana- what if u choose bowl full of black marbles when u r blindfold ?? in that case u will surely die... According to me, i will place all white marbles in top layer of both bowls and all black marbles at below layer in both bowl. so that when i am blindfold whichever the bowl i will choose i will pickup white marble only, since it is on top layer of both the bowl. On Fri, Jun 3, 2011 at 12:55 PM, bhavana bhavana@gmail.comwrote: 1 white marble in one bowl...rest all marbles in the other bowl.. On Fri, Jun 3, 2011 at 12:44 PM, Lavesh Rawat lavesh.ra...@gmail.com wrote: *life or death Puzzle * * * ** *You are a prisoner sentenced to death. The Emperor offers you a chance to live by playing a simple game. He gives you 50 black marbles, 50 white marbles and 2 empty bowls. He then says, 'Divide these 100 marbles into these 2 bowls. You can divide them any way you like as long as you use all the marbles. Then I will blindfold you and mix the bowls around. You then can choose one bowl and remove ONE marble. If the marble is WHITE you will live, but if the marble is BLACK... you will die.' How do you divide the marbles up so that you have the greatest probability of choosing a WHITE marble? * * * *Update Your Answers at* : Click Herehttp://dailybrainteaser.blogspot.com/2011/06/life-or-death-3-june.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. -- 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. -- Cheers Naveen 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
Re: [algogeeks] A simple C question
Here you go in C code http://codepad.org/gk6AZj0T int main() { if(printf(hello)!=0) { printf(world); } else { printf(SCREWED ! ! !); } return 0; } * * * * *Subhransu Panigrahi * *Mobile:* *+91-9840931538* *Email:* subhransu.panigr...@gmail.com On Fri, Jun 3, 2011 at 1:57 PM, Naveen Kumar naveenkumarve...@gmail.comwrote: Hi Shachindra, I don't think letters will be jumbled because we a calling one api to output on console tty's driver takes whole line and output it at once. On Fri, Jun 3, 2011 at 12:40 PM, Vishal Thanki vishaltha...@gmail.comwrote: @sachindra, @naveen, this was just a plain trick to execute if and else block. i agree with your concerns :) 2011/6/3 Vιиodh vinodh...@gmail.com: @vishal: can u explain the fork() solution?? On Fri, Jun 3, 2011 at 12:16 PM, Shachindra A C sachindr...@gmail.com wrote: There can be some synchronisation problems with fork() right? say world might get printed first...or maybe the letters can get jumbled too...We cannot guarantee the order of execution unless we use semaphores. On Fri, Jun 3, 2011 at 12:14 PM, Naveen Kumar naveenkumarve...@gmail.com wrote: oh yes, gud one On Fri, Jun 3, 2011 at 12:12 PM, Vishal Thanki vishaltha...@gmail.com wrote: vishal@ubuntu:~/progs/c\ 12:11:53 PM $ cat fork.c #include stdio.h #include stdlib.h int main() { if (fork()) { printf(hello ); } else { printf(world\n); } return 0; } vishal@ubuntu:~/progs/c\ 12:11:56 PM $ gcc fork.c vishal@ubuntu:~/progs/c\ 12:12:06 PM $ ./a.out hello world On Fri, Jun 3, 2011 at 12:09 PM, Naveen Kumar naveenkumarve...@gmail.com wrote: Hi Vishal, Can you show us how it be done with fork? On Fri, Jun 3, 2011 at 12:02 PM, Vishal Thanki vishaltha...@gmail.com wrote: can use fork() also.. On Fri, Jun 3, 2011 at 11:57 AM, anand karthik anandkarthik@gmail.com wrote: (!printf(Hello)) On Jun 3, 2011 11:52 AM, Arpit Mittal mrmittalro...@gmail.com wrote: Please help me in this question. What's the condition so that the following code prints both HelloWorld ! if condition printf (Hello); else printf(World); -- -Arpit Mittal 6th Semester, Indian Institute of Information Technology,Allahabad Email : arpitmittal.ii...@gmail.com rit2008...@iiita.ac.in Contact : +91-8853049787 Let every man be respected as an individual and no man idolized. -- 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. -- Cheers Naveen 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. -- Cheers Naveen 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. -- Regards, Shachindra A C -- You received this message because you are subscribed to the Google
[algogeeks] Google
Given a two balanced binary search trees.Merge both the trees so that it will form again a balanced binary search tree. -- 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] Facebook
Question: Design a component that implements the following functionality.. 1) Record an Event (For the sake of simplicity, treat the Event as an integer code) 2) Return the number of Events recorded in the last one minute. 3) Return the number of Events recorded in the last one hour. i.e implement the following interface - Design the interface first - Give the implementation detail. Open ended question: What if there isn't enough storage available to store each individual event ? -- 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: what is wrong in my logic :problem sbets
but how anyteam can play 5 match? because there are only 16 match 8+4+2+1(final) +1(for 3 runner up) so any team can play at max 4 match. guide pls if i am wrong... On Thu, Jun 2, 2011 at 6:50 PM, John Hayes agressiveha...@gmail.com wrote: your logic will fail in many cases as the runner up will also have 4 win but in 5 matches.on the other hand winner will have 4 out of 4 ;) On Jun 2, 1:51 am, PRAMENDRA RATHi rathi prathi...@gmail.com wrote: i am thinking that the team with win point 4 will be the winner .. is this wrong? https://www.spoj.pl/problems/SBETS/ -- 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] Google
Do the postorder traversal of the 2nd AVL tree and keep inserting the value in the 1st AVL tree.Simultaneously go on deleting the same node...I hope I am clear. On 6/3/11, Nate nate.archibal...@gmail.com wrote: Given a two balanced binary search trees.Merge both the trees so that it will form again a balanced binary search tree. -- 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. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. 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 ] Life Or Death 3 june
But when we choose the bowl, can't we touch the marbles so that if only one marble is there in a bowl then we can easily identify by touching it... On 3 Jun 2011 14:45, bhavana bhavana@gmail.com wrote: According to my solutionprobablity of choosing any bowl is 1/2 So, if bowl with only 1 white marble is chosen...we wll definitely get white so P=1 if other bowl chosen..it consists of 49 white 50 black marbles...so probablity of drawing a white ball is approx 1/2. Hence the total probablity of drawing a white ball is P(W) = (1/2)(1) + (1/2)*(1/2) = 3/4 On Fri, Jun 3, 2011 at 2:38 PM, D!leep Gupta dileep.smil...@gmail.com wrote: all white marble in one bowl... all black in other bowl.. On Fri, Jun 3, 2011 at 1:51 PM, ... -- You received this message because you are subscribed to the Google Groups Algorithm Geeks grou... -- 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] hajime help:
can anyone tell me how to think about this 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.
Re: [algogeeks] How to remove duplicate element from array in one pass.
Python implementation using dictionary/hash table # main function def main(): # 'dicti' is a hash table # 's' is string dicti = {}; s = asldhj aldalkd7^Awu3e8 ue8u1o2h3o82708q2 # iterting over the string for i in range(len(s)): # if the character is not in hash table ,then store the character with value ==1 # and print(or store) the echaracter if not s[i] in dicti: dicti[s[i]] = 1 print s[i] if __name__ == __main__: main() -- 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 ] Life Or Death 3 june
what r u discussing guys ? the ans. was clear in very first post by bhavana . @balaji dude why can't we use more science in choosing .. may be black marbels are slightly hotter than white's because they absorb light . or as it is question of life we better go for color sensors ...may be Hey man no offence i'm just kidding .. :) :) -- 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] Facebook
Here is the algo by which I would have approach it : int array[MAX_SIZE]; int top; //global variable which holds the index of the top of the array struct Event { int event_code; int hours; int mins; int seconds;//to hold the time at which the evemt occured }; void recordEvent(Event e) { if(topMAX_SIZE - 1) { Add event to the top of the array top++; } else { remove 100 elements from the bottom of array by shifting the elements of the array down by 100 times Change the top accordingly Now add the event to the top of the array top++; } } int numEventsInLast1min() { int count=0,i=top; while(1) { Calculate the difference in the present time and the time of the event which is at the top of the array if(difference = 1 min) count++; else break; } return count; } int numEventsInLast1hour() { int count=0,i=top; while(1) { Calculate the difference in the present time and the time of the event which is at the top of the array if(difference = 1 hour) count++; else break; } return count;} The amortized cost of recording an event is O(1). But it may take a lot of time for some events because of shifting. Any clarifications required, please comment... Ankit Sambyal BITS Pilani On Fri, Jun 3, 2011 at 2:06 AM, Nate nate.archibal...@gmail.com wrote: Question: Design a component that implements the following functionality.. 1) Record an Event (For the sake of simplicity, treat the Event as an integer code) 2) Return the number of Events recorded in the last one minute. 3) Return the number of Events recorded in the last one hour. i.e implement the following interface - Design the interface first - Give the implementation detail. Open ended question: What if there isn't enough storage available to store each individual event ? -- 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] Google
convert the trees to DLL and then merge them to get the combined sorted DLL , now create the AVl tree of that DLL. On Fri, Jun 3, 2011 at 3:47 PM, Piyush Sinha ecstasy.piy...@gmail.com wrote: Do the postorder traversal of the 2nd AVL tree and keep inserting the value in the 1st AVL tree.Simultaneously go on deleting the same node...I hope I am clear. On 6/3/11, Nate nate.archibal...@gmail.com wrote: Given a two balanced binary search trees.Merge both the trees so that it will form again a balanced binary search tree. -- 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. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. 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] Google
@Vipulwont this become the case of extra memory overhead??? On 6/3/11, Vipul Kumar vipul.k.r...@gmail.com wrote: convert the trees to DLL and then merge them to get the combined sorted DLL , now create the AVl tree of that DLL. On Fri, Jun 3, 2011 at 3:47 PM, Piyush Sinha ecstasy.piy...@gmail.com wrote: Do the postorder traversal of the 2nd AVL tree and keep inserting the value in the 1st AVL tree.Simultaneously go on deleting the same node...I hope I am clear. On 6/3/11, Nate nate.archibal...@gmail.com wrote: Given a two balanced binary search trees.Merge both the trees so that it will form again a balanced binary search tree. -- 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. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. 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. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. 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] Google
dude u have left right pointers in tree use those for next /back. On Fri, Jun 3, 2011 at 5:13 PM, Piyush Sinha ecstasy.piy...@gmail.com wrote: m talking in terms of pointers.. On 6/3/11, Vipul Kumar vipul.k.r...@gmail.com wrote: no,use the node of the tree as the node of the LL . On Fri, Jun 3, 2011 at 5:08 PM, Piyush Sinha ecstasy.piy...@gmail.com wrote: @Vipulwont this become the case of extra memory overhead??? On 6/3/11, Vipul Kumar vipul.k.r...@gmail.com wrote: convert the trees to DLL and then merge them to get the combined sorted DLL , now create the AVl tree of that DLL. On Fri, Jun 3, 2011 at 3:47 PM, Piyush Sinha ecstasy.piy...@gmail.com wrote: Do the postorder traversal of the 2nd AVL tree and keep inserting the value in the 1st AVL tree.Simultaneously go on deleting the same node...I hope I am clear. On 6/3/11, Nate nate.archibal...@gmail.com wrote: Given a two balanced binary search trees.Merge both the trees so that it will form again a balanced binary search tree. -- 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. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. 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. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. 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. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. 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] How to remove duplicate element from array in one pass.
C implementation: #include stdio.h int main() { char arr[100]=ash ;alsdfasf jahfjkjfhsakfjha; int i; int table[256] = {0}; int a; for(i = 0; i=10; i++) { // 'a ' store the ASCII value of arr[i] a = arr[i]; if (table[a] == 0) { table[a] = 1; printf(%c, arr[i]); } } printf(/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.
Re: [algogeeks] How to remove duplicate element from array in one pass.
How can we be sure that array elements are characters? They can be big number, strings or anything. On Fri, Jun 3, 2011 at 5:23 PM, Naveen Agrawal nav.coo...@gmail.com wrote: C implementation: #include stdio.h int main() { char arr[100]=ash ;alsdfasf jahfjkjfhsakfjha; int i; int table[256] = {0}; int a; for(i = 0; i=10; i++) { // 'a ' store the ASCII value of arr[i] a = arr[i]; if (table[a] == 0) { table[a] = 1; printf(%c, arr[i]); } } printf(/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. -- Cheers Naveen 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.
Re: [algogeeks] Google
Ok..sorry my bad.i confused it with something else... but still u need to make two traversals for each of the AVL treesisnt it?? On 6/3/11, Vipul Kumar vipul.k.r...@gmail.com wrote: dude u have left right pointers in tree use those for next /back. On Fri, Jun 3, 2011 at 5:13 PM, Piyush Sinha ecstasy.piy...@gmail.com wrote: m talking in terms of pointers.. On 6/3/11, Vipul Kumar vipul.k.r...@gmail.com wrote: no,use the node of the tree as the node of the LL . On Fri, Jun 3, 2011 at 5:08 PM, Piyush Sinha ecstasy.piy...@gmail.com wrote: @Vipulwont this become the case of extra memory overhead??? On 6/3/11, Vipul Kumar vipul.k.r...@gmail.com wrote: convert the trees to DLL and then merge them to get the combined sorted DLL , now create the AVl tree of that DLL. On Fri, Jun 3, 2011 at 3:47 PM, Piyush Sinha ecstasy.piy...@gmail.com wrote: Do the postorder traversal of the 2nd AVL tree and keep inserting the value in the 1st AVL tree.Simultaneously go on deleting the same node...I hope I am clear. On 6/3/11, Nate nate.archibal...@gmail.com wrote: Given a two balanced binary search trees.Merge both the trees so that it will form again a balanced binary search tree. -- 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. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. 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. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. 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. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. 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. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. 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] Google
yeah .. still complexity will be O(n) only far better then O(n^2) On Fri, Jun 3, 2011 at 5:27 PM, Piyush Sinha ecstasy.piy...@gmail.com wrote: Ok..sorry my bad.i confused it with something else... but still u need to make two traversals for each of the AVL treesisnt it?? On 6/3/11, Vipul Kumar vipul.k.r...@gmail.com wrote: dude u have left right pointers in tree use those for next /back. On Fri, Jun 3, 2011 at 5:13 PM, Piyush Sinha ecstasy.piy...@gmail.com wrote: m talking in terms of pointers.. On 6/3/11, Vipul Kumar vipul.k.r...@gmail.com wrote: no,use the node of the tree as the node of the LL . On Fri, Jun 3, 2011 at 5:08 PM, Piyush Sinha ecstasy.piy...@gmail.com wrote: @Vipulwont this become the case of extra memory overhead??? On 6/3/11, Vipul Kumar vipul.k.r...@gmail.com wrote: convert the trees to DLL and then merge them to get the combined sorted DLL , now create the AVl tree of that DLL. On Fri, Jun 3, 2011 at 3:47 PM, Piyush Sinha ecstasy.piy...@gmail.com wrote: Do the postorder traversal of the 2nd AVL tree and keep inserting the value in the 1st AVL tree.Simultaneously go on deleting the same node...I hope I am clear. On 6/3/11, Nate nate.archibal...@gmail.com wrote: Given a two balanced binary search trees.Merge both the trees so that it will form again a balanced binary search tree. -- 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. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. 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. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. 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. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. 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. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. 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
Re: [algogeeks] Google
ya true.nice solution...my bad On 6/3/11, Vipul Kumar vipul.k.r...@gmail.com wrote: yeah .. still complexity will be O(n) only far better then O(n^2) On Fri, Jun 3, 2011 at 5:27 PM, Piyush Sinha ecstasy.piy...@gmail.com wrote: Ok..sorry my bad.i confused it with something else... but still u need to make two traversals for each of the AVL treesisnt it?? On 6/3/11, Vipul Kumar vipul.k.r...@gmail.com wrote: dude u have left right pointers in tree use those for next /back. On Fri, Jun 3, 2011 at 5:13 PM, Piyush Sinha ecstasy.piy...@gmail.com wrote: m talking in terms of pointers.. On 6/3/11, Vipul Kumar vipul.k.r...@gmail.com wrote: no,use the node of the tree as the node of the LL . On Fri, Jun 3, 2011 at 5:08 PM, Piyush Sinha ecstasy.piy...@gmail.com wrote: @Vipulwont this become the case of extra memory overhead??? On 6/3/11, Vipul Kumar vipul.k.r...@gmail.com wrote: convert the trees to DLL and then merge them to get the combined sorted DLL , now create the AVl tree of that DLL. On Fri, Jun 3, 2011 at 3:47 PM, Piyush Sinha ecstasy.piy...@gmail.com wrote: Do the postorder traversal of the 2nd AVL tree and keep inserting the value in the 1st AVL tree.Simultaneously go on deleting the same node...I hope I am clear. On 6/3/11, Nate nate.archibal...@gmail.com wrote: Given a two balanced binary search trees.Merge both the trees so that it will form again a balanced binary search tree. -- 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. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. 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. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. 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. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. 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. -- *Piyush Sinha* *IIIT, Allahabad* *+91-8792136657* *+91-7483122727* *https://www.facebook.com/profile.php?id=10655377926 * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. 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
Re: [algogeeks] [brain teaser ] Life Or Death 3 june
yeah..sure bhavana's solution must be very best solution..but her calculation on probability is wrong ..it must .747 given by naveen.. On 6/3/11, deepak jakhar jakhar.deep...@gmail.com wrote: what r u discussing guys ? the ans. was clear in very first post by bhavana . @balaji dude why can't we use more science in choosing .. may be black marbels are slightly hotter than white's because they absorb light . or as it is question of life we better go for color sensors ...may be Hey man no offence i'm just kidding .. :) :) -- 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] SPOJ ETF
read topcoder tutotial http://www.topcoder.com/tc?module=Staticd1=tutorialsd2=primeNumbers hope will be useful On Fri, Jun 3, 2011 at 5:33 PM, kartik kartik.sac...@gmail.com wrote: what's worng in my code..why the judge is giving TLE.plzz help me out my code is # includestdio.h int main() { long long int phi[101]; long long int n=100,k,i,j; phi[1]=1; for ( i=2; i=n; ++i) phi[i]=i; for ( i=2; i=n; ++i) if (phi[i]==i) // prime for ( j=i; j=n; j+=i) phi[j]=phi[j]/i*(i-1); int t; scanf(%d,t); while(t--) { scanf(%lld,k); printf(%lld,phi[k]); } return 0; } -- 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] How to remove duplicate element from array in one pass.
@Naveen Kumar 1. For Python Implementation I have used string just for example. You can have a list(or array) . Then iterate it through each element of list instead of above implementation(iterating through each character of string) . Rest of the thing will remain same. 2. For C implementation If it is not string, then you have to use hash table(available in STL) as pointed out by sanjay ahuja -- 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] Re: Facebook
First of all i would like to describe the what an event it is.. so In computing an event is an action that is usually initiated outside the scope of a program and that is handled by a piece of code inside the program. I Would Like to Add Some Points modify the above algo so that it can be coded in multi-threaded environment.because once any one see this algo he will definitely ask whether your code is able to run in multi- threaded environment or not..?? because it might be possible in single minute several threads may initiates the event in parallel because there is no condition that is stopping thread to execute the common piece of program that can be shared b/w them as thread share common part of process. .so there is more chances to loss of integrity of data . hope you know race condition.Also a global variable can also create linking (external reference resolution ) problem in addition to global variable can be modified by any thread.at any time. so basically what i am talking about some kind of synchronization is needed above can can be re-implemented in multi-threaded environment to resolve above problem so that 1) we can Record all Events (For the sake of simplicity, treat the Event as an integer code) generated by threads 2) Return the number of Events recorded in the last one minute by all threads 3) Return the number of Events recorded in the last one hour by all threads. so these are the few points on which we can further discuss with interviewer to show him awareness about multi thread environment.the basic approach given by ankit is fine from my points of view with only overhead of shifting ?? for open ended question if we don't have enough space to store an event then we can divided the space required by event in multiples of memory available isn't it..?? Correct me if anything i explained seems to be wrong or if you wants to add something more. Thanks Shashank CSE BIT Mesra -- 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] Posts not going through to group
Hi In past I've posted around 6-7 messages to this group but only one or two of them made it. I am wondering what the issue is. I usually just use reply to all in order to reply. Anyone aware of any filtering google groups perform on its own? I am using web interface to post this message. -- 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] remove duplicate chars in a string without using extra memory
If you are not going to allow extra space, you have to compromise on time complexity..[?] If you dont have your string already stored in a trie/hashmap usage of it requires additional buffer. Simple solution would be: Sort given string using in-place sorting algorithm and then removal of duplicate characters becomes O(n). Total time complexity - O(nlogn) where n -- number of characters in the input string. On Thu, Jun 2, 2011 at 11:17 PM, Aakash Johari aakashj@gmail.comwrote: It was given that one or two extra variables are allowed. So I used a variable instead for mapping. It is simply mapping of each character in alphabet to a bit in the variable. On Thu, Jun 2, 2011 at 7:10 AM, Ashish Goel ashg...@gmail.com wrote: using bitmap, but extra memory not allowed? Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 On Thu, Jun 2, 2011 at 7:38 PM, Ashish Goel ashg...@gmail.com wrote: what is the logic, kindly explain Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 On Sat, May 28, 2011 at 12:23 PM, Aakash Johari aakashj@gmail.comwrote: Following code works for [A-Za-z], can be extended for whole character-set : #include stdio.h int main() { unsigned long long int a = 0; char str[50]; int i; scanf (%s, str); for ( i = 0; str[i]; i++ ) { if ( str[i] = 'A' str[i] = 'Z' ) { if ( (a (1ULL (str[i] - 'A'))) == 0 ) { a |= (1ULL (str[i] - 'A')); putchar (str[i]); } } else if ( str[i] = 'a' str[i] = 'z' ) { if ( (a (1ULL (str[i] - 'a' + 26))) == 0 ) { a |= (1ULL (str[i] - 'a' + 26)); putchar(str[i]); } } } return 0; } On Fri, May 27, 2011 at 11:15 PM, saurabh singh saurabh.n...@gmail.com wrote: string getStringWithoutDuplicateChars(string input) { create_empty_trie_ds (say trie) integer count = 0; for_each_char_in_string (say ch) { if(trie-contains(ch)) //if ch not there in ds then add it and return false otherwise return true { input.remove(count) } count++ } return input } On Sat, May 28, 2011 at 11:32 AM, Rajeev Kumar rajeevprasa...@gmail.com wrote: Design an algorithm and write code to remove the duplicate characters in a string without using any additional buffer. NOTE: One or two additional variables are fine. An extra copy of the array is not. -- 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. -- Thanks Regards, Saurabh -- 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. -- -Aakash Johari (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 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. -- -Aakash Johari (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 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. 33D.gif
[algogeeks]
How facebook stores all the user information? I am talking in terms of scalability, their spread servers, and how the friend information, common friends, etc is stored for a user? Can someone give me some explanation about this? -- 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] Re:
Also, is the database they use relational database? or is it cloud DB? On Fri, Jun 3, 2011 at 7:09 PM, Akshata Sharma akshatasharm...@gmail.comwrote: How facebook stores all the user information? I am talking in terms of scalability, their spread servers, and how the friend information, common friends, etc is stored for a user? Can someone give me some explanation about this? -- 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 Merge Problem
@Ashish: your solution is not O(N). I dont think you are taking advantage of the statement ( A and B need not be sorted in the end) @sravanreddy: excellent solution. On Thu, Jun 2, 2011 at 7:46 PM, Ashish Goel ashg...@gmail.com wrote: int i=lenA-1; int j=lenB-1; while (j=0) { if (A[i] B[j]) {swap(A[i] ,B[j]); sort(A); } j--; } Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 On Sat, May 28, 2011 at 11:09 PM, ross jagadish1...@gmail.com wrote: Hi all, Given 2 sorted arrays: A and B each holding n and m elements respectively,. Hence, total no. of elements = m+n Give an algorithm to place the smallest 'm' elements(out of the m+n total available) in A and the largest 'n' elements in B. ( A and B need not be sorted in the end) eg: A : 1 2 3 B: 0 1.5 4 5 9 Output: A can contain any combination of nos 0,1,1.5 and B should contain 2 3 4 5 9 (in any order.) Constraints: No extra space. Linear Time preferred -- 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:
Fb dont use relational dbs for sure.. they use MapReduce On Fri, Jun 3, 2011 at 7:14 PM, Akshata Sharma akshatasharm...@gmail.comwrote: Also, is the database they use relational database? or is it cloud DB? On Fri, Jun 3, 2011 at 7:09 PM, Akshata Sharma akshatasharm...@gmail.comwrote: How facebook stores all the user information? I am talking in terms of scalability, their spread servers, and how the friend information, common friends, etc is stored for a user? Can someone give me some explanation about this? -- 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. -- AKSHAY RASTOGI BE(Hons) CS BITS PILANI , Pilani -- 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:
MapReduce is not a db, its an framework right? On Fri, Jun 3, 2011 at 7:20 PM, Akshay Rastogi akr...@gmail.com wrote: Fb dont use relational dbs for sure.. they use MapReduce On Fri, Jun 3, 2011 at 7:14 PM, Akshata Sharma akshatasharm...@gmail.comwrote: Also, is the database they use relational database? or is it cloud DB? On Fri, Jun 3, 2011 at 7:09 PM, Akshata Sharma akshatasharm...@gmail.com wrote: How facebook stores all the user information? I am talking in terms of scalability, their spread servers, and how the friend information, common friends, etc is stored for a user? Can someone give me some explanation about this? -- 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. -- AKSHAY RASTOGI BE(Hons) CS BITS PILANI , Pilani -- 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]
Go to hell u spammer..[?] -- 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. 320.gif
Re: [algogeeks]
@Kunal: dude i am no spammer. That was just a joke. @Akshay: MapReduce just distributes your task on the cluster where each node does its assigned task, and the final result is obtained by mapping all the individual results. What does it has to do with dbs? On Fri, Jun 3, 2011 at 7:34 PM, Kunal Patil kp101...@gmail.com wrote: Go to hell u spammer..[?] -- 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. 320.gif
[algogeeks] HOT HOT HOT !!!! Oracle Specialist position in Miami Florida
Dear Professional, Hope you are doing well. I am a technical recruiter with Panzer Solutions LLC Software Implementing and IT consulting company located in CT. Please go through the Job Description and send me your updated resume with contact information. * Please reply at soh...@panzersolutions.com* * **HOT HOT HOT!!!* Title :Oracle Specialist Location :Miami Florida Duration :8 week contract Pay rate :$45 corp to corp Start Date:6.13.2011 ONLY ONE INTERVIEW ROUND MUST HAVES: Install Oracle 11g on servers Copy databases from legacy Oracles to the new Oracles Implement multiple instances on a given server Prepare multiple schemas on a given instance Secure instance based on corporate security guideline Implement departmental backup processes on servers Create oracle disaster recovery scripts Performing testing environment Thank you, Sohail Khan | Technical Recruiter Panzer Solutions LLc 45 Stuart Ave, K Norwalk, CT 06850 USA Voice: 203-813-2052 soh...@panzersolutions.com URL: www.panzersolutions.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] Re:
Everything that is entered into Facebook is sent to an isolated monastery in northern Europe where monks work all day and night to memorize incoming data. When a request for data comes in, it gets sent to the monastary and the monk responsible for remembering the information recites it to an operator that keys it in and sends it back. courtesy: stackoverflow :P On Fri, Jun 3, 2011 at 7:26 PM, Akshata Sharma akshatasharm...@gmail.comwrote: MapReduce is not a db, its an framework right? On Fri, Jun 3, 2011 at 7:20 PM, Akshay Rastogi akr...@gmail.com wrote: Fb dont use relational dbs for sure.. they use MapReduce On Fri, Jun 3, 2011 at 7:14 PM, Akshata Sharma akshatasharm...@gmail.com wrote: Also, is the database they use relational database? or is it cloud DB? On Fri, Jun 3, 2011 at 7:09 PM, Akshata Sharma akshatasharm...@gmail.com wrote: How facebook stores all the user information? I am talking in terms of scalability, their spread servers, and how the friend information, common friends, etc is stored for a user? Can someone give me some explanation about this? -- 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. -- AKSHAY RASTOGI BE(Hons) CS BITS PILANI , Pilani -- 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] Array Merge Problem
true did not read the question properly... Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 On Fri, Jun 3, 2011 at 7:19 PM, Kunal Patil kp101...@gmail.com wrote: @Ashish: your solution is not O(N). I dont think you are taking advantage of the statement ( A and B need not be sorted in the end) @sravanreddy: excellent solution. On Thu, Jun 2, 2011 at 7:46 PM, Ashish Goel ashg...@gmail.com wrote: int i=lenA-1; int j=lenB-1; while (j=0) { if (A[i] B[j]) {swap(A[i] ,B[j]); sort(A); } j--; } Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 On Sat, May 28, 2011 at 11:09 PM, ross jagadish1...@gmail.com wrote: Hi all, Given 2 sorted arrays: A and B each holding n and m elements respectively,. Hence, total no. of elements = m+n Give an algorithm to place the smallest 'm' elements(out of the m+n total available) in A and the largest 'n' elements in B. ( A and B need not be sorted in the end) eg: A : 1 2 3 B: 0 1.5 4 5 9 Output: A can contain any combination of nos 0,1,1.5 and B should contain 2 3 4 5 9 (in any order.) Constraints: No extra space. Linear Time preferred -- 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] Immediate Need for VM WARE SPECIALIST in Miami Florida
Dear Professional, Hope you are doing well. I am a technical recruiter with Panzer Solutions LLC Software Implementing and IT consulting company located in CT. Please go through the Job Description and send me your updated resume with contact information. * Please reply at soh...@panzersolutions.com* * **HOT HOT HOT!!!* Title : VM WARE SPECIALIST Location : Miami Florida Duration :8 week contract Start Date:6.13.2011 *ONLY ONE INTERVIEW ROUND * MUST HAVES: Upgrade Vcenter Upgrade VMware host to Vsphere Create second Vcenter for backup Configure VM Nodes to work in new upgraded environment Create Win2k8 virtual machines Create Linux Red Hat Virtual machines Create Virtual Desktop Infrastructure (VDI) View hosts and desktops Secure VMware hosts based on corporate security guidelines Implement departmental backup processes on servers Performing testing of environments. Thank you, Sohail Khan | Technical Recruiter Panzer Solutions LLc 45 Stuart Ave, K Norwalk, CT 06850 USA Voice: 203-813-2052 soh...@panzersolutions.com URL: www.panzersolutions.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] Windows Engineer // Miami Florida // 8 week contract
Dear Professional, Hope you are doing well. I am a technical recruiter with Panzer Solutions LLC Software Implementing and IT consulting company located in CT. Please go through the Job Description and send me your updated resume with contact information. * Please reply at soh...@panzersolutions.com* * **HOT HOT HOT!!! * Title : Windows Engineer Location : Miami Florida Duration :8 week contract Pay rate :$40 corp to corp Start Date:6.13.2011 ONLY ONE INTERVIEW ROUND WINDOWS 2008 Upgrade domain controllers from 2003-2008 Install windows 2008 server operating system Periodically install windows patches using Bigfix Install sophos antivirus on window servers Secure O/S based on corporate security guidelines Implement departmental backup processes on servers Performing testing of environment. Thank you, Sohail Khan | Technical Recruiter Panzer Solutions LLc 45 Stuart Ave, K Norwalk, CT 06850 USA Voice: 203-813-2052 soh...@panzersolutions.com URL: www.panzersolutions.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] Re: Array Merge Problem
@sravanreddy...logical bugs if A is size of n B is size m from your example assuming nm so if you want smallest m elements in A then u only capacity of n elements didn't allocate memory so these elements initialized by INT_MIN for m-n nodes so that array A can hold m smallest elements then what r u swapping u dude..isn't garbage value ?? you will get at 1st step only just run it ?? in you algo A_End=m-1(which 4th position in Array that DNE)..?? also you have to free memory for m-n in array B as it contains n largest elements . take A= 1,2,3 n=3 B= 0,1,4,5,9 m=5 after allocating memory to Array A for m-n elements A will looks likes 1 2 3 INT_Max INT_Max now what you wants A should contains m smallest elements B have n largest elements so O/P should be A=1,2,3,1,0 B=INT_Max,INT_Max,4,5,9 now free memory used by 1st elements in array B so that A will represent M smallest elements B will have n Largest elements so that above will work. Hope I am Correct let me know if any issue with explanation Thanks ShashankThe Best Way To Escape From The problem is To Solve It CSE,BIT Mesra -- 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] Google Question
How will you design a site similar to tinyurl.com? Simple hashing may require a lot of space, and collisions is another issue. Any other approch other than just hashing? -- 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] Google Question
Why to do hashing?? rather generate a unique id everytime... On Fri, Jun 3, 2011 at 9:50 PM, Nate nate.archibal...@gmail.com wrote: How will you design a site similar to tinyurl.com? Simple hashing may require a lot of space, and collisions is another issue. Any other approch other than just hashing? -- 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] A simple C question
Hi all, I am stuck with this code..Can anyone tell me how to implement semaphores in fork system call Code: #includestdio.h int signal(int *n); int wait(int *n); int main() { int n; n=0; if(fork()) { printf(Hello); signal(n); } else { wait(n); printf(World); } } int signal(int *n) { (*n)++; } int wait(int *n) { while((*n)=0); (*n)--; } Since parent process and child process will be having different address spaces...so change of n in one address space will not be visible to other.so please tell me how to make n visible to both the processes On Fri, Jun 3, 2011 at 2:45 PM, Subhransu subhransu.panigr...@gmail.comwrote: Here you go in C code http://codepad.org/gk6AZj0T int main() { if(printf(hello)!=0) { printf(world); } else { printf(SCREWED ! ! !); } return 0; } * * * * *Subhransu Panigrahi * *Mobile:* *+91-9840931538* *Email:* subhransu.panigr...@gmail.com On Fri, Jun 3, 2011 at 1:57 PM, Naveen Kumar naveenkumarve...@gmail.comwrote: Hi Shachindra, I don't think letters will be jumbled because we a calling one api to output on console tty's driver takes whole line and output it at once. On Fri, Jun 3, 2011 at 12:40 PM, Vishal Thanki vishaltha...@gmail.comwrote: @sachindra, @naveen, this was just a plain trick to execute if and else block. i agree with your concerns :) 2011/6/3 Vιиodh vinodh...@gmail.com: @vishal: can u explain the fork() solution?? On Fri, Jun 3, 2011 at 12:16 PM, Shachindra A C sachindr...@gmail.com wrote: There can be some synchronisation problems with fork() right? say world might get printed first...or maybe the letters can get jumbled too...We cannot guarantee the order of execution unless we use semaphores. On Fri, Jun 3, 2011 at 12:14 PM, Naveen Kumar naveenkumarve...@gmail.com wrote: oh yes, gud one On Fri, Jun 3, 2011 at 12:12 PM, Vishal Thanki vishaltha...@gmail.com wrote: vishal@ubuntu:~/progs/c\ 12:11:53 PM $ cat fork.c #include stdio.h #include stdlib.h int main() { if (fork()) { printf(hello ); } else { printf(world\n); } return 0; } vishal@ubuntu:~/progs/c\ 12:11:56 PM $ gcc fork.c vishal@ubuntu:~/progs/c\ 12:12:06 PM $ ./a.out hello world On Fri, Jun 3, 2011 at 12:09 PM, Naveen Kumar naveenkumarve...@gmail.com wrote: Hi Vishal, Can you show us how it be done with fork? On Fri, Jun 3, 2011 at 12:02 PM, Vishal Thanki vishaltha...@gmail.com wrote: can use fork() also.. On Fri, Jun 3, 2011 at 11:57 AM, anand karthik anandkarthik@gmail.com wrote: (!printf(Hello)) On Jun 3, 2011 11:52 AM, Arpit Mittal mrmittalro...@gmail.com wrote: Please help me in this question. What's the condition so that the following code prints both HelloWorld ! if condition printf (Hello); else printf(World); -- -Arpit Mittal 6th Semester, Indian Institute of Information Technology,Allahabad Email : arpitmittal.ii...@gmail.com rit2008...@iiita.ac.in Contact : +91-8853049787 Let every man be respected as an individual and no man idolized. -- 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. -- Cheers Naveen 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
Re: [algogeeks] Google Question
hashing for lookup. where key will be the tinyurl generated and value will be the actual url. We need to lookup the actual url everytime a client queries with a tinyurl. The question is how will you make this search faster. On Fri, Jun 3, 2011 at 10:17 PM, vaibhav agrawal agrvaib...@gmail.comwrote: Why to do hashing?? rather generate a unique id everytime... On Fri, Jun 3, 2011 at 9:50 PM, Nate nate.archibal...@gmail.com wrote: How will you design a site similar to tinyurl.com? Simple hashing may require a lot of space, and collisions is another issue. Any other approch other than just hashing? -- 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] Google Question
1. You are given the ‘downloads’ folder on a computer which may contain a number of files that are duplicates of each other. (these files are the same byte-wise but may have diff names) describe a method which identifies all duplicates in the least amount of time. 2. Now there are k computers each with 100 files. You need to determine efficiently the duplicates across all these computers. State the assumptions in terms of topology, connecting device etc. -- 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] A simple C question
@vishal plz help me in understanding fork function...how it is working.?? On Fri, Jun 3, 2011 at 9:58 AM, nitish goyal nitishgoy...@gmail.com wrote: Hi all, I am stuck with this code..Can anyone tell me how to implement semaphores in fork system call Code: #includestdio.h int signal(int *n); int wait(int *n); int main() { int n; n=0; if(fork()) { printf(Hello); signal(n); } else { wait(n); printf(World); } } int signal(int *n) { (*n)++; } int wait(int *n) { while((*n)=0); (*n)--; } Since parent process and child process will be having different address spaces...so change of n in one address space will not be visible to other.so please tell me how to make n visible to both the processes On Fri, Jun 3, 2011 at 2:45 PM, Subhransu subhransu.panigr...@gmail.comwrote: Here you go in C code http://codepad.org/gk6AZj0T int main() { if(printf(hello)!=0) { printf(world); } else { printf(SCREWED ! ! !); } return 0; } * * * * *Subhransu Panigrahi * *Mobile:* *+91-9840931538* *Email:* subhransu.panigr...@gmail.com On Fri, Jun 3, 2011 at 1:57 PM, Naveen Kumar naveenkumarve...@gmail.comwrote: Hi Shachindra, I don't think letters will be jumbled because we a calling one api to output on console tty's driver takes whole line and output it at once. On Fri, Jun 3, 2011 at 12:40 PM, Vishal Thanki vishaltha...@gmail.comwrote: @sachindra, @naveen, this was just a plain trick to execute if and else block. i agree with your concerns :) 2011/6/3 Vιиodh vinodh...@gmail.com: @vishal: can u explain the fork() solution?? On Fri, Jun 3, 2011 at 12:16 PM, Shachindra A C sachindr...@gmail.com wrote: There can be some synchronisation problems with fork() right? say world might get printed first...or maybe the letters can get jumbled too...We cannot guarantee the order of execution unless we use semaphores. On Fri, Jun 3, 2011 at 12:14 PM, Naveen Kumar naveenkumarve...@gmail.com wrote: oh yes, gud one On Fri, Jun 3, 2011 at 12:12 PM, Vishal Thanki vishaltha...@gmail.com wrote: vishal@ubuntu:~/progs/c\ 12:11:53 PM $ cat fork.c #include stdio.h #include stdlib.h int main() { if (fork()) { printf(hello ); } else { printf(world\n); } return 0; } vishal@ubuntu:~/progs/c\ 12:11:56 PM $ gcc fork.c vishal@ubuntu:~/progs/c\ 12:12:06 PM $ ./a.out hello world On Fri, Jun 3, 2011 at 12:09 PM, Naveen Kumar naveenkumarve...@gmail.com wrote: Hi Vishal, Can you show us how it be done with fork? On Fri, Jun 3, 2011 at 12:02 PM, Vishal Thanki vishaltha...@gmail.com wrote: can use fork() also.. On Fri, Jun 3, 2011 at 11:57 AM, anand karthik anandkarthik@gmail.com wrote: (!printf(Hello)) On Jun 3, 2011 11:52 AM, Arpit Mittal mrmittalro...@gmail.com wrote: Please help me in this question. What's the condition so that the following code prints both HelloWorld ! if condition printf (Hello); else printf(World); -- -Arpit Mittal 6th Semester, Indian Institute of Information Technology,Allahabad Email : arpitmittal.ii...@gmail.com rit2008...@iiita.ac.in Contact : +91-8853049787 Let every man be respected as an individual and no man idolized. -- 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. -- Cheers Naveen 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
Re: [algogeeks] A simple C question
While using fork(), child shares parent address space , Correct me If I am wrong .. On Fri, Jun 3, 2011 at 10:28 PM, nitish goyal nitishgoy...@gmail.com wrote: Hi all, I am stuck with this code..Can anyone tell me how to implement semaphores in fork system call Code: #includestdio.h int signal(int *n); int wait(int *n); int main() { int n; n=0; if(fork()) { printf(Hello); signal(n); } else { wait(n); printf(World); } } int signal(int *n) { (*n)++; } int wait(int *n) { while((*n)=0); (*n)--; } Since parent process and child process will be having different address spaces...so change of n in one address space will not be visible to other.so please tell me how to make n visible to both the processes On Fri, Jun 3, 2011 at 2:45 PM, Subhransu subhransu.panigr...@gmail.com wrote: Here you go in C code http://codepad.org/gk6AZj0T int main() { if(printf(hello)!=0) { printf(world); } else { printf(SCREWED ! ! !); } return 0; } Subhransu Panigrahi Mobile: +91-9840931538 Email: subhransu.panigr...@gmail.com On Fri, Jun 3, 2011 at 1:57 PM, Naveen Kumar naveenkumarve...@gmail.com wrote: Hi Shachindra, I don't think letters will be jumbled because we a calling one api to output on console tty's driver takes whole line and output it at once. On Fri, Jun 3, 2011 at 12:40 PM, Vishal Thanki vishaltha...@gmail.com wrote: @sachindra, @naveen, this was just a plain trick to execute if and else block. i agree with your concerns :) 2011/6/3 Vιиodh vinodh...@gmail.com: @vishal: can u explain the fork() solution?? On Fri, Jun 3, 2011 at 12:16 PM, Shachindra A C sachindr...@gmail.com wrote: There can be some synchronisation problems with fork() right? say world might get printed first...or maybe the letters can get jumbled too...We cannot guarantee the order of execution unless we use semaphores. On Fri, Jun 3, 2011 at 12:14 PM, Naveen Kumar naveenkumarve...@gmail.com wrote: oh yes, gud one On Fri, Jun 3, 2011 at 12:12 PM, Vishal Thanki vishaltha...@gmail.com wrote: vishal@ubuntu:~/progs/c\ 12:11:53 PM $ cat fork.c #include stdio.h #include stdlib.h int main() { if (fork()) { printf(hello ); } else { printf(world\n); } return 0; } vishal@ubuntu:~/progs/c\ 12:11:56 PM $ gcc fork.c vishal@ubuntu:~/progs/c\ 12:12:06 PM $ ./a.out hello world On Fri, Jun 3, 2011 at 12:09 PM, Naveen Kumar naveenkumarve...@gmail.com wrote: Hi Vishal, Can you show us how it be done with fork? On Fri, Jun 3, 2011 at 12:02 PM, Vishal Thanki vishaltha...@gmail.com wrote: can use fork() also.. On Fri, Jun 3, 2011 at 11:57 AM, anand karthik anandkarthik@gmail.com wrote: (!printf(Hello)) On Jun 3, 2011 11:52 AM, Arpit Mittal mrmittalro...@gmail.com wrote: Please help me in this question. What's the condition so that the following code prints both HelloWorld ! if condition printf (Hello); else printf(World); -- -Arpit Mittal 6th Semester, Indian Institute of Information Technology,Allahabad Email : arpitmittal.ii...@gmail.com rit2008...@iiita.ac.in Contact : +91-8853049787 Let every man be respected as an individual and no man idolized. -- 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. -- Cheers Naveen 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,
Re: [algogeeks] A simple C question
@ Lalit You are right. that's why i am saying how i can use semaphores in the above example On Fri, Jun 3, 2011 at 10:37 PM, LALIT SHARMA lks.ru...@gmail.com wrote: While using fork(), child shares parent address space , Correct me If I am wrong .. On Fri, Jun 3, 2011 at 10:28 PM, nitish goyal nitishgoy...@gmail.com wrote: Hi all, I am stuck with this code..Can anyone tell me how to implement semaphores in fork system call Code: #includestdio.h int signal(int *n); int wait(int *n); int main() { int n; n=0; if(fork()) { printf(Hello); signal(n); } else { wait(n); printf(World); } } int signal(int *n) { (*n)++; } int wait(int *n) { while((*n)=0); (*n)--; } Since parent process and child process will be having different address spaces...so change of n in one address space will not be visible to other.so please tell me how to make n visible to both the processes On Fri, Jun 3, 2011 at 2:45 PM, Subhransu subhransu.panigr...@gmail.com wrote: Here you go in C code http://codepad.org/gk6AZj0T int main() { if(printf(hello)!=0) { printf(world); } else { printf(SCREWED ! ! !); } return 0; } Subhransu Panigrahi Mobile: +91-9840931538 Email: subhransu.panigr...@gmail.com On Fri, Jun 3, 2011 at 1:57 PM, Naveen Kumar naveenkumarve...@gmail.com wrote: Hi Shachindra, I don't think letters will be jumbled because we a calling one api to output on console tty's driver takes whole line and output it at once. On Fri, Jun 3, 2011 at 12:40 PM, Vishal Thanki vishaltha...@gmail.com wrote: @sachindra, @naveen, this was just a plain trick to execute if and else block. i agree with your concerns :) 2011/6/3 Vιиodh vinodh...@gmail.com: @vishal: can u explain the fork() solution?? On Fri, Jun 3, 2011 at 12:16 PM, Shachindra A C sachindr...@gmail.com wrote: There can be some synchronisation problems with fork() right? say world might get printed first...or maybe the letters can get jumbled too...We cannot guarantee the order of execution unless we use semaphores. On Fri, Jun 3, 2011 at 12:14 PM, Naveen Kumar naveenkumarve...@gmail.com wrote: oh yes, gud one On Fri, Jun 3, 2011 at 12:12 PM, Vishal Thanki vishaltha...@gmail.com wrote: vishal@ubuntu:~/progs/c\ 12:11:53 PM $ cat fork.c #include stdio.h #include stdlib.h int main() { if (fork()) { printf(hello ); } else { printf(world\n); } return 0; } vishal@ubuntu:~/progs/c\ 12:11:56 PM $ gcc fork.c vishal@ubuntu:~/progs/c\ 12:12:06 PM $ ./a.out hello world On Fri, Jun 3, 2011 at 12:09 PM, Naveen Kumar naveenkumarve...@gmail.com wrote: Hi Vishal, Can you show us how it be done with fork? On Fri, Jun 3, 2011 at 12:02 PM, Vishal Thanki vishaltha...@gmail.com wrote: can use fork() also.. On Fri, Jun 3, 2011 at 11:57 AM, anand karthik anandkarthik@gmail.com wrote: (!printf(Hello)) On Jun 3, 2011 11:52 AM, Arpit Mittal mrmittalro...@gmail.com wrote: Please help me in this question. What's the condition so that the following code prints both HelloWorld ! if condition printf (Hello); else printf(World); -- -Arpit Mittal 6th Semester, Indian Institute of Information Technology,Allahabad Email : arpitmittal.ii...@gmail.com rit2008...@iiita.ac.in Contact : +91-8853049787 Let every man be respected as an individual and no man idolized. -- 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
Re: [algogeeks] A simple C question
Process don't share address space when forked. On Fri, Jun 3, 2011 at 10:40 PM, nitish goyal nitishgoy...@gmail.comwrote: @ Lalit You are right. that's why i am saying how i can use semaphores in the above example On Fri, Jun 3, 2011 at 10:37 PM, LALIT SHARMA lks.ru...@gmail.com wrote: While using fork(), child shares parent address space , Correct me If I am wrong .. On Fri, Jun 3, 2011 at 10:28 PM, nitish goyal nitishgoy...@gmail.com wrote: Hi all, I am stuck with this code..Can anyone tell me how to implement semaphores in fork system call Code: #includestdio.h int signal(int *n); int wait(int *n); int main() { int n; n=0; if(fork()) { printf(Hello); signal(n); } else { wait(n); printf(World); } } int signal(int *n) { (*n)++; } int wait(int *n) { while((*n)=0); (*n)--; } Since parent process and child process will be having different address spaces...so change of n in one address space will not be visible to other.so please tell me how to make n visible to both the processes On Fri, Jun 3, 2011 at 2:45 PM, Subhransu subhransu.panigr...@gmail.com wrote: Here you go in C code http://codepad.org/gk6AZj0T int main() { if(printf(hello)!=0) { printf(world); } else { printf(SCREWED ! ! !); } return 0; } Subhransu Panigrahi Mobile: +91-9840931538 Email: subhransu.panigr...@gmail.com On Fri, Jun 3, 2011 at 1:57 PM, Naveen Kumar naveenkumarve...@gmail.com wrote: Hi Shachindra, I don't think letters will be jumbled because we a calling one api to output on console tty's driver takes whole line and output it at once. On Fri, Jun 3, 2011 at 12:40 PM, Vishal Thanki vishaltha...@gmail.com wrote: @sachindra, @naveen, this was just a plain trick to execute if and else block. i agree with your concerns :) 2011/6/3 Vιиodh vinodh...@gmail.com: @vishal: can u explain the fork() solution?? On Fri, Jun 3, 2011 at 12:16 PM, Shachindra A C sachindr...@gmail.com wrote: There can be some synchronisation problems with fork() right? say world might get printed first...or maybe the letters can get jumbled too...We cannot guarantee the order of execution unless we use semaphores. On Fri, Jun 3, 2011 at 12:14 PM, Naveen Kumar naveenkumarve...@gmail.com wrote: oh yes, gud one On Fri, Jun 3, 2011 at 12:12 PM, Vishal Thanki vishaltha...@gmail.com wrote: vishal@ubuntu:~/progs/c\ 12:11:53 PM $ cat fork.c #include stdio.h #include stdlib.h int main() { if (fork()) { printf(hello ); } else { printf(world\n); } return 0; } vishal@ubuntu:~/progs/c\ 12:11:56 PM $ gcc fork.c vishal@ubuntu:~/progs/c\ 12:12:06 PM $ ./a.out hello world On Fri, Jun 3, 2011 at 12:09 PM, Naveen Kumar naveenkumarve...@gmail.com wrote: Hi Vishal, Can you show us how it be done with fork? On Fri, Jun 3, 2011 at 12:02 PM, Vishal Thanki vishaltha...@gmail.com wrote: can use fork() also.. On Fri, Jun 3, 2011 at 11:57 AM, anand karthik anandkarthik@gmail.com wrote: (!printf(Hello)) On Jun 3, 2011 11:52 AM, Arpit Mittal mrmittalro...@gmail.com wrote: Please help me in this question. What's the condition so that the following code prints both HelloWorld ! if condition printf (Hello); else printf(World); -- -Arpit Mittal 6th Semester, Indian Institute of Information Technology,Allahabad Email : arpitmittal.ii...@gmail.com rit2008...@iiita.ac.in Contact : +91-8853049787 Let every man be respected as an individual and no man idolized. -- 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
[algogeeks] HOT HOT HOT!!! SAP BW Consultant position in Florida
Dear Professional, Hope you are doing well. I am a technical recruiter with Panzer Solutions LLC Software Implementing and IT consulting company located in CT. Please go through the Job Description and send me your updated resume with contact information. *Please reply at soh...@panzersolutions.com * * **HOT HOT HOT!!!* Title : SAP BW Consultant Location : Florida Duration : 3 months contract to hire GREEN CARD / EAD / Citizen They want them to start ASAP and will interview tomorrow or Friday. 3 month contract at FPL, must be willing to allow FPL to sponsor them after 3 months. Description Develop guidelines, processes, and procedures governing enterprise-wide data collection and BI implementation Translate business requirements into system design specification for new applications into BI Develop OLAP cubes, metadata models, metrics, SDK reports and queries Optimize the data environment in order to efficiently access enterprise data as well as develop and provide internal application metrics Integrate data sources to develop data marts Provide effective support throughout the development life cycle Develop and implement data naming conventions and documentation for enterprise system planning as well as enhancements of the BI tools. Develop and implement specialized training for effective use of data and reporting resources Act as technical resource to database administrators, data warehouse administrators and application developers on access to and use of data End user support which includes resolving reporting issues, training and general support Develop standards for dealing with ad hoc reporting and ensure compliance throughout the user community Participate in the creation and maintenance of data dictionary, and reporting standards Experience in SAP BW Bex Query Development, Dashboards and multiproviders Must have strong experience / skills in tuning data warehouse objects and a BI landscape Use variety of tools including Business Objects and techniques to merge data across multiple environments and systems Experience in process / document flow reporting Accurately estimate work efforts and time estimates Develop and manage work plans Experience with SAP ECC, esp MM and FI highly desirable SAP BW certification a plus PMI certification desired Qualifications Bachelors degree in Business, Computer Science or related area At least Five (5) years experience developing and implementing SAP BW business reporting requirements Experience designing / tuning infocubes, multiproviders, DSO’s, and developing transfer and update rules Thank you, Sohail Khan | Technical Recruiter Panzer Solutions LLc 45 Stuart Ave, K Norwalk, CT 06850 USA Voice: 203-813-2052 soh...@panzersolutions.com URL: www.panzersolutions.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] Functional SAP BA - FICO // Tennessee // 3+ months contract
Dear Professional, Hope you are doing well. I am a technical recruiter with Panzer Solutions LLC Software Implementing and IT consulting company located in CT. Please go through the Job Description and send me your updated resume with contact information. *Please reply at soh...@panzersolutions.com * * **HOT HOT HOT!!!* Title : Functional SAP BA - FICO Location : Nashville, Tennessee Duration : 3+ months contract Business Analyst that can complete research in order to accurately and timely document assigned functional specs, containing business requirements, business rules data mapping. This includes SAP system integration in the following areas: Logistics (SAP integration with TMS WMS) MDD/TDD (Master Transactional data movements) Material Master They want heavy reporting and inventory mgmt Thank you, Sohail Khan | Technical Recruiter Panzer Solutions LLc 45 Stuart Ave, K Norwalk, CT 06850 USA Voice: 203-813-2052 soh...@panzersolutions.com URL: www.panzersolutions.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] A simple C question
i mean why both the if else statements are working by using fork ? On Fri, Jun 3, 2011 at 10:20 AM, Naveen Kumar naveenkumarve...@gmail.comwrote: Process don't share address space when forked. On Fri, Jun 3, 2011 at 10:40 PM, nitish goyal nitishgoy...@gmail.comwrote: @ Lalit You are right. that's why i am saying how i can use semaphores in the above example On Fri, Jun 3, 2011 at 10:37 PM, LALIT SHARMA lks.ru...@gmail.comwrote: While using fork(), child shares parent address space , Correct me If I am wrong .. On Fri, Jun 3, 2011 at 10:28 PM, nitish goyal nitishgoy...@gmail.com wrote: Hi all, I am stuck with this code..Can anyone tell me how to implement semaphores in fork system call Code: #includestdio.h int signal(int *n); int wait(int *n); int main() { int n; n=0; if(fork()) { printf(Hello); signal(n); } else { wait(n); printf(World); } } int signal(int *n) { (*n)++; } int wait(int *n) { while((*n)=0); (*n)--; } Since parent process and child process will be having different address spaces...so change of n in one address space will not be visible to other.so please tell me how to make n visible to both the processes On Fri, Jun 3, 2011 at 2:45 PM, Subhransu subhransu.panigr...@gmail.com wrote: Here you go in C code http://codepad.org/gk6AZj0T int main() { if(printf(hello)!=0) { printf(world); } else { printf(SCREWED ! ! !); } return 0; } Subhransu Panigrahi Mobile: +91-9840931538 Email: subhransu.panigr...@gmail.com On Fri, Jun 3, 2011 at 1:57 PM, Naveen Kumar naveenkumarve...@gmail.com wrote: Hi Shachindra, I don't think letters will be jumbled because we a calling one api to output on console tty's driver takes whole line and output it at once. On Fri, Jun 3, 2011 at 12:40 PM, Vishal Thanki vishaltha...@gmail.com wrote: @sachindra, @naveen, this was just a plain trick to execute if and else block. i agree with your concerns :) 2011/6/3 Vιиodh vinodh...@gmail.com: @vishal: can u explain the fork() solution?? On Fri, Jun 3, 2011 at 12:16 PM, Shachindra A C sachindr...@gmail.com wrote: There can be some synchronisation problems with fork() right? say world might get printed first...or maybe the letters can get jumbled too...We cannot guarantee the order of execution unless we use semaphores. On Fri, Jun 3, 2011 at 12:14 PM, Naveen Kumar naveenkumarve...@gmail.com wrote: oh yes, gud one On Fri, Jun 3, 2011 at 12:12 PM, Vishal Thanki vishaltha...@gmail.com wrote: vishal@ubuntu:~/progs/c\ 12:11:53 PM $ cat fork.c #include stdio.h #include stdlib.h int main() { if (fork()) { printf(hello ); } else { printf(world\n); } return 0; } vishal@ubuntu:~/progs/c\ 12:11:56 PM $ gcc fork.c vishal@ubuntu:~/progs/c\ 12:12:06 PM $ ./a.out hello world On Fri, Jun 3, 2011 at 12:09 PM, Naveen Kumar naveenkumarve...@gmail.com wrote: Hi Vishal, Can you show us how it be done with fork? On Fri, Jun 3, 2011 at 12:02 PM, Vishal Thanki vishaltha...@gmail.com wrote: can use fork() also.. On Fri, Jun 3, 2011 at 11:57 AM, anand karthik anandkarthik@gmail.com wrote: (!printf(Hello)) On Jun 3, 2011 11:52 AM, Arpit Mittal mrmittalro...@gmail.com wrote: Please help me in this question. What's the condition so that the following code prints both HelloWorld ! if condition printf (Hello); else printf(World); -- -Arpit Mittal 6th Semester, Indian Institute of Information Technology,Allahabad Email : arpitmittal.ii...@gmail.com rit2008...@iiita.ac.in Contact : +91-8853049787 Let every man be respected as an individual and no man idolized. -- 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
Re: [algogeeks] A simple C question
when we fork a new process, parent gets the PID of the chid as return value and child will get 0 as return value. Same address space is copied and both of them start executing this program in their own address space. In Modern OSes 99% of the time child comes first so child process is execute else part and parent will execute if place. On Fri, Jun 3, 2011 at 10:58 PM, nicks crazy.logic.k...@gmail.com wrote: i mean why both the if else statements are working by using fork ? On Fri, Jun 3, 2011 at 10:20 AM, Naveen Kumar naveenkumarve...@gmail.comwrote: Process don't share address space when forked. On Fri, Jun 3, 2011 at 10:40 PM, nitish goyal nitishgoy...@gmail.comwrote: @ Lalit You are right. that's why i am saying how i can use semaphores in the above example On Fri, Jun 3, 2011 at 10:37 PM, LALIT SHARMA lks.ru...@gmail.comwrote: While using fork(), child shares parent address space , Correct me If I am wrong .. On Fri, Jun 3, 2011 at 10:28 PM, nitish goyal nitishgoy...@gmail.com wrote: Hi all, I am stuck with this code..Can anyone tell me how to implement semaphores in fork system call Code: #includestdio.h int signal(int *n); int wait(int *n); int main() { int n; n=0; if(fork()) { printf(Hello); signal(n); } else { wait(n); printf(World); } } int signal(int *n) { (*n)++; } int wait(int *n) { while((*n)=0); (*n)--; } Since parent process and child process will be having different address spaces...so change of n in one address space will not be visible to other.so please tell me how to make n visible to both the processes On Fri, Jun 3, 2011 at 2:45 PM, Subhransu subhransu.panigr...@gmail.com wrote: Here you go in C code http://codepad.org/gk6AZj0T int main() { if(printf(hello)!=0) { printf(world); } else { printf(SCREWED ! ! !); } return 0; } Subhransu Panigrahi Mobile: +91-9840931538 Email: subhransu.panigr...@gmail.com On Fri, Jun 3, 2011 at 1:57 PM, Naveen Kumar naveenkumarve...@gmail.com wrote: Hi Shachindra, I don't think letters will be jumbled because we a calling one api to output on console tty's driver takes whole line and output it at once. On Fri, Jun 3, 2011 at 12:40 PM, Vishal Thanki vishaltha...@gmail.com wrote: @sachindra, @naveen, this was just a plain trick to execute if and else block. i agree with your concerns :) 2011/6/3 Vιиodh vinodh...@gmail.com: @vishal: can u explain the fork() solution?? On Fri, Jun 3, 2011 at 12:16 PM, Shachindra A C sachindr...@gmail.com wrote: There can be some synchronisation problems with fork() right? say world might get printed first...or maybe the letters can get jumbled too...We cannot guarantee the order of execution unless we use semaphores. On Fri, Jun 3, 2011 at 12:14 PM, Naveen Kumar naveenkumarve...@gmail.com wrote: oh yes, gud one On Fri, Jun 3, 2011 at 12:12 PM, Vishal Thanki vishaltha...@gmail.com wrote: vishal@ubuntu:~/progs/c\ 12:11:53 PM $ cat fork.c #include stdio.h #include stdlib.h int main() { if (fork()) { printf(hello ); } else { printf(world\n); } return 0; } vishal@ubuntu:~/progs/c\ 12:11:56 PM $ gcc fork.c vishal@ubuntu:~/progs/c\ 12:12:06 PM $ ./a.out hello world On Fri, Jun 3, 2011 at 12:09 PM, Naveen Kumar naveenkumarve...@gmail.com wrote: Hi Vishal, Can you show us how it be done with fork? On Fri, Jun 3, 2011 at 12:02 PM, Vishal Thanki vishaltha...@gmail.com wrote: can use fork() also.. On Fri, Jun 3, 2011 at 11:57 AM, anand karthik anandkarthik@gmail.com wrote: (!printf(Hello)) On Jun 3, 2011 11:52 AM, Arpit Mittal mrmittalro...@gmail.com wrote: Please help me in this question. What's the condition so that the following code prints both HelloWorld ! if condition printf (Hello); else printf(World); -- -Arpit Mittal 6th Semester, Indian Institute of Information Technology,Allahabad Email : arpitmittal.ii...@gmail.com rit2008...@iiita.ac.in Contact : +91-8853049787 Let every man be respected as an individual and no man idolized. -- 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
Re: [algogeeks] A simple C question
@naveen.. thanks...i got it finally :) On Fri, Jun 3, 2011 at 10:35 AM, Naveen Kumar naveenkumarve...@gmail.comwrote: when we fork a new process, parent gets the PID of the chid as return value and child will get 0 as return value. Same address space is copied and both of them start executing this program in their own address space. In Modern OSes 99% of the time child comes first so child process is execute else part and parent will execute if place. On Fri, Jun 3, 2011 at 10:58 PM, nicks crazy.logic.k...@gmail.com wrote: i mean why both the if else statements are working by using fork ? On Fri, Jun 3, 2011 at 10:20 AM, Naveen Kumar naveenkumarve...@gmail.com wrote: Process don't share address space when forked. On Fri, Jun 3, 2011 at 10:40 PM, nitish goyal nitishgoy...@gmail.comwrote: @ Lalit You are right. that's why i am saying how i can use semaphores in the above example On Fri, Jun 3, 2011 at 10:37 PM, LALIT SHARMA lks.ru...@gmail.comwrote: While using fork(), child shares parent address space , Correct me If I am wrong .. On Fri, Jun 3, 2011 at 10:28 PM, nitish goyal nitishgoy...@gmail.com wrote: Hi all, I am stuck with this code..Can anyone tell me how to implement semaphores in fork system call Code: #includestdio.h int signal(int *n); int wait(int *n); int main() { int n; n=0; if(fork()) { printf(Hello); signal(n); } else { wait(n); printf(World); } } int signal(int *n) { (*n)++; } int wait(int *n) { while((*n)=0); (*n)--; } Since parent process and child process will be having different address spaces...so change of n in one address space will not be visible to other.so please tell me how to make n visible to both the processes On Fri, Jun 3, 2011 at 2:45 PM, Subhransu subhransu.panigr...@gmail.com wrote: Here you go in C code http://codepad.org/gk6AZj0T int main() { if(printf(hello)!=0) { printf(world); } else { printf(SCREWED ! ! !); } return 0; } Subhransu Panigrahi Mobile: +91-9840931538 Email: subhransu.panigr...@gmail.com On Fri, Jun 3, 2011 at 1:57 PM, Naveen Kumar naveenkumarve...@gmail.com wrote: Hi Shachindra, I don't think letters will be jumbled because we a calling one api to output on console tty's driver takes whole line and output it at once. On Fri, Jun 3, 2011 at 12:40 PM, Vishal Thanki vishaltha...@gmail.com wrote: @sachindra, @naveen, this was just a plain trick to execute if and else block. i agree with your concerns :) 2011/6/3 Vιиodh vinodh...@gmail.com: @vishal: can u explain the fork() solution?? On Fri, Jun 3, 2011 at 12:16 PM, Shachindra A C sachindr...@gmail.com wrote: There can be some synchronisation problems with fork() right? say world might get printed first...or maybe the letters can get jumbled too...We cannot guarantee the order of execution unless we use semaphores. On Fri, Jun 3, 2011 at 12:14 PM, Naveen Kumar naveenkumarve...@gmail.com wrote: oh yes, gud one On Fri, Jun 3, 2011 at 12:12 PM, Vishal Thanki vishaltha...@gmail.com wrote: vishal@ubuntu:~/progs/c\ 12:11:53 PM $ cat fork.c #include stdio.h #include stdlib.h int main() { if (fork()) { printf(hello ); } else { printf(world\n); } return 0; } vishal@ubuntu:~/progs/c\ 12:11:56 PM $ gcc fork.c vishal@ubuntu:~/progs/c\ 12:12:06 PM $ ./a.out hello world On Fri, Jun 3, 2011 at 12:09 PM, Naveen Kumar naveenkumarve...@gmail.com wrote: Hi Vishal, Can you show us how it be done with fork? On Fri, Jun 3, 2011 at 12:02 PM, Vishal Thanki vishaltha...@gmail.com wrote: can use fork() also.. On Fri, Jun 3, 2011 at 11:57 AM, anand karthik anandkarthik@gmail.com wrote: (!printf(Hello)) On Jun 3, 2011 11:52 AM, Arpit Mittal mrmittalro...@gmail.com wrote: Please help me in this question. What's the condition so that the following code prints both HelloWorld ! if condition printf (Hello); else printf(World); -- -Arpit Mittal 6th Semester, Indian Institute of Information Technology,Allahabad Email : arpitmittal.ii...@gmail.com rit2008...@iiita.ac.in Contact : +91-8853049787 Let every man be respected as an individual and no man idolized. -- 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] A simple C question
But if i have to make sure that hello should be printed first, then i have to apply synchronization. please answer my question. how we can semaphores over here On Fri, Jun 3, 2011 at 11:26 PM, nicks crazy.logic.k...@gmail.com wrote: @naveen.. thanks...i got it finally :) On Fri, Jun 3, 2011 at 10:35 AM, Naveen Kumar naveenkumarve...@gmail.comwrote: when we fork a new process, parent gets the PID of the chid as return value and child will get 0 as return value. Same address space is copied and both of them start executing this program in their own address space. In Modern OSes 99% of the time child comes first so child process is execute else part and parent will execute if place. On Fri, Jun 3, 2011 at 10:58 PM, nicks crazy.logic.k...@gmail.comwrote: i mean why both the if else statements are working by using fork ? On Fri, Jun 3, 2011 at 10:20 AM, Naveen Kumar naveenkumarve...@gmail.com wrote: Process don't share address space when forked. On Fri, Jun 3, 2011 at 10:40 PM, nitish goyal nitishgoy...@gmail.comwrote: @ Lalit You are right. that's why i am saying how i can use semaphores in the above example On Fri, Jun 3, 2011 at 10:37 PM, LALIT SHARMA lks.ru...@gmail.comwrote: While using fork(), child shares parent address space , Correct me If I am wrong .. On Fri, Jun 3, 2011 at 10:28 PM, nitish goyal nitishgoy...@gmail.com wrote: Hi all, I am stuck with this code..Can anyone tell me how to implement semaphores in fork system call Code: #includestdio.h int signal(int *n); int wait(int *n); int main() { int n; n=0; if(fork()) { printf(Hello); signal(n); } else { wait(n); printf(World); } } int signal(int *n) { (*n)++; } int wait(int *n) { while((*n)=0); (*n)--; } Since parent process and child process will be having different address spaces...so change of n in one address space will not be visible to other.so please tell me how to make n visible to both the processes On Fri, Jun 3, 2011 at 2:45 PM, Subhransu subhransu.panigr...@gmail.com wrote: Here you go in C code http://codepad.org/gk6AZj0T int main() { if(printf(hello)!=0) { printf(world); } else { printf(SCREWED ! ! !); } return 0; } Subhransu Panigrahi Mobile: +91-9840931538 Email: subhransu.panigr...@gmail.com On Fri, Jun 3, 2011 at 1:57 PM, Naveen Kumar naveenkumarve...@gmail.com wrote: Hi Shachindra, I don't think letters will be jumbled because we a calling one api to output on console tty's driver takes whole line and output it at once. On Fri, Jun 3, 2011 at 12:40 PM, Vishal Thanki vishaltha...@gmail.com wrote: @sachindra, @naveen, this was just a plain trick to execute if and else block. i agree with your concerns :) 2011/6/3 Vιиodh vinodh...@gmail.com: @vishal: can u explain the fork() solution?? On Fri, Jun 3, 2011 at 12:16 PM, Shachindra A C sachindr...@gmail.com wrote: There can be some synchronisation problems with fork() right? say world might get printed first...or maybe the letters can get jumbled too...We cannot guarantee the order of execution unless we use semaphores. On Fri, Jun 3, 2011 at 12:14 PM, Naveen Kumar naveenkumarve...@gmail.com wrote: oh yes, gud one On Fri, Jun 3, 2011 at 12:12 PM, Vishal Thanki vishaltha...@gmail.com wrote: vishal@ubuntu:~/progs/c\ 12:11:53 PM $ cat fork.c #include stdio.h #include stdlib.h int main() { if (fork()) { printf(hello ); } else { printf(world\n); } return 0; } vishal@ubuntu:~/progs/c\ 12:11:56 PM $ gcc fork.c vishal@ubuntu:~/progs/c\ 12:12:06 PM $ ./a.out hello world On Fri, Jun 3, 2011 at 12:09 PM, Naveen Kumar naveenkumarve...@gmail.com wrote: Hi Vishal, Can you show us how it be done with fork? On Fri, Jun 3, 2011 at 12:02 PM, Vishal Thanki vishaltha...@gmail.com wrote: can use fork() also.. On Fri, Jun 3, 2011 at 11:57 AM, anand karthik anandkarthik@gmail.com wrote: (!printf(Hello)) On Jun 3, 2011 11:52 AM, Arpit Mittal mrmittalro...@gmail.com wrote: Please help me in this question. What's the condition so that the following code prints both HelloWorld ! if condition printf (Hello); else printf(World); -- -Arpit Mittal 6th Semester, Indian Institute of Information Technology,Allahabad Email : arpitmittal.ii...@gmail.com rit2008...@iiita.ac.in Contact : +91-8853049787 Let every man be respected as an individual and no man idolized. -- You received this message because you are subscribed
Re: [algogeeks] Google Question
regarding doenloads folder..tiger tree hash(TTH) as we use it in file sharing (DC++) might help look this - http://www.dslreports.com/faq/9677 Once DC++ hashes all of your share (yes, this *will* take a while), it will only hash new files. The hashing thread in DC++ is set to low priority, so it shouldn't interfere too badly. There are several benefits of file hashing: No longer does one need to pay attention to the name of the file when looking for alternative sources. If the files are the same, they will have the same hash and can thus be chosen as an alternative source. Just because two files are the exact same size does *not* mean they are the same bitwise! On Fri, Jun 3, 2011 at 10:01 AM, Nate Archibald nate.archibal...@gmail.comwrote: hashing for lookup. where key will be the tinyurl generated and value will be the actual url. We need to lookup the actual url everytime a client queries with a tinyurl. The question is how will you make this search faster. On Fri, Jun 3, 2011 at 10:17 PM, vaibhav agrawal agrvaib...@gmail.comwrote: Why to do hashing?? rather generate a unique id everytime... On Fri, Jun 3, 2011 at 9:50 PM, Nate nate.archibal...@gmail.com wrote: How will you design a site similar to tinyurl.com? Simple hashing may require a lot of space, and collisions is another issue. Any other approch other than just hashing? -- 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] A simple C question
to use the semaphores, you have to allocate them using shared memory. as once you call fork(), both the process will have their own data, so the semaphores allocated in parent will differ from child. you can have a shared memory (man shmget) to allocate semaphores and use it.. btw, i think we are missing the essence of the question here. the code needs a condition so that both if and else gets executed. the printf(hello) and printf(world) are just instructions in both the code. the order doesn't matter when you have both the code executed. On Fri, Jun 3, 2011 at 11:55 PM, nitish goyal nitishgoy...@gmail.com wrote: But if i have to make sure that hello should be printed first, then i have to apply synchronization. please answer my question. how we can semaphores over here On Fri, Jun 3, 2011 at 11:26 PM, nicks crazy.logic.k...@gmail.com wrote: @naveen.. thanks...i got it finally :) On Fri, Jun 3, 2011 at 10:35 AM, Naveen Kumar naveenkumarve...@gmail.com wrote: when we fork a new process, parent gets the PID of the chid as return value and child will get 0 as return value. Same address space is copied and both of them start executing this program in their own address space. In Modern OSes 99% of the time child comes first so child process is execute else part and parent will execute if place. On Fri, Jun 3, 2011 at 10:58 PM, nicks crazy.logic.k...@gmail.com wrote: i mean why both the if else statements are working by using fork ? On Fri, Jun 3, 2011 at 10:20 AM, Naveen Kumar naveenkumarve...@gmail.com wrote: Process don't share address space when forked. On Fri, Jun 3, 2011 at 10:40 PM, nitish goyal nitishgoy...@gmail.com wrote: @ Lalit You are right. that's why i am saying how i can use semaphores in the above example On Fri, Jun 3, 2011 at 10:37 PM, LALIT SHARMA lks.ru...@gmail.com wrote: While using fork(), child shares parent address space , Correct me If I am wrong .. On Fri, Jun 3, 2011 at 10:28 PM, nitish goyal nitishgoy...@gmail.com wrote: Hi all, I am stuck with this code..Can anyone tell me how to implement semaphores in fork system call Code: #includestdio.h int signal(int *n); int wait(int *n); int main() { int n; n=0; if(fork()) { printf(Hello); signal(n); } else { wait(n); printf(World); } } int signal(int *n) { (*n)++; } int wait(int *n) { while((*n)=0); (*n)--; } Since parent process and child process will be having different address spaces...so change of n in one address space will not be visible to other.so please tell me how to make n visible to both the processes On Fri, Jun 3, 2011 at 2:45 PM, Subhransu subhransu.panigr...@gmail.com wrote: Here you go in C code http://codepad.org/gk6AZj0T int main() { if(printf(hello)!=0) { printf(world); } else { printf(SCREWED ! ! !); } return 0; } Subhransu Panigrahi Mobile: +91-9840931538 Email: subhransu.panigr...@gmail.com On Fri, Jun 3, 2011 at 1:57 PM, Naveen Kumar naveenkumarve...@gmail.com wrote: Hi Shachindra, I don't think letters will be jumbled because we a calling one api to output on console tty's driver takes whole line and output it at once. On Fri, Jun 3, 2011 at 12:40 PM, Vishal Thanki vishaltha...@gmail.com wrote: @sachindra, @naveen, this was just a plain trick to execute if and else block. i agree with your concerns :) 2011/6/3 Vιиodh vinodh...@gmail.com: @vishal: can u explain the fork() solution?? On Fri, Jun 3, 2011 at 12:16 PM, Shachindra A C sachindr...@gmail.com wrote: There can be some synchronisation problems with fork() right? say world might get printed first...or maybe the letters can get jumbled too...We cannot guarantee the order of execution unless we use semaphores. On Fri, Jun 3, 2011 at 12:14 PM, Naveen Kumar naveenkumarve...@gmail.com wrote: oh yes, gud one On Fri, Jun 3, 2011 at 12:12 PM, Vishal Thanki vishaltha...@gmail.com wrote: vishal@ubuntu:~/progs/c\ 12:11:53 PM $ cat fork.c #include stdio.h #include stdlib.h int main() { if (fork()) { printf(hello ); } else { printf(world\n); } return 0; } vishal@ubuntu:~/progs/c\ 12:11:56 PM $ gcc fork.c vishal@ubuntu:~/progs/c\ 12:12:06 PM $ ./a.out hello world On Fri, Jun 3, 2011 at 12:09 PM, Naveen Kumar naveenkumarve...@gmail.com wrote: Hi Vishal, Can you show us how it be done with fork? On Fri, Jun 3, 2011 at 12:02 PM, Vishal Thanki vishaltha...@gmail.com wrote: can use fork() also.. On Fri, Jun 3, 2011 at 11:57 AM, anand karthik anandkarthik@gmail.com wrote: (!printf(Hello)) On Jun 3, 2011
Re: [algogeeks] remove duplicate chars in a string without using extra memory
@Johari , You have correctly mapped but the question demanded , to remove all repetition , though the string is still the same as it was given in input . On Fri, Jun 3, 2011 at 7:00 PM, Kunal Patil kp101...@gmail.com wrote: If you are not going to allow extra space, you have to compromise on time complexity..[?] If you dont have your string already stored in a trie/hashmap usage of it requires additional buffer. Simple solution would be: Sort given string using in-place sorting algorithm and then removal of duplicate characters becomes O(n). Total time complexity - O(nlogn) where n -- number of characters in the input string. On Thu, Jun 2, 2011 at 11:17 PM, Aakash Johari aakashj@gmail.comwrote: It was given that one or two extra variables are allowed. So I used a variable instead for mapping. It is simply mapping of each character in alphabet to a bit in the variable. On Thu, Jun 2, 2011 at 7:10 AM, Ashish Goel ashg...@gmail.com wrote: using bitmap, but extra memory not allowed? Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 On Thu, Jun 2, 2011 at 7:38 PM, Ashish Goel ashg...@gmail.com wrote: what is the logic, kindly explain Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 On Sat, May 28, 2011 at 12:23 PM, Aakash Johari aakashj@gmail.comwrote: Following code works for [A-Za-z], can be extended for whole character-set : #include stdio.h int main() { unsigned long long int a = 0; char str[50]; int i; scanf (%s, str); for ( i = 0; str[i]; i++ ) { if ( str[i] = 'A' str[i] = 'Z' ) { if ( (a (1ULL (str[i] - 'A'))) == 0 ) { a |= (1ULL (str[i] - 'A')); putchar (str[i]); } } else if ( str[i] = 'a' str[i] = 'z' ) { if ( (a (1ULL (str[i] - 'a' + 26))) == 0 ) { a |= (1ULL (str[i] - 'a' + 26)); putchar(str[i]); } } } return 0; } On Fri, May 27, 2011 at 11:15 PM, saurabh singh saurabh.n...@gmail.com wrote: string getStringWithoutDuplicateChars(string input) { create_empty_trie_ds (say trie) integer count = 0; for_each_char_in_string (say ch) { if(trie-contains(ch)) //if ch not there in ds then add it and return false otherwise return true { input.remove(count) } count++ } return input } On Sat, May 28, 2011 at 11:32 AM, Rajeev Kumar rajeevprasa...@gmail.com wrote: Design an algorithm and write code to remove the duplicate characters in a string without using any additional buffer. NOTE: One or two additional variables are fine. An extra copy of the array is not. -- 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. -- Thanks Regards, Saurabh -- 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. -- -Aakash Johari (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 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. -- -Aakash Johari (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 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
Re: [algogeeks] Re:
See this note https://www.facebook.com/note.php?note_id=16121578919 On Fri, Jun 3, 2011 at 7:47 PM, ankit sambyal ankitsamb...@gmail.comwrote: Ya mapreduce is a framework. It may use a database. Facebook uses cloud database, which uses map reduce framework. On Fri, Jun 3, 2011 at 6:56 AM, Akshata Sharma akshatasharm...@gmail.com wrote: MapReduce is not a db, its an framework right? On Fri, Jun 3, 2011 at 7:20 PM, Akshay Rastogi akr...@gmail.com wrote: Fb dont use relational dbs for sure.. they use MapReduce On Fri, Jun 3, 2011 at 7:14 PM, Akshata Sharma akshatasharm...@gmail.com wrote: Also, is the database they use relational database? or is it cloud DB? On Fri, Jun 3, 2011 at 7:09 PM, Akshata Sharma akshatasharm...@gmail.com wrote: How facebook stores all the user information? I am talking in terms of scalability, their spread servers, and how the friend information, common friends, etc is stored for a user? Can someone give me some explanation about this? -- 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. -- AKSHAY RASTOGI BE(Hons) CS BITS PILANI , Pilani -- 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] Re: c output
An ANSI-compliant compiler is not required to generate an error for undefined code. The code syntax is correct. ANSI doesn't say what the compiler must do for undefined code, which is why it is undefined. The compiler can do anything. It might do what you expect, or it might not. Don On Jun 1, 1:38 pm, richa mahajan m.rich...@gmail.com wrote: if it is undefined by standard den y dont compilers follow it On Wed, Jun 1, 2011 at 11:59 PM, Don dondod...@gmail.com wrote: That may be true, but it is not guaranteed. Having multiple side affects between sequence points is undefined by the ANSI standard. Therefore an ANSI-compliant compiler could produce an executable which causes monkeys to fly out of your nose. Don On Jun 1, 11:27 am, anuj agarwal coolbuddy...@gmail.com wrote: This will be same as: b=b+1; b=b+1; a=b*b; Basically, all prefix increment and decrement operators will be executed first. Similarly all postfix operators will be executed at last. Anuj Agarwal Engineering is the art of making what you want from things you can get. On Wed, Jun 1, 2011 at 5:27 PM, Vishal Thanki vishaltha...@gmail.com wrote: you may want to read:http://c-faq.com/expr/seqpoints.html On Wed, Jun 1, 2011 at 5:19 PM, himanshu kansal himanshukansal...@gmail.com wrote: a=++b*++b; if b=3 initially, then a is coming out to be 25.why -- 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] remove duplicate chars in a string without using extra memory
@Lalit: This requires a simple modification. You can take the following one: #include stdio.h int main() { unsigned long long int a = 0; char str[50]; int i, j; scanf (%s, str); for ( i = j = 0; str[i]; i++ ) { if ( str[i] = 'A' str[i] = 'Z' ) { if ( (a (1ULL (str[i] - 'A'))) == 0 ) { a |= (1ULL (str[i] - 'A')); str[j++] = str[i]; } } else if ( str[i] = 'a' str[i] = 'z' ) { if ( (a (1ULL (str[i] - 'a' + 26))) == 0 ) { a |= (1ULL (str[i] - 'a' + 26)); str[j++] = str[i]; } } } str[j] = '\0'; printf (%s\n, str); return 0; } On Fri, Jun 3, 2011 at 12:25 PM, LALIT SHARMA lks.ru...@gmail.com wrote: @Johari , You have correctly mapped but the question demanded , to remove all repetition , though the string is still the same as it was given in input . On Fri, Jun 3, 2011 at 7:00 PM, Kunal Patil kp101...@gmail.com wrote: If you are not going to allow extra space, you have to compromise on time complexity..[?] If you dont have your string already stored in a trie/hashmap usage of it requires additional buffer. Simple solution would be: Sort given string using in-place sorting algorithm and then removal of duplicate characters becomes O(n). Total time complexity - O(nlogn) where n -- number of characters in the input string. On Thu, Jun 2, 2011 at 11:17 PM, Aakash Johari aakashj@gmail.comwrote: It was given that one or two extra variables are allowed. So I used a variable instead for mapping. It is simply mapping of each character in alphabet to a bit in the variable. On Thu, Jun 2, 2011 at 7:10 AM, Ashish Goel ashg...@gmail.com wrote: using bitmap, but extra memory not allowed? Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 On Thu, Jun 2, 2011 at 7:38 PM, Ashish Goel ashg...@gmail.com wrote: what is the logic, kindly explain Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 On Sat, May 28, 2011 at 12:23 PM, Aakash Johari aakashj@gmail.com wrote: Following code works for [A-Za-z], can be extended for whole character-set : #include stdio.h int main() { unsigned long long int a = 0; char str[50]; int i; scanf (%s, str); for ( i = 0; str[i]; i++ ) { if ( str[i] = 'A' str[i] = 'Z' ) { if ( (a (1ULL (str[i] - 'A'))) == 0 ) { a |= (1ULL (str[i] - 'A')); putchar (str[i]); } } else if ( str[i] = 'a' str[i] = 'z' ) { if ( (a (1ULL (str[i] - 'a' + 26))) == 0 ) { a |= (1ULL (str[i] - 'a' + 26)); putchar(str[i]); } } } return 0; } On Fri, May 27, 2011 at 11:15 PM, saurabh singh saurabh.n...@gmail.com wrote: string getStringWithoutDuplicateChars(string input) { create_empty_trie_ds (say trie) integer count = 0; for_each_char_in_string (say ch) { if(trie-contains(ch)) //if ch not there in ds then add it and return false otherwise return true { input.remove(count) } count++ } return input } On Sat, May 28, 2011 at 11:32 AM, Rajeev Kumar rajeevprasa...@gmail.com wrote: Design an algorithm and write code to remove the duplicate characters in a string without using any additional buffer. NOTE: One or two additional variables are fine. An extra copy of the array is not. -- 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. -- Thanks Regards, Saurabh -- 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. -- -Aakash Johari (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 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
Re: [algogeeks] Re: c output
in 1st pass both ++b ++b= 4 then ++b= 5; at second pass a= 5*5; because ++b is 5 -- 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] remove duplicate chars in a string without using extra memory
Akash your code is good but it can be code more short #include stdio.h int main() { unsigned long long int a = 0; char str[]=harish chandra pran; int i, j; for ( i = j = 0; str[i]; i++ ) { int offset=0; if ( str[i] = 'a' str[i] = 'z' ) offset=26; offset+= str[i] - 'A'; if ( (a (1 offset)) == 0 ) { a |= (1 offset); str[j++] = str[i]; } } str[j] = '\0'; printf (%s\n, str ); return 0; } -- 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] remove duplicate chars in a string without using extra memory
Yes, it can be.. i could make it obfuscated and produce a code with lesser number of characters. :) but i tried to make it understandable. On Fri, Jun 3, 2011 at 3:21 PM, hary rathor harry.rat...@gmail.com wrote: Akash your code is good but it can be code more short #include stdio.h int main() { unsigned long long int a = 0; char str[]=harish chandra pran; int i, j; for ( i = j = 0; str[i]; i++ ) { int offset=0; if ( str[i] = 'a' str[i] = 'z' ) offset=26; offset+= str[i] - 'A'; if ( (a (1 offset)) == 0 ) { a |= (1 offset); str[j++] = str[i]; } } str[j] = '\0'; printf (%s\n, str ); return 0; } -- 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. -- -Aakash Johari (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 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: Array Merge Problem
Please try this solution. And tell if it fails at any case. If it works fine, I will tell the logic. #include stdio.h #include stdlib.h void merge(int *a, int m, int *b, int n) { int i, j, k; int t; i = j = 0; k = -1; while ( i m a[i] b[j] ) { i++; } while ( i m j n ) { if ( k == -1 b[j] a[i] ) { t = a[i]; a[i] = b[j]; b[j] = t; k = j; j++; i++; } else if ( b[j] b[k] ) { t = a[i]; a[i] = b[j]; b[j] = t; j++; i++; } else { t = a[i]; a[i] = b[k]; b[k] = t; i++; } } } int main() { int m, n; int *a, *b; int i; scanf (%d%d, m, n); a = (int*) malloc(sizeof(int) * m); b = (int*) malloc(sizeof(int) * n); for ( i = 0; i m; i++ ) scanf (%d, a + i); for ( i = 0; i n; i++ ) scanf (%d, b + i); merge (a, m, b, n); printf (After Merge Operation : \n); printf (1st Array : ); for ( i = 0; i m; i++ ) { printf (%d , a[i]); } printf (\n2nd Array : ); for ( i = 0; i n; i++ ) { printf (%d , b[i]); } return 0; } On Fri, Jun 3, 2011 at 8:07 AM, bittu shashank7andr...@gmail.com wrote: @sravanreddy...logical bugs if A is size of n B is size m from your example assuming nm so if you want smallest m elements in A then u only capacity of n elements didn't allocate memory so these elements initialized by INT_MIN for m-n nodes so that array A can hold m smallest elements then what r u swapping u dude..isn't garbage value ?? you will get at 1st step only just run it ?? in you algo A_End=m-1(which 4th position in Array that DNE)..?? also you have to free memory for m-n in array B as it contains n largest elements . take A= 1,2,3 n=3 B= 0,1,4,5,9 m=5 after allocating memory to Array A for m-n elements A will looks likes 1 2 3 INT_Max INT_Max now what you wants A should contains m smallest elements B have n largest elements so O/P should be A=1,2,3,1,0 B=INT_Max,INT_Max,4,5,9 now free memory used by 1st elements in array B so that A will represent M smallest elements B will have n Largest elements so that above will work. Hope I am Correct let me know if any issue with explanation Thanks ShashankThe Best Way To Escape From The problem is To Solve It CSE,BIT Mesra -- 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. -- -Aakash Johari (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 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: Array Merge Problem
it can be done in O(m) . Use something like binary search . code is here ... #includestdio.h void splitMN(int a[],int m , int b[], int n){ int al = 0 , bl = 0 ; int ah = m-1 , bh = n-1 ; int ai = (ah+al+1)/2; int bi = (bh+bl+1)/2; while(ai+bi!=m){ printf(Enter ai = %d, bi = %d\n ,ai,bi); if(ai+bi m){ if(a[ai] b[bi]){ al = ai ; if(al == ai) break; ai = (ah+al+1)/2; }else{ bl = bi ; if(bh == bi) break; bi = (bh+bl+1)/2; } }else{ if(a[ai] b[bi]){ ah = ai ; if(ah == ai) break; ai = (ah+al+1)/2; }else{ bh = bi ; if(bh == bi) break; bi = (bh+bl+1)/2; } } } bi = 0 ; ai ; while(ai m){ a[ai] = a[ai]^b[bi]^(b[bi] = a[ai]); ai++ ; bi++ ; } } int main(){ int m , n ; printf(Enter m , n : ); scanf(%d%d,m,n); int a[m] , b[n] ; int i ; for(i = 0 ; i m ; i++) scanf(%d,a[i]); for(i = 0 ; i n ; i++) scanf(%d,b[i]); printf(Enter m , n : ); splitMN(a,m,b,n); for(i = 0 ; i m ; i++) printf(%d\t,a[i]); printf(\n); for(i = 0 ; i n ; i++) printf(%d\t,b[i]); printf(\n); } On Sat, Jun 4, 2011 at 4:03 AM, Aakash Johari aakashj@gmail.com wrote: Please try this solution. And tell if it fails at any case. If it works fine, I will tell the logic. #include stdio.h #include stdlib.h void merge(int *a, int m, int *b, int n) { int i, j, k; int t; i = j = 0; k = -1; while ( i m a[i] b[j] ) { i++; } while ( i m j n ) { if ( k == -1 b[j] a[i] ) { t = a[i]; a[i] = b[j]; b[j] = t; k = j; j++; i++; } else if ( b[j] b[k] ) { t = a[i]; a[i] = b[j]; b[j] = t; j++; i++; } else { t = a[i]; a[i] = b[k]; b[k] = t; i++; } } } int main() { int m, n; int *a, *b; int i; scanf (%d%d, m, n); a = (int*) malloc(sizeof(int) * m); b = (int*) malloc(sizeof(int) * n); for ( i = 0; i m; i++ ) scanf (%d, a + i); for ( i = 0; i n; i++ ) scanf (%d, b + i); merge (a, m, b, n); printf (After Merge Operation : \n); printf (1st Array : ); for ( i = 0; i m; i++ ) { printf (%d , a[i]); } printf (\n2nd Array : ); for ( i = 0; i n; i++ ) { printf (%d , b[i]); } return 0; } On Fri, Jun 3, 2011 at 8:07 AM, bittu shashank7andr...@gmail.com wrote: @sravanreddy...logical bugs if A is size of n B is size m from your example assuming nm so if you want smallest m elements in A then u only capacity of n elements didn't allocate memory so these elements initialized by INT_MIN for m-n nodes so that array A can hold m smallest elements then what r u swapping u dude..isn't garbage value ?? you will get at 1st step only just run it ?? in you algo A_End=m-1(which 4th position in Array that DNE)..?? also you have to free memory for m-n in array B as it contains n largest elements . take A= 1,2,3 n=3 B= 0,1,4,5,9 m=5 after allocating memory to Array A for m-n elements A will looks likes 1 2 3 INT_Max INT_Max now what you wants A should contains m smallest elements B have n largest elements so O/P should be A=1,2,3,1,0 B=INT_Max,INT_Max,4,5,9 now free memory used by 1st elements in array B so that A will represent M smallest elements B will have n Largest elements so that above will work. Hope I am Correct let me know if any issue with explanation Thanks ShashankThe Best Way To Escape From The problem is To Solve It CSE,BIT Mesra -- 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. -- -Aakash Johari (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 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 :* Ravinder Kumar B.Tech 3rd Year Computer Science and Engineering 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
Re: [algogeeks] [brain teaser ] Mystery Puzzle Sherlock Holmes 26 may
Hahaha..nice one.. :) :) On Thu, May 26, 2011 at 9:43 PM, DeVaNsH gUpTa devanshgupta...@gmail.comwrote: Mark as it reads ?(Question Mark) Crimson. -- 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] box packing
given the boxes with dimentions in form (L,B,H) find the sequence in which the boxes can be stored inside the other. for eg. a=4,4,5 b=3,4,3 c=3,4,6 d=2,3,2 a(b(d)) without rotation : is this correct logic sort on the basis of length and breadth and height then find lis on the basis of height starting from the bottom most box in the sorted sequence what for rotation case -- 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.