Re: [algogeeks] Re: Intersection of 2 linked lists -

2011-06-03 Thread Arpit Mittal
@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,

Re: [algogeeks] Re: Intersection of 2 linked lists -

2011-06-03 Thread ankit sambyal
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

Re: [algogeeks] Re: Intersection of 2 linked lists -

2011-06-03 Thread Arpit Mittal
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

[algogeeks] A simple C question

2011-06-03 Thread Arpit Mittal
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 :

[algogeeks] 3 stacks using one array?

2011-06-03 Thread kumar vr
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

Re: [algogeeks] A simple C question

2011-06-03 Thread Naveen Kumar
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

Re: [algogeeks] A simple C question

2011-06-03 Thread anand karthik
(!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

Re: [algogeeks] A simple C question

2011-06-03 Thread Vishal Thanki
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

Re: [algogeeks] A simple C question

2011-06-03 Thread Naveen Kumar
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

Re: [algogeeks] A simple C question

2011-06-03 Thread Vishal Thanki
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

Re: [algogeeks] A simple C question

2011-06-03 Thread Naveen Kumar
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 {

Re: [algogeeks] A simple C question

2011-06-03 Thread Naveen Kumar
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

Re: [algogeeks] A simple C question

2011-06-03 Thread Shachindra A C
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

Re: [algogeeks] A simple C question

2011-06-03 Thread Vιиodh
@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

Re: [algogeeks] 3 stacks using one array?

2011-06-03 Thread Harshal
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

Re: [algogeeks] A simple C question

2011-06-03 Thread Vishal Thanki
@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

Re: [algogeeks] [brain teaser ] Life Or Death 3 june

2011-06-03 Thread bhavana
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

Re: [algogeeks] 3 stacks using one array?

2011-06-03 Thread sunny agrawal
@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

Re: [algogeeks] 3 stacks using one array?

2011-06-03 Thread Harshal
@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

Re: [algogeeks] [brain teaser ] Life Or Death 3 june

2011-06-03 Thread Pragya lal
@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

Re: [algogeeks] [brain teaser ] Life Or Death 3 june

2011-06-03 Thread bhavana
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

Re: [algogeeks] [brain teaser ] Life Or Death 3 june

2011-06-03 Thread Pragya lal
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

Re: [algogeeks] A simple C question

2011-06-03 Thread Naveen Kumar
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

Re: [algogeeks] [brain teaser ] Life Or Death 3 june

2011-06-03 Thread D!leep Gupta
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

Re: [algogeeks] [brain teaser ] Life Or Death 3 june

2011-06-03 Thread Naveen Kumar
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,

Re: [algogeeks] [brain teaser ] Life Or Death 3 june

2011-06-03 Thread bhavana
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

Re: [algogeeks] A simple C question

2011-06-03 Thread Subhransu
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,

[algogeeks] Google

2011-06-03 Thread Nate
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

[algogeeks] Facebook

2011-06-03 Thread Nate
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

Re: [algogeeks] Re: what is wrong in my logic :problem sbets

2011-06-03 Thread PRAMENDRA RATHi rathi
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

Re: [algogeeks] Google

2011-06-03 Thread Piyush Sinha
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

Re: [algogeeks] [brain teaser ] Life Or Death 3 june

2011-06-03 Thread balaji a
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

[algogeeks] hajime help:

2011-06-03 Thread PRAMENDRA RATHi rathi
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

Re: [algogeeks] How to remove duplicate element from array in one pass.

2011-06-03 Thread Naveen Agrawal
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

Re: [algogeeks] [brain teaser ] Life Or Death 3 june

2011-06-03 Thread deepak jakhar
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

Re: [algogeeks] Facebook

2011-06-03 Thread ankit sambyal
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

Re: [algogeeks] Google

2011-06-03 Thread Vipul Kumar
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

Re: [algogeeks] Google

2011-06-03 Thread Piyush Sinha
@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

Re: [algogeeks] Google

2011-06-03 Thread Vipul Kumar
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,

Re: [algogeeks] How to remove duplicate element from array in one pass.

2011-06-03 Thread Naveen Agrawal
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

Re: [algogeeks] How to remove duplicate element from array in one pass.

2011-06-03 Thread Naveen Kumar
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

Re: [algogeeks] Google

2011-06-03 Thread Piyush Sinha
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

Re: [algogeeks] Google

2011-06-03 Thread Vipul Kumar
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,

Re: [algogeeks] Google

2011-06-03 Thread Piyush Sinha
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...

Re: [algogeeks] [brain teaser ] Life Or Death 3 june

2011-06-03 Thread kannan s
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

Re: [algogeeks] SPOJ ETF

2011-06-03 Thread arun kumar
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 #

Re: [algogeeks] How to remove duplicate element from array in one pass.

2011-06-03 Thread Naveen Agrawal
@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

[algogeeks] Re: Facebook

2011-06-03 Thread bittu
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

[algogeeks] Posts not going through to group

2011-06-03 Thread Shuaib
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. --

Re: [algogeeks] remove duplicate chars in a string without using extra memory

2011-06-03 Thread Kunal Patil
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

[algogeeks]

2011-06-03 Thread Akshata Sharma
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

[algogeeks] Re:

2011-06-03 Thread Akshata Sharma
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

Re: [algogeeks] Array Merge Problem

2011-06-03 Thread Kunal Patil
@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]

Re: [algogeeks] Re:

2011-06-03 Thread Akshay Rastogi
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:

Re: [algogeeks] Re:

2011-06-03 Thread Akshata Sharma
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

Re: [algogeeks]

2011-06-03 Thread Kunal Patil
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,

Re: [algogeeks]

2011-06-03 Thread Nate Archibald
@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

[algogeeks] HOT HOT HOT !!!! Oracle Specialist position in Miami Florida

2011-06-03 Thread sohail panzer
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

Re: [algogeeks] Re:

2011-06-03 Thread Nate Archibald
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

Re: [algogeeks] Array Merge Problem

2011-06-03 Thread Ashish Goel
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

[algogeeks] Immediate Need for VM WARE SPECIALIST in Miami Florida

2011-06-03 Thread sohail panzer
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

[algogeeks] Windows Engineer // Miami Florida // 8 week contract

2011-06-03 Thread sohail panzer
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

[algogeeks] Re: Array Merge Problem

2011-06-03 Thread bittu
@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

[algogeeks] Google Question

2011-06-03 Thread Nate
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,

Re: [algogeeks] Google Question

2011-06-03 Thread vaibhav agrawal
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

Re: [algogeeks] A simple C question

2011-06-03 Thread nitish goyal
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 {

Re: [algogeeks] Google Question

2011-06-03 Thread Nate Archibald
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

[algogeeks] Google Question

2011-06-03 Thread Nate
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

Re: [algogeeks] A simple C question

2011-06-03 Thread nicks
@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

Re: [algogeeks] A simple C question

2011-06-03 Thread LALIT SHARMA
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

Re: [algogeeks] A simple C question

2011-06-03 Thread nitish goyal
@ 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

Re: [algogeeks] A simple C question

2011-06-03 Thread Naveen Kumar
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:

[algogeeks] HOT HOT HOT!!! SAP BW Consultant position in Florida

2011-06-03 Thread sohail panzer
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

[algogeeks] Functional SAP BA - FICO // Tennessee // 3+ months contract

2011-06-03 Thread sohail panzer
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

Re: [algogeeks] A simple C question

2011-06-03 Thread nicks
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

Re: [algogeeks] A simple C question

2011-06-03 Thread Naveen Kumar
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

Re: [algogeeks] A simple C question

2011-06-03 Thread nicks
@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

Re: [algogeeks] A simple C question

2011-06-03 Thread nitish goyal
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

Re: [algogeeks] Google Question

2011-06-03 Thread nicks
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

Re: [algogeeks] A simple C question

2011-06-03 Thread Vishal Thanki
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

Re: [algogeeks] remove duplicate chars in a string without using extra memory

2011-06-03 Thread LALIT SHARMA
@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

Re: [algogeeks] Re:

2011-06-03 Thread Rohit J.
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,

[algogeeks] Re: c output

2011-06-03 Thread Don
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,

Re: [algogeeks] remove duplicate chars in a string without using extra memory

2011-06-03 Thread Aakash Johari
@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' ) {

Re: [algogeeks] Re: c output

2011-06-03 Thread hary rathor
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

Re: [algogeeks] remove duplicate chars in a string without using extra memory

2011-06-03 Thread hary rathor
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;

Re: [algogeeks] remove duplicate chars in a string without using extra memory

2011-06-03 Thread Aakash Johari
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

Re: [algogeeks] Re: Array Merge Problem

2011-06-03 Thread Aakash Johari
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++;

Re: [algogeeks] Re: Array Merge Problem

2011-06-03 Thread Ravinder Kumar
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

Re: [algogeeks] [brain teaser ] Mystery Puzzle Sherlock Holmes 26 may

2011-06-03 Thread Kunal Patil
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] box packing

2011-06-03 Thread NIKHIL
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