Re: [algogeeks] networking for interviews
refer beej guide for networking programming and furozon for theory On Sun, Aug 14, 2011 at 2:42 AM, codeur kcrazy...@gmail.com wrote: hii we have not studied networking till now as a part of our curriculum (its in 8th sem) but companies coming for placement do ask questns based on networking. Can some body suggest some short tutorial which we can refer for answering such questns. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- SOURABH JAKHAR,(CSE)(Final year) ROOM NO 167 , TILAK,HOSTEL 'MNNIT ALLAHABAD The Law of Win says, Let's not do it your way or my way; let's do it the best way. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] C Output
int main () { printf(%d,1+2+5); getch(); return 0; } what should it return and how..?? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/2H3Gg6hLEQ0J. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] C Output
i got a warning in gcc and the output was garbage On Sun, Aug 14, 2011 at 11:44 AM, Brijesh Upadhyay brijeshupadhyay...@gmail.com wrote: int main () { printf(%d,1+2+5); getch(); return 0; } what should it return and how..?? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/2H3Gg6hLEQ0J. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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
I think i got it... STRING always return address of S , which then get summed with 1 and 2. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/kFrZUxzFTxsJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] C Output
5 will represent address of 5 in heap. so adding 3 to 5 increment tht address by 3 and print it on the screen On Sun, Aug 14, 2011 at 11:44 AM, Brijesh Upadhyay brijeshupadhyay...@gmail.com wrote: int main () { printf(%d,1+2+5); getch(); return 0; } what should it return and how..?? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/2H3Gg6hLEQ0J. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: C Output
try out with Microsoft VC++ On Sun, Aug 14, 2011 at 11:47 AM, Brijesh Upadhyay brijeshupadhyay...@gmail.com wrote: I think i got it... STRING always return address of S , which then get summed with 1 and 2. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/kFrZUxzFTxsJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: C Output
compiler dependent and will print some address On Sun, Aug 14, 2011 at 11:48 AM, sukran dhawan sukrandha...@gmail.comwrote: try out with Microsoft VC++ On Sun, Aug 14, 2011 at 11:47 AM, Brijesh Upadhyay brijeshupadhyay...@gmail.com wrote: I think i got it... STRING always return address of S , which then get summed with 1 and 2. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/kFrZUxzFTxsJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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. -- SOURABH JAKHAR,(CSE)(Final year) ROOM NO 167 , TILAK,HOSTEL 'MNNIT ALLAHABAD The Law of Win says, Let's not do it your way or my way; let's do it the best way. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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 does scanf takes the input ??? -- *Rajeshwar Patra,* *MCA final year,* *Nit Durgapur* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Rajeshwar Patra,* *MCA final year,* *Nit Durgapur* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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]
scanf takes input anything as well..but the output will be just a space On Sun, Aug 14, 2011 at 1:08 PM, Rajeshwar Patra rajeshwarpa...@gmail.comwrote: how does scanf takes the input ??? -- *Rajeshwar Patra,* *MCA final year,* *Nit Durgapur* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Rajeshwar Patra,* *MCA final year,* *Nit Durgapur* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] C Output
I think the address of string 5 located will be added with 1 and 2... On Sun, Aug 14, 2011 at 11:44 AM, Brijesh Upadhyay brijeshupadhyay...@gmail.com wrote: int main () { printf(%d,1+2+5); getch(); return 0; } what should it return and how..?? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/2H3Gg6hLEQ0J. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] runtime error help
can any one help me why am i getting runtime error in the program. my program is def call(a,b): print(((pow(a,b))%10)); def main(): n=input(); for x in range(n): import sys a,b = map(long,sys.stdin.readline().split()); a=a%10; if((a==0)or(a==1)or(a==5)or(a==6)): print(a); if(a==2 or a==7 or a==8 or a==3): call(a,b%4) if(b==4 or b==9): call(a,b%2); main(); i am solving lastdig2 problem of spoj http://www.spoj.pl/problems/LASTDIG2/ -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: citrix rd????
was the aptitude on c or c++???i mean did the aptitude contain questions on classes and objects??? On Aug 14, 2:00 am, sagar pareek sagarpar...@gmail.com wrote: sorry it is 3 hand written codes in 1 hour On Sun, Aug 14, 2011 at 2:29 AM, sagar pareek sagarpar...@gmail.com wrote: First they have writtwen (45 quwestions in 60 mins) Major (70-80% + ) on C++ .. simple... no need to study in deep networking need deep study... Some apti i dont remember of apti and os (if it is there then it has very less part) then 1 hour 23 hand written codes logic based...no need a good coder but know how to do in best way mine questions were 1. array given with two neighbor elements have distance of -1,0or 1 like 6,6,5,5,6,5,4,3,2,1,1,0 find 2 logic is simple take diff b/w given no. and array element and then jump to the location with the diff 2. array given in decreasing then increasing order. find number like 9 8 7 6 1 2 3 4 5 3. rotate 2-d matrix in place (mean in O(1) space) first transpose and then swap columns On Sat, Aug 13, 2011 at 11:34 PM, htross htb...@gmail.com wrote: any one else who has wrote citrix rd this year???please please reply.a last ray of hope On Aug 13, 10:59 pm, Yasir yasir@gmail.com wrote: I havn't attended citrix's campus drive this year. This is the last year's process. Hopefully would be same. :) Good Luck! -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- **Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT ALLAHABAD -- **Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks]
@ankur:tere code se wrong answer ayegafor n=4 there are 5 solutions... therefore arr[2]should be 2,par teer code me its 1... arr[1]=1 arr[2]=2; now start from arr[3]; On Sun, Aug 14, 2011 at 9:57 AM, Ankur Khurana ankur.kkhur...@gmail.comwrote: it's a simple dp , ned not be knapsack one. int arr[n]; arr[0]=0 arr[1]=1; for(int i=2;i=n;i++) { arr[i]=arr[i-1]+arr[i-2]; } do you get the code ? i mean , pseudo code was almost similar. On Sun, Aug 14, 2011 at 1:34 AM, sagar pareek sagarpar...@gmail.comwrote: Sorry 4 above post i thought it a diff ques On Sun, Aug 14, 2011 at 1:33 AM, sagar pareek sagarpar...@gmail.comwrote: its n/2+1 On Sat, Aug 13, 2011 at 8:45 PM, Puneet Goyal puneetgoya...@gmail.comwrote: I think it's fibonacci series... T(n)= T(n-1) + T(n-2) Explanation: T(n): no. of ways for n stairs T(n-1): when it took the first step as 1 stair t(n-2): when it took the first step as 2 stairs the series can be started as T(1)=1 T(2)=2 and calculate the rest from above On Sat, Aug 13, 2011 at 8:37 PM, Gaurav Menghani gaurav.mengh...@gmail.com wrote: Knapsack DP On Sat, Aug 13, 2011 at 8:35 PM, Kamakshii Aggarwal kamakshi...@gmail.com wrote: yes On Sat, Aug 13, 2011 at 8:30 PM, Puneet Goyal puneetgoya...@gmail.com wrote: 1 or 2 stairs? On Sat, Aug 13, 2011 at 8:24 PM, Kamakshii Aggarwal kamakshi...@gmail.com wrote: Given n stairs, how many number of ways can you climb if u use either 1 or 2 at a time? -- Regards, Kamakshi kamakshi...@gmail.com -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- --- Puneet Goyal Student of B. Tech. III Year (Software Engineering) Delhi Technological University, Delhi --- -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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, Kamakshi kamakshi...@gmail.com -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Gaurav Menghani -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- --- Puneet Goyal Student of B. Tech. III Year (Software Engineering) Delhi Technological University, Delhi --- -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- **Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT ALLAHABAD -- **Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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, Kamakshi kamakshi...@gmail.com -- You received this message because you are subscribed to the Google
[algogeeks] pankaj kumar wants to chat
--- pankaj kumar wants to stay in better touch using some of Google's coolest new products. If you already have Gmail or Google Talk, visit: http://mail.google.com/mail/b-fec58d8386-f16dcef73c-qIhM6BVo3OJNdgYKy2viERCQNpE You'll need to click this link to be able to chat with pankaj kumar. To get Gmail - a free email account from Google with over 2,800 megabytes of storage - and chat with pankaj kumar, visit: http://mail.google.com/mail/a-fec58d8386-f16dcef73c-qIhM6BVo3OJNdgYKy2viERCQNpE Gmail offers: - Instant messaging right inside Gmail - Powerful spam protection - Built-in search for finding your messages and a helpful way of organizing emails into conversations - No pop-up ads or untargeted banners - just text ads and related information that are relevant to the content of your messages All this, and its yours for free. But wait, there's more! By opening a Gmail account, you also get access to Google Talk, Google's instant messaging service: http://www.google.com/talk/ Google Talk offers: - Web-based chat that you can use anywhere, without a download - A contact list that's synchronized with your Gmail account - Free, high quality PC-to-PC voice calls when you download the Google Talk client We're working hard to add new features and make improvements, so we might also ask for your comments and suggestions periodically. We appreciate your help in making our products even better! Thanks, The Google Team To learn more about Gmail and Google Talk, visit: http://mail.google.com/mail/help/about.html http://www.google.com/talk/about.html (If clicking the URLs in this message does not work, copy and paste them into the address bar of your browser). -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] string confusion
arshad u got my point or not? On Sun, Aug 14, 2011 at 1:16 PM, Arshad Alam alam3...@gmail.com wrote: program is running smooth but I have one confusion at line number 8. why it is *while(s[i]!=0)* instead of *while(s[i]!='\0')* 1.#includestdio.h 2.#includeconio.h 3.void main() 4.{ 5.clrscr(); 6.char s[]=No two viruses; 7.int i=0; 8.while(s[i]!=0) 9.{ 10.printf(\n%c %c,s[i],*(s+i)); 11.printf ( \n%c %c,i[s],*(i+s)); 12.i++; 13. } 14. getch(); 15.} Thanks Regards Arshad Nadeem Alam -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- **Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: citrix rd????
no c only C++ questions mainly were to get the o/p of program On Sun, Aug 14, 2011 at 1:30 PM, htross htb...@gmail.com wrote: was the aptitude on c or c++???i mean did the aptitude contain questions on classes and objects??? On Aug 14, 2:00 am, sagar pareek sagarpar...@gmail.com wrote: sorry it is 3 hand written codes in 1 hour On Sun, Aug 14, 2011 at 2:29 AM, sagar pareek sagarpar...@gmail.com wrote: First they have writtwen (45 quwestions in 60 mins) Major (70-80% + ) on C++ .. simple... no need to study in deep networking need deep study... Some apti i dont remember of apti and os (if it is there then it has very less part) then 1 hour 23 hand written codes logic based...no need a good coder but know how to do in best way mine questions were 1. array given with two neighbor elements have distance of -1,0or 1 like 6,6,5,5,6,5,4,3,2,1,1,0 find 2 logic is simple take diff b/w given no. and array element and then jump to the location with the diff 2. array given in decreasing then increasing order. find number like 9 8 7 6 1 2 3 4 5 3. rotate 2-d matrix in place (mean in O(1) space) first transpose and then swap columns On Sat, Aug 13, 2011 at 11:34 PM, htross htb...@gmail.com wrote: any one else who has wrote citrix rd this year???please please reply.a last ray of hope On Aug 13, 10:59 pm, Yasir yasir@gmail.com wrote: I havn't attended citrix's campus drive this year. This is the last year's process. Hopefully would be same. :) Good Luck! -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- **Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT ALLAHABAD -- **Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- **Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] destructor
d destructor can be called explicitly but u *should never* do that... reason: a destructor is caaled automatically when its scope endsthere is no way of preventing its call. so if u have called it explicitly also then u can be in a *serious problem*if ur destructor deallocates memory.:):P On Sun, Aug 14, 2011 at 10:47 AM, Aashish aashish.barn...@gmail.com wrote: can we call a destructor in our own defined class explicitly or it will be executed automatically ? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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 Himanshu Kansal Msc Comp. sc. (University of Delhi) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] os
@ankur i think you are talking about cleanup handlers. these are the functions which are executed when a thread terminates. but can you give any hint how it can be accomplished using process control block. On Sun, Aug 14, 2011 at 2:15 PM, Kamakshii Aggarwal kamakshi...@gmail.comwrote: @ankur::nahi samajh aaya..:( On Sun, Aug 14, 2011 at 9:46 AM, Ankur Khurana ankur.kkhur...@gmail.comwrote: My 2 cents, When the termination signal is sent to the thread either synchronously or asynchronously , you just have a mechanism in place that if that thread is in critical section , it exits from there and and unlocks the mutex at point of exit. This can be done by associating a tokken with the thread that it is executing in critical section and what mutex it locked. O we can do this by making some table in Process control block. On Sat, Aug 13, 2011 at 7:56 PM, Kamakshii Aggarwal kamakshi...@gmail.com wrote: How do you make sure to unlock a mutex which was locked in a thread that dies/terminates? -- Regards, Kamakshi kamakshi...@gmail.com -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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, Kamakshi kamakshi...@gmail.com -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] c question
The problem is because of \n in the prnintf statement. When new line is there in first printf it flushes the standard buffer and so in child the output of printf is not present in second program. *Muthuraj R IV th Year , ISE PESIT , Bangalore* On Sat, Aug 13, 2011 at 9:29 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote: aren't two programs same ? and scheduling of two forked and parent process is prcoessor dependent. You dont have a say in it. On Sun, Aug 14, 2011 at 1:21 AM, thanu moorthy moorthyth...@gmail.comwrote: #includestdio.h #includeunistd.h int main() { int return_value; printf(forking process); fork(); printf(hello\n); return 0; } in the above program the output is forking processhello forking processhello but in the below prog includestdio.h #includeunistd.h int main() { int return_value; printf(forking process\n); fork(); printf(hello\n); return 0; } the output is forking process hello hello why its so ?? -- by $THANU$ -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: citrix rd????
one more thing from networks should we study theory concepts or programming constructs???should we study object oriented concepts??? On Aug 14, 2:04 pm, sagar pareek sagarpar...@gmail.com wrote: no c only C++ questions mainly were to get the o/p of program On Sun, Aug 14, 2011 at 1:30 PM, htross htb...@gmail.com wrote: was the aptitude on c or c++???i mean did the aptitude contain questions on classes and objects??? On Aug 14, 2:00 am, sagar pareek sagarpar...@gmail.com wrote: sorry it is 3 hand written codes in 1 hour On Sun, Aug 14, 2011 at 2:29 AM, sagar pareek sagarpar...@gmail.com wrote: First they have writtwen (45 quwestions in 60 mins) Major (70-80% + ) on C++ .. simple... no need to study in deep networking need deep study... Some apti i dont remember of apti and os (if it is there then it has very less part) then 1 hour 23 hand written codes logic based...no need a good coder but know how to do in best way mine questions were 1. array given with two neighbor elements have distance of -1,0or 1 like 6,6,5,5,6,5,4,3,2,1,1,0 find 2 logic is simple take diff b/w given no. and array element and then jump to the location with the diff 2. array given in decreasing then increasing order. find number like 9 8 7 6 1 2 3 4 5 3. rotate 2-d matrix in place (mean in O(1) space) first transpose and then swap columns On Sat, Aug 13, 2011 at 11:34 PM, htross htb...@gmail.com wrote: any one else who has wrote citrix rd this year???please please reply.a last ray of hope On Aug 13, 10:59 pm, Yasir yasir@gmail.com wrote: I havn't attended citrix's campus drive this year. This is the last year's process. Hopefully would be same. :) Good Luck! -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- **Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT ALLAHABAD -- **Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- **Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: citrix rd????
in networking give emphasis on protocols like ARP, DHCP and all On Sun, Aug 14, 2011 at 3:09 PM, htross htb...@gmail.com wrote: one more thing from networks should we study theory concepts or programming constructs???should we study object oriented concepts??? On Aug 14, 2:04 pm, sagar pareek sagarpar...@gmail.com wrote: no c only C++ questions mainly were to get the o/p of program On Sun, Aug 14, 2011 at 1:30 PM, htross htb...@gmail.com wrote: was the aptitude on c or c++???i mean did the aptitude contain questions on classes and objects??? On Aug 14, 2:00 am, sagar pareek sagarpar...@gmail.com wrote: sorry it is 3 hand written codes in 1 hour On Sun, Aug 14, 2011 at 2:29 AM, sagar pareek sagarpar...@gmail.com wrote: First they have writtwen (45 quwestions in 60 mins) Major (70-80% + ) on C++ .. simple... no need to study in deep networking need deep study... Some apti i dont remember of apti and os (if it is there then it has very less part) then 1 hour 23 hand written codes logic based...no need a good coder but know how to do in best way mine questions were 1. array given with two neighbor elements have distance of -1,0or 1 like 6,6,5,5,6,5,4,3,2,1,1,0 find 2 logic is simple take diff b/w given no. and array element and then jump to the location with the diff 2. array given in decreasing then increasing order. find number like 9 8 7 6 1 2 3 4 5 3. rotate 2-d matrix in place (mean in O(1) space) first transpose and then swap columns On Sat, Aug 13, 2011 at 11:34 PM, htross htb...@gmail.com wrote: any one else who has wrote citrix rd this year???please please reply.a last ray of hope On Aug 13, 10:59 pm, Yasir yasir@gmail.com wrote: I havn't attended citrix's campus drive this year. This is the last year's process. Hopefully would be same. :) Good Luck! -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- **Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT ALLAHABAD -- **Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- **Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- **Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] os
@roy : yes , kind of , i didnt know the exact technical term for it. Not exactly PCB but process can maintain a lookup table for all the shared variable and there corresposing threads . or for every thread the shared variable. or ,may be in the thread itself, you can have a linked list pointer which points to all the shared variable list. Before terminating , get that address. I mean it is imagination, i suggested some ways but i exactly dont know what Windows or Unix employs to do the task. On Sun, Aug 14, 2011 at 3:03 PM, aalam roy aalamr...@gmail.com wrote: @ankur i think you are talking about cleanup handlers. these are the functions which are executed when a thread terminates. but can you give any hint how it can be accomplished using process control block. On Sun, Aug 14, 2011 at 2:15 PM, Kamakshii Aggarwal kamakshi...@gmail.com wrote: @ankur::nahi samajh aaya..:( On Sun, Aug 14, 2011 at 9:46 AM, Ankur Khurana ankur.kkhur...@gmail.comwrote: My 2 cents, When the termination signal is sent to the thread either synchronously or asynchronously , you just have a mechanism in place that if that thread is in critical section , it exits from there and and unlocks the mutex at point of exit. This can be done by associating a tokken with the thread that it is executing in critical section and what mutex it locked. O we can do this by making some table in Process control block. On Sat, Aug 13, 2011 at 7:56 PM, Kamakshii Aggarwal kamakshi...@gmail.com wrote: How do you make sure to unlock a mutex which was locked in a thread that dies/terminates? -- Regards, Kamakshi kamakshi...@gmail.com -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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, Kamakshi kamakshi...@gmail.com -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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]
Kamz: Maafi :P , did a silly mistake. On Sun, Aug 14, 2011 at 2:12 PM, Kamakshii Aggarwal kamakshi...@gmail.comwrote: @ankur:tere code se wrong answer ayegafor n=4 there are 5 solutions... therefore arr[2]should be 2,par teer code me its 1... arr[1]=1 arr[2]=2; now start from arr[3]; On Sun, Aug 14, 2011 at 9:57 AM, Ankur Khurana ankur.kkhur...@gmail.comwrote: it's a simple dp , ned not be knapsack one. int arr[n]; arr[0]=0 arr[1]=1; for(int i=2;i=n;i++) { arr[i]=arr[i-1]+arr[i-2]; } do you get the code ? i mean , pseudo code was almost similar. On Sun, Aug 14, 2011 at 1:34 AM, sagar pareek sagarpar...@gmail.comwrote: Sorry 4 above post i thought it a diff ques On Sun, Aug 14, 2011 at 1:33 AM, sagar pareek sagarpar...@gmail.comwrote: its n/2+1 On Sat, Aug 13, 2011 at 8:45 PM, Puneet Goyal puneetgoya...@gmail.comwrote: I think it's fibonacci series... T(n)= T(n-1) + T(n-2) Explanation: T(n): no. of ways for n stairs T(n-1): when it took the first step as 1 stair t(n-2): when it took the first step as 2 stairs the series can be started as T(1)=1 T(2)=2 and calculate the rest from above On Sat, Aug 13, 2011 at 8:37 PM, Gaurav Menghani gaurav.mengh...@gmail.com wrote: Knapsack DP On Sat, Aug 13, 2011 at 8:35 PM, Kamakshii Aggarwal kamakshi...@gmail.com wrote: yes On Sat, Aug 13, 2011 at 8:30 PM, Puneet Goyal puneetgoya...@gmail.com wrote: 1 or 2 stairs? On Sat, Aug 13, 2011 at 8:24 PM, Kamakshii Aggarwal kamakshi...@gmail.com wrote: Given n stairs, how many number of ways can you climb if u use either 1 or 2 at a time? -- Regards, Kamakshi kamakshi...@gmail.com -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- --- Puneet Goyal Student of B. Tech. III Year (Software Engineering) Delhi Technological University, Delhi --- -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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, Kamakshi kamakshi...@gmail.com -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Gaurav Menghani -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- --- Puneet Goyal Student of B. Tech. III Year (Software Engineering) Delhi Technological University, Delhi --- -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- **Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT ALLAHABAD -- **Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send 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] Array Problem
any O(nlogn) solution? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/7Q8DHLIlbDoJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: atrenta
Hey neha whch colg r u in?? has atrenta visited ur colg?? If yes plz provide the details and some questions as well...its visiting our campus soon... On Aug 11, 12:47 pm, Neha Sharan neharick...@gmail.com wrote: atrenta is coming in my campus..if anyone know the recruiting procedure or have the placement papers..plz share. thanks with regards neha -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] MORGAN CAMPUS VISIT
Hi everyone, does anyone know how to crack the MORGAN STANLEY written.. Pls helpThanks in advance!!! -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: an array question
isn't it a simple question of applying radix sort from most significant to least signigicant digit and concatenating all the sorted numbers to get the largest number.. On Sat, Aug 13, 2011 at 11:13 PM, Kunal Patil kp101...@gmail.com wrote: Let me clarify. Lets take example 53 147 1471470 As per algo: sort 5353535 , 1471471 and 1471470 lexicographically to get answer. But You are not going to compare all these simultaneously. Might be you will first compare 53 and 147 for lexicographical order. In this case you are not required to calculate till max length. In fact while comparing two strings you will require only till (max(len1, len2)). (verify it !!) Comparing 53 and 1471470 doesn't even require till max length. Comparing 147 and 1471470 (co-incidentally) requires till max length. (worst case !) Consider you have only 2 strings. Then above code gives lexicographically largest of these two (This comparison is considering circular appending). You can now use this comparator function as parameter for sort() function in c++. So given set of strings as the input and this comparator function it will sort as per given criteria. I mentioned you have to append circularly till largest of all string length only for illustration purpose and to make understanding easier. Had I mentioned go on comparing each of 2 strings till max(len1,len2), It might not be grasped quickly. As you can see you will not always require string upto largest length to determine lexicographical order of 2 strings. I am bad at explaining things. So let me know whether this solved your doubt. On Sat, Aug 13, 2011 at 10:35 PM, aditi garg aditi.garg.6...@gmail.comwrote: @ kunal : arent we supposed to construct the string fr each number equal to the max length of any number... whr r v doing dat chking in dis algo? On Sat, Aug 13, 2011 at 10:25 PM, Kunal Patil kp101...@gmail.com wrote: I dont know whether this is best approach to do step 2 or not. But it's certainly good. //I will show for two strings s1 and s2 len1 = s1.length(); len2 = s2.length(); ind1 = 0; //Index in the first string ind2 = 0; //Index in the second string while( ind1len1 || ind2 len2 ) //Match until both strings exhaust or function returns { if(ind1 == len1) // String s1 has exhausted, so start over it ind1 = 0; if(ind2 == len2) // String s2 has exhausted, so start over it ind2 = 0; for(; ind1 len1 ind2 len2; ind1++,ind2++ ) // Go on comparing until any of the string exhausts or function returns { if( s1[ind1] == s2[ind2] ) //Same current char in both string so we need to match more char continue; else // mismatch return (s1[ind1] s2 [ind2] ); } } if (ind1==len1 ind2==len2) // same strings return true; //If I missed anything in the code, let me know On Sat, Aug 13, 2011 at 9:29 PM, aditi garg aditi.garg.6...@gmail.comwrote: @kunal: what is the best way to implement step 2? On Sat, Aug 13, 2011 at 7:33 PM, Ashish Sachdeva ashish.asachd...@gmail.com wrote: @kunal: seems fine.. tried it on some cases... On Sat, Aug 13, 2011 at 5:17 PM, Kunal Patil kp101...@gmail.comwrote: Following approach should work: 1) Count max number of digit in any integer of input. Let it be m. (Thanks to dave..) 2) For each int having less than m digits: Convert it to string of length m where you append circularly. For e.g. if m=5 53 -- 53535 100 -- 10010 34343 -- 34343 8 -- 8 3) Now lexicographically sort all those strings. Apply same permutations to first array of integers. (again, thanx to Dave) 4) Concatenate integers of first array. For e.g. 8 53 147 159 1471470 71 m=7 corresponding string array becomes: 888 5353535 1471471 1591591 1471470 7171717 Apply step 3. This gives int array as 8 71 53 15 147 1471470 Thus, solution is 87153151471471470. Let me know about any counter-examples... You can apply tricks in programming language that will allow you to save actually calculating these strings. For e.g. while comparing two unequal length strings char by char if you find chars of str1 have exhausted but not of str2, you can set index in str1 to start of the str1 and continue comparison. On Sat, Aug 13, 2011 at 2:06 PM, Ashish Sachdeva ashish.asachd...@gmail.com wrote: @ $: how ll you manage something like this: 2,3,100,90,10 2nd array becomes: 200,300,100,900,100 descendng order: 900,300,200,100,100 how to take care which 100 is of 10 cos we need 10 1st...?? On Aug 13, 1:00 pm, rahul aravind rahularavin...@gmail.com wrote: awesome alogoritm dave:):) On Fri, Aug 12, 2011 at 6:48 PM, Dave dave_and_da...@juno.com wrote: @Yasir: I think the following will work. Counterexamples welcome. Find the number of digits in each of the integers, and find the max of that number, say m. Fill a second array as follows: If the ith integer has m
Re: [algogeeks] string confusion
@ Gaurav: in ASCII code : '\0' is actually 0, if you are confused with '0' and 0, first one the character and later one is Remember that '0' is not 0 in ASCII, rather value of '0' is 48. So they can be used in place of each other. [ Just expanding what Sagar is trying to say] On 14 August 2011 14:32, sagar pareek sagarpar...@gmail.com wrote: arshad u got my point or not? On Sun, Aug 14, 2011 at 1:16 PM, Arshad Alam alam3...@gmail.com wrote: program is running smooth but I have one confusion at line number 8. why it is *while(s[i]!=0)* instead of *while(s[i]!='\0')* 1.#includestdio.h 2.#includeconio.h 3.void main() 4.{ 5.clrscr(); 6.char s[]=No two viruses; 7.int i=0; 8.while(s[i]!=0) 9.{ 10.printf(\n%c %c,s[i],*(s+i)); 11.printf ( \n%c %c,i[s],*(i+s)); 12.i++; 13. } 14. getch(); 15.} Thanks Regards Arshad Nadeem Alam -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- **Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- ___ Please do not print this e-mail until urgent requirement. Go Green!! Save Papers = Save Trees -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] samsung
can anyone tell me about the format of the samsung(seso) placement paper.and from where to prepare for this. thanks in davance -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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]
I am afraid you are wrong Rahul Aravind: the o/p won't be a space all the time. the point to note is the format in which i/p is accepted,( the char *format passed in scanf() ) i.e *\*%[^\]*\* The i/p format should be abcd (marked as red in above for the ). the string abcd will be considered for i/p only. But there is a catch, the character set associated with the input. %[^\] This represents that the only input that can be accepted is ^ or \ (because we can't input a ) here is a sample input and output. This clarify more what I want to say http://ideone.com/7PhyQ -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/NFLMob3vKPkJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: atrenta
written test format- part1.technical c:- and c++ questions; part2:hardware ques-gates,multipleseretc part3:aptitude quest -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] SISO
Samsung india Software operations is visiting our campus ... can u plz tell about the recruitment process -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] de shaw
came across this on other forum.. http://forums.sureshkumar.net/de-shaw-placement-papers/17885-deshaw-technical-questions.html On 13 August 2011 23:32, sukran dhawan sukrandha...@gmail.com wrote: MVIT ? On Sat, Aug 13, 2011 at 9:02 PM, Dipankar Patro dip10c...@gmail.comwrote: Which college? On 13 August 2011 20:52, ravinder s ravinderr...@gmail.com wrote: hi can anyone tell me the pattern of de shaw ? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- ___ Please do not print this e-mail until urgent requirement. Go Green!! Save Papers = Save Trees -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- ___ Please do not print this e-mail until urgent requirement. Go Green!! Save Papers = Save Trees -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: an array question
@ankur: No its not radix sort...radix sort would give wrong answer when the input contains heterogeneous numbered digits in the array(even when going 4m msd to lsd)... eg: 32,583,678,1,45,9 Radix sort would give: 9,583,678,45,32,1 whereas the answer has to be: 9,678,543,45,32,1 and hence largest no created is 967854345321 I think thats the way radix sort will work... Correct me if i m wrong...! On 8/14/11, Ankur Khurana ankur.kkhur...@gmail.com wrote: isn't it a simple question of applying radix sort from most significant to least signigicant digit and concatenating all the sorted numbers to get the largest number.. On Sat, Aug 13, 2011 at 11:13 PM, Kunal Patil kp101...@gmail.com wrote: Let me clarify. Lets take example 53 147 1471470 As per algo: sort 5353535 , 1471471 and 1471470 lexicographically to get answer. But You are not going to compare all these simultaneously. Might be you will first compare 53 and 147 for lexicographical order. In this case you are not required to calculate till max length. In fact while comparing two strings you will require only till (max(len1, len2)). (verify it !!) Comparing 53 and 1471470 doesn't even require till max length. Comparing 147 and 1471470 (co-incidentally) requires till max length. (worst case !) Consider you have only 2 strings. Then above code gives lexicographically largest of these two (This comparison is considering circular appending). You can now use this comparator function as parameter for sort() function in c++. So given set of strings as the input and this comparator function it will sort as per given criteria. I mentioned you have to append circularly till largest of all string length only for illustration purpose and to make understanding easier. Had I mentioned go on comparing each of 2 strings till max(len1,len2), It might not be grasped quickly. As you can see you will not always require string upto largest length to determine lexicographical order of 2 strings. I am bad at explaining things. So let me know whether this solved your doubt. On Sat, Aug 13, 2011 at 10:35 PM, aditi garg aditi.garg.6...@gmail.comwrote: @ kunal : arent we supposed to construct the string fr each number equal to the max length of any number... whr r v doing dat chking in dis algo? On Sat, Aug 13, 2011 at 10:25 PM, Kunal Patil kp101...@gmail.com wrote: I dont know whether this is best approach to do step 2 or not. But it's certainly good. //I will show for two strings s1 and s2 len1 = s1.length(); len2 = s2.length(); ind1 = 0; //Index in the first string ind2 = 0; //Index in the second string while( ind1len1 || ind2 len2 ) //Match until both strings exhaust or function returns { if(ind1 == len1) // String s1 has exhausted, so start over it ind1 = 0; if(ind2 == len2) // String s2 has exhausted, so start over it ind2 = 0; for(; ind1 len1 ind2 len2; ind1++,ind2++ ) // Go on comparing until any of the string exhausts or function returns { if( s1[ind1] == s2[ind2] ) //Same current char in both string so we need to match more char continue; else // mismatch return (s1[ind1] s2 [ind2] ); } } if (ind1==len1 ind2==len2) // same strings return true; //If I missed anything in the code, let me know On Sat, Aug 13, 2011 at 9:29 PM, aditi garg aditi.garg.6...@gmail.comwrote: @kunal: what is the best way to implement step 2? On Sat, Aug 13, 2011 at 7:33 PM, Ashish Sachdeva ashish.asachd...@gmail.com wrote: @kunal: seems fine.. tried it on some cases... On Sat, Aug 13, 2011 at 5:17 PM, Kunal Patil kp101...@gmail.comwrote: Following approach should work: 1) Count max number of digit in any integer of input. Let it be m. (Thanks to dave..) 2) For each int having less than m digits: Convert it to string of length m where you append circularly. For e.g. if m=5 53 -- 53535 100 -- 10010 34343 -- 34343 8 -- 8 3) Now lexicographically sort all those strings. Apply same permutations to first array of integers. (again, thanx to Dave) 4) Concatenate integers of first array. For e.g. 8 53 147 159 1471470 71 m=7 corresponding string array becomes: 888 5353535 1471471 1591591 1471470 7171717 Apply step 3. This gives int array as 8 71 53 15 147 1471470 Thus, solution is 87153151471471470. Let me know about any counter-examples... You can apply tricks in programming language that will allow you to save actually calculating these strings. For e.g. while comparing two unequal length strings char by char if you find chars of str1 have exhausted but not of str2, you can set index in str1 to start of the str1 and continue comparison. On Sat, Aug 13, 2011 at 2:06 PM, Ashish Sachdeva ashish.asachd...@gmail.com wrote: @ $: how ll you manage something like this: 2,3,100,90,10 2nd array becomes: 200,300,100,900,100 descendng order: 900,300,200,100,100 how to
[algogeeks] c++
Can someone please mail good c++ materials. If you guys have test your c++ skills by kanetkar plz upload. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] Doubt !!!!!!
Please explain this ... #includestdio.h int main() { int *p[10]; printf(%d,sizeof(*p)); return 0; } Output is 4 For this program #includestdio.h int main() { int *p[10][20]; printf(%d,sizeof(*p)); return 0; } Output is 80 (10*20*sizeof(int)) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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 doubt
what is the logic of your concept On Aug 13, 5:01 pm, Kunal Patil kp101...@gmail.com wrote: @rohit: Cast pointer to an integer into an int to get what you are expecting. for e.g. printf(%d,(int)a[4]-(int)a[0]); This will give 16. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] Doubt !!!!!!
in the first code the output is 4 bcoz *p means *p[0] that means p[0] that is some address so for 32 bit machine its coming to be 4 bytes.. in the 2nd it is 80 as 20*sizeof(int *) and not as you mentioned.. On Sun, Aug 14, 2011 at 6:12 PM, rShetty rajeevr...@gmail.com wrote: Please explain this ... #includestdio.h int main() { int *p[10]; printf(%d,sizeof(*p)); return 0; } Output is 4 For this program #includestdio.h int main() { int *p[10][20]; printf(%d,sizeof(*p)); return 0; } Output is 80 (10*20*sizeof(int)) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] Doubt !!!!!!
@rshetty for the first code u have array as : --_ _ _ _ _ _ _ _ _ _ ( _ denotes block of int) so sizeof(*p) is ofcourse give you sze of int now u have int *p[10][20]; which can be viewed as _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ now *p is first 20 blocks (mean first whole row) which gives you sizeof(*p) as sizeof(int)*20 which is *not equal* to sizeof(int)*20**10; * On Sun, Aug 14, 2011 at 6:12 PM, rShetty rajeevr...@gmail.com wrote: Please explain this ... #includestdio.h int main() { int *p[10]; printf(%d,sizeof(*p)); return 0; } Output is 4 For this program #includestdio.h int main() { int *p[10][20]; printf(%d,sizeof(*p)); return 0; } Output is 80 (10*20*sizeof(int)) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- **Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks]
small correction in my above explanation the %[^\] will accept the input till it doesn't encounter a Missed the ^ (XOR) operation completely. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/Tn6jNNCGeWoJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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]
the input should start with \ and end with \ . in between you can take any string . On Sun, Aug 14, 2011 at 6:35 PM, Poised~ dip10c...@gmail.com wrote: small correction in my above explanation the %[^\] will accept the input till it doesn't encounter a Missed the ^ (XOR) operation completely. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/Tn6jNNCGeWoJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] array question
given two arrays : with all distinct elements but one element in common. Find the common element in optimal time. -- *MOHIT VERMA* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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]
@aditya i think the input should start with and also end with On Sun, Aug 14, 2011 at 6:38 PM, aditya kumar aditya.kumar130...@gmail.comwrote: the input should start with \ and end with \ . in between you can take any string . On Sun, Aug 14, 2011 at 6:35 PM, Poised~ dip10c...@gmail.com wrote: small correction in my above explanation the %[^\] will accept the input till it doesn't encounter a Missed the ^ (XOR) operation completely. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/Tn6jNNCGeWoJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards, Kamakshi kamakshi...@gmail.com -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks]
no, input should start and end with a On Sun, Aug 14, 2011 at 6:38 PM, aditya kumar aditya.kumar130...@gmail.comwrote: the input should start with \ and end with \ . in between you can take any string . On Sun, Aug 14, 2011 at 6:35 PM, Poised~ dip10c...@gmail.com wrote: small correction in my above explanation the %[^\] will accept the input till it doesn't encounter a Missed the ^ (XOR) operation completely. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/Tn6jNNCGeWoJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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 question
meaning ? what is a common element ? example ??? On Sun, Aug 14, 2011 at 6:37 PM, mohit verma mohit89m...@gmail.com wrote: given two arrays : with all distinct elements but one element in common. Find the common element in optimal time. -- *MOHIT VERMA* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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 question
example: array 1 :: 1 2 3 4 5 6 7 8 9 10 15 array 2:: 23 34 56 13 15 57 432 348 On Sun, Aug 14, 2011 at 6:44 PM, shady sinv...@gmail.com wrote: meaning ? what is a common element ? example ??? On Sun, Aug 14, 2011 at 6:37 PM, mohit verma mohit89m...@gmail.comwrote: given two arrays : with all distinct elements but one element in common. Find the common element in optimal time. -- *MOHIT VERMA* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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. -- *MOHIT VERMA* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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 question
how about binary search of each element from array 1 on array 2? overall complexity : O(nlogn) On 14 August 2011 18:46, mohit verma mohit89m...@gmail.com wrote: example: array 1 :: 1 2 3 4 5 6 7 8 9 10 15 array 2:: 23 34 56 13 15 57 432 348 On Sun, Aug 14, 2011 at 6:44 PM, shady sinv...@gmail.com wrote: meaning ? what is a common element ? example ??? On Sun, Aug 14, 2011 at 6:37 PM, mohit verma mohit89m...@gmail.comwrote: given two arrays : with all distinct elements but one element in common. Find the common element in optimal time. -- *MOHIT VERMA* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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. -- *MOHIT VERMA* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- ___ Please do not print this e-mail until urgent requirement. Go Green!! Save Papers = Save Trees -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] array question
Hashing O(n+m) On Sun, Aug 14, 2011 at 6:48 PM, Dipankar Patro dip10c...@gmail.com wrote: how about binary search of each element from array 1 on array 2? overall complexity : O(nlogn) On 14 August 2011 18:46, mohit verma mohit89m...@gmail.com wrote: example: array 1 :: 1 2 3 4 5 6 7 8 9 10 15 array 2:: 23 34 56 13 15 57 432 348 On Sun, Aug 14, 2011 at 6:44 PM, shady sinv...@gmail.com wrote: meaning ? what is a common element ? example ??? On Sun, Aug 14, 2011 at 6:37 PM, mohit verma mohit89m...@gmail.comwrote: given two arrays : with all distinct elements but one element in common. Find the common element in optimal time. -- *MOHIT VERMA* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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. -- *MOHIT VERMA* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- ___ Please do not print this e-mail until urgent requirement. Go Green!! Save Papers = Save Trees -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- **Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] array question
@ Sagar: What if extra space in not allowed? I think then we have to use the binary search method... On 14 August 2011 18:50, sagar pareek sagarpar...@gmail.com wrote: Hashing O(n+m) On Sun, Aug 14, 2011 at 6:48 PM, Dipankar Patro dip10c...@gmail.comwrote: how about binary search of each element from array 1 on array 2? overall complexity : O(nlogn) On 14 August 2011 18:46, mohit verma mohit89m...@gmail.com wrote: example: array 1 :: 1 2 3 4 5 6 7 8 9 10 15 array 2:: 23 34 56 13 15 57 432 348 On Sun, Aug 14, 2011 at 6:44 PM, shady sinv...@gmail.com wrote: meaning ? what is a common element ? example ??? On Sun, Aug 14, 2011 at 6:37 PM, mohit verma mohit89m...@gmail.comwrote: given two arrays : with all distinct elements but one element in common. Find the common element in optimal time. -- *MOHIT VERMA* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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. -- *MOHIT VERMA* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- ___ Please do not print this e-mail until urgent requirement. Go Green!! Save Papers = Save Trees -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- ** Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- ___ Please do not print this e-mail until urgent requirement. Go Green!! Save Papers = Save Trees -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] array question
@sagar suppose numbers are very large( 10^9) , how will you hash then ? can you please state the hashing function in this case On Sun, Aug 14, 2011 at 6:50 PM, sagar pareek sagarpar...@gmail.com wrote: Hashing O(n+m) On Sun, Aug 14, 2011 at 6:48 PM, Dipankar Patro dip10c...@gmail.comwrote: how about binary search of each element from array 1 on array 2? overall complexity : O(nlogn) On 14 August 2011 18:46, mohit verma mohit89m...@gmail.com wrote: example: array 1 :: 1 2 3 4 5 6 7 8 9 10 15 array 2:: 23 34 56 13 15 57 432 348 On Sun, Aug 14, 2011 at 6:44 PM, shady sinv...@gmail.com wrote: meaning ? what is a common element ? example ??? On Sun, Aug 14, 2011 at 6:37 PM, mohit verma mohit89m...@gmail.comwrote: given two arrays : with all distinct elements but one element in common. Find the common element in optimal time. -- *MOHIT VERMA* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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. -- *MOHIT VERMA* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- ___ Please do not print this e-mail until urgent requirement. Go Green!! Save Papers = Save Trees -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- **Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Doubt !!!!!!
@anika and sagar : Thanks Got it. On Sun, Aug 14, 2011 at 6:25 PM, sagar pareek sagarpar...@gmail.com wrote: @rshetty for the first code u have array as : --_ _ _ _ _ _ _ _ _ _ ( _ denotes block of int) so sizeof(*p) is ofcourse give you sze of int now u have int *p[10][20]; which can be viewed as _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ now *p is first 20 blocks (mean first whole row) which gives you sizeof(*p) as sizeof(int)*20 which is *not equal* to sizeof(int)*20**10; * On Sun, Aug 14, 2011 at 6:12 PM, rShetty rajeevr...@gmail.com wrote: Please explain this ... #includestdio.h int main() { int *p[10]; printf(%d,sizeof(*p)); return 0; } Output is 4 For this program #includestdio.h int main() { int *p[10][20]; printf(%d,sizeof(*p)); return 0; } Output is 80 (10*20*sizeof(int)) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- **Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards Rajeev N B http://www.opensourcemania.co.cc *Winners Don't do Different things , they do things Differently* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] what is the difference between a class and structure in c++? pl help
-- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] what is the difference between a class and structure in c++? pl help
Class by default is private and struct by default is public. On Sun, Aug 14, 2011 at 7:13 PM, programming love love.for.programm...@gmail.com wrote: -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards Rajeev N B http://www.opensourcemania.co.cc *Winners Don't do Different things , they do things Differently* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: an array question
why will 678 come after 583 ? okay ., sort from least to most significant digit. append imaginary 0's at the end of the numbers with varying length to make them of same length On Sun, Aug 14, 2011 at 5:54 PM, Puneet Gautam puneet.nsi...@gmail.comwrote: @ankur: No its not radix sort...radix sort would give wrong answer when the input contains heterogeneous numbered digits in the array(even when going 4m msd to lsd)... eg: 32,583,678,1,45,9 Radix sort would give: 9,583,678,45,32,1 whereas the answer has to be: 9,678,543,45,32,1 and hence largest no created is 967854345321 I think thats the way radix sort will work... Correct me if i m wrong...! On 8/14/11, Ankur Khurana ankur.kkhur...@gmail.com wrote: isn't it a simple question of applying radix sort from most significant to least signigicant digit and concatenating all the sorted numbers to get the largest number.. On Sat, Aug 13, 2011 at 11:13 PM, Kunal Patil kp101...@gmail.com wrote: Let me clarify. Lets take example 53 147 1471470 As per algo: sort 5353535 , 1471471 and 1471470 lexicographically to get answer. But You are not going to compare all these simultaneously. Might be you will first compare 53 and 147 for lexicographical order. In this case you are not required to calculate till max length. In fact while comparing two strings you will require only till (max(len1, len2)). (verify it !!) Comparing 53 and 1471470 doesn't even require till max length. Comparing 147 and 1471470 (co-incidentally) requires till max length. (worst case !) Consider you have only 2 strings. Then above code gives lexicographically largest of these two (This comparison is considering circular appending). You can now use this comparator function as parameter for sort() function in c++. So given set of strings as the input and this comparator function it will sort as per given criteria. I mentioned you have to append circularly till largest of all string length only for illustration purpose and to make understanding easier. Had I mentioned go on comparing each of 2 strings till max(len1,len2), It might not be grasped quickly. As you can see you will not always require string upto largest length to determine lexicographical order of 2 strings. I am bad at explaining things. So let me know whether this solved your doubt. On Sat, Aug 13, 2011 at 10:35 PM, aditi garg aditi.garg.6...@gmail.comwrote: @ kunal : arent we supposed to construct the string fr each number equal to the max length of any number... whr r v doing dat chking in dis algo? On Sat, Aug 13, 2011 at 10:25 PM, Kunal Patil kp101...@gmail.com wrote: I dont know whether this is best approach to do step 2 or not. But it's certainly good. //I will show for two strings s1 and s2 len1 = s1.length(); len2 = s2.length(); ind1 = 0; //Index in the first string ind2 = 0; //Index in the second string while( ind1len1 || ind2 len2 ) //Match until both strings exhaust or function returns { if(ind1 == len1) // String s1 has exhausted, so start over it ind1 = 0; if(ind2 == len2) // String s2 has exhausted, so start over it ind2 = 0; for(; ind1 len1 ind2 len2; ind1++,ind2++ ) // Go on comparing until any of the string exhausts or function returns { if( s1[ind1] == s2[ind2] ) //Same current char in both string so we need to match more char continue; else // mismatch return (s1[ind1] s2 [ind2] ); } } if (ind1==len1 ind2==len2) // same strings return true; //If I missed anything in the code, let me know On Sat, Aug 13, 2011 at 9:29 PM, aditi garg aditi.garg.6...@gmail.comwrote: @kunal: what is the best way to implement step 2? On Sat, Aug 13, 2011 at 7:33 PM, Ashish Sachdeva ashish.asachd...@gmail.com wrote: @kunal: seems fine.. tried it on some cases... On Sat, Aug 13, 2011 at 5:17 PM, Kunal Patil kp101...@gmail.comwrote: Following approach should work: 1) Count max number of digit in any integer of input. Let it be m. (Thanks to dave..) 2) For each int having less than m digits: Convert it to string of length m where you append circularly. For e.g. if m=5 53 -- 53535 100 -- 10010 34343 -- 34343 8 -- 8 3) Now lexicographically sort all those strings. Apply same permutations to first array of integers. (again, thanx to Dave) 4) Concatenate integers of first array. For e.g. 8 53 147 159 1471470 71 m=7 corresponding string array becomes: 888 5353535 1471471 1591591 1471470 7171717 Apply step 3. This gives int array as 8 71 53 15 147 1471470 Thus, solution is 87153151471471470. Let me know about any counter-examples... You can apply tricks in programming language that will allow you to save actually calculating these strings. For e.g.
Re: [algogeeks] shop keeper and the buyer
no one to help ?? On Sat, Aug 13, 2011 at 10:48 PM, Prakash D cegprak...@gmail.com wrote: k lets assume that there are 10 kinds of item in the shop price[]={10,20,30,40,50,60,70,80,90,100} quantity[]={5,5,5,5,5,5,5,5,5,5} say no.of items having some free discounts : 5 say p,q,r denotes buying q nos. of p we will get one r for free.. let them be 5 4 1 2 5 1 8 2 10 9 1 10 1 5 10 explain for this case.. how will u proceed? On Sat, Aug 13, 2011 at 7:25 PM, Aditya Virmani virmanisadi...@gmail.comwrote: if k is fixed, sort the items according to their price, buy k cheapest items start taking the most expensive item fr free -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] Hashing vs trie
Suppose you have a large file with lots of words. How would you find the unique words and their count? What kind of data structure u will use? What will be the time complexity and space complexity? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/kYAHxwwsDh0J. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: atrenta
@ raj : do dey ask questions based on gate even for software profile??and wat is multiple seretc??? On Sun, Aug 14, 2011 at 5:08 PM, raj singh ankurkaku...@gmail.com wrote: written test format- part1.technical c:- and c++ questions; part2:hardware ques-gates,multipleseretc part3:aptitude quest -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New Delhi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: Hashing vs trie
My doubt: If we use hashing, then how do we map a string. I am using C. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/aURuTmAx6jEJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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 question
i feel binary search idea is the best guys i am having problem in finding out complexity...here is my solution to the above problem...whats the complexity... sort the 2 arraysa and b l=0,i=0,flag=0; while(a[i]b[0]) // to start comparing from the value that is slightly greater than the first i++; //element of second array for(i;in;i++) { j=l; while(a[i]=b[j]) { if(a[i]==b[j]) { printf(Common element is %d,a[i]); flag=1 break; } j++; l=j; } if(flag==1) break; } On Sun, Aug 14, 2011 at 6:55 PM, shady sinv...@gmail.com wrote: @sagar suppose numbers are very large( 10^9) , how will you hash then ? can you please state the hashing function in this case On Sun, Aug 14, 2011 at 6:50 PM, sagar pareek sagarpar...@gmail.com wrote: Hashing O(n+m) On Sun, Aug 14, 2011 at 6:48 PM, Dipankar Patro dip10c...@gmail.com wrote: how about binary search of each element from array 1 on array 2? overall complexity : O(nlogn) On 14 August 2011 18:46, mohit verma mohit89m...@gmail.com wrote: example: array 1 :: 1 2 3 4 5 6 7 8 9 10 15 array 2:: 23 34 56 13 15 57 432 348 On Sun, Aug 14, 2011 at 6:44 PM, shady sinv...@gmail.com wrote: meaning ? what is a common element ? example ??? On Sun, Aug 14, 2011 at 6:37 PM, mohit verma mohit89m...@gmail.com wrote: given two arrays : with all distinct elements but one element in common. Find the common element in optimal time. -- MOHIT VERMA -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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. -- MOHIT VERMA -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- ___ Please do not print this e-mail until urgent requirement. Go Green!! Save Papers = Save Trees -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: Algorithms for Interviews _scan ocr_.pdf
thank u aditi.. sindhu Student of B. Tech. IV Year -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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 question
doesnt matter Order will be (nlogn) where n is max(elements in first set, elements in 2nd set) PS : dont submit codes from next time On Sun, Aug 14, 2011 at 7:43 PM, Nikhil Veliath nve...@gmail.com wrote: i feel binary search idea is the best guys i am having problem in finding out complexity...here is my solution to the above problem...whats the complexity... sort the 2 arraysa and b l=0,i=0,flag=0; while(a[i]b[0]) // to start comparing from the value that is slightly greater than the first i++; //element of second array for(i;in;i++) { j=l; while(a[i]=b[j]) { if(a[i]==b[j]) { printf(Common element is %d,a[i]); flag=1 break; } j++; l=j; } if(flag==1) break; } On Sun, Aug 14, 2011 at 6:55 PM, shady sinv...@gmail.com wrote: @sagar suppose numbers are very large( 10^9) , how will you hash then ? can you please state the hashing function in this case On Sun, Aug 14, 2011 at 6:50 PM, sagar pareek sagarpar...@gmail.com wrote: Hashing O(n+m) On Sun, Aug 14, 2011 at 6:48 PM, Dipankar Patro dip10c...@gmail.com wrote: how about binary search of each element from array 1 on array 2? overall complexity : O(nlogn) On 14 August 2011 18:46, mohit verma mohit89m...@gmail.com wrote: example: array 1 :: 1 2 3 4 5 6 7 8 9 10 15 array 2:: 23 34 56 13 15 57 432 348 On Sun, Aug 14, 2011 at 6:44 PM, shady sinv...@gmail.com wrote: meaning ? what is a common element ? example ??? On Sun, Aug 14, 2011 at 6:37 PM, mohit verma mohit89m...@gmail.com wrote: given two arrays : with all distinct elements but one element in common. Find the common element in optimal time. -- MOHIT VERMA -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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. -- MOHIT VERMA -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- ___ Please do not print this e-mail until urgent requirement. Go Green!! Save Papers = Save Trees -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] c++
accelrated c++ On 8/14/11, programming love love.for.programm...@gmail.com wrote: Can someone please mail good c++ materials. If you guys have test your c++ skills by kanetkar plz upload. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- --- Rahul -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: Printing a Number triangle
I was asked to find out the no of rows given n . i.e. how we say 4 rows for 10 ??? On 14 Aug 2011 10:54, sagar pareek sagarpar...@gmail.com wrote: here is sudo code take two variables int max=1; int count=1; int i,total_no_of_rows; while(total_no_of_rows--) { for(i=0;icount;i++) { printf(%d ,max-i); } printf(\n); count++; max+=count; } On Sun, Aug 14, 2011 at 10:25 AM, Rahul raikra...@gmail.com wrote: @Beginner If You Know How to implement a series whose difference in terms form An Arithmetic Progression Then Is quite easy to print the (n)TH Line Add n to the highest number seen so far and then subtract the 1 for n times (p = n-- , check for p ) @Everyone Else Can anyone one think of a more elegant method , to find #rows Rahul On Sun, Aug 14, 2011 at 10:09 AM, Ankur Khurana ankur.kkhur...@gmail.com wrote: to print from 10 to 7 in the row number 4. here prev will be 6. On Sun, Aug 14, 2011 at 10:05 AM, AASHISH SUMAN aashish.barn...@gmail.com wrote: @ankur what is the need of prev=((i-)*i)/2; On Sun, Aug 14, 2011 at 9:51 AM, Ankur Khurana ankur.kkhur...@gmail.com wrote: see , we can see that first lline have 1 number, second have 2 and third have 3 .and so on. we can observe that first number of every row is sum of first k narutal number, where k is the row number. so for k=4, n=((4+1)*4)/2=10; so run a for loop, for(int i=1;inum_rows;i++) { prev=((i-)*i)/2; k=((i+1)*i)/2; for(int j=k;i;kprev;j--) { coutprev ; } coutendl; } On Sun, Aug 14, 2011 at 9:43 AM, Dave dave_and_da...@juno.com wrote: @Beginner: The largest number n in row r satisfies n = (r^2 + r) / 2. So using the Quadratic Formula gives r = ( sqrt( 8*n + 1 ) - 1 ) / 2. For the row number r for any n (not necessarily the largest one in a row), r = ceil( sqrt( 8*n + 1 ) - 1 ) / 2 ) where ceil( x ) is the smallest integer not exceeding x. Dave On Aug 13, 10:22 pm, Beginner murugavidya1...@gmail.com wrote: How to print this triangle? 1 3 2 6 5 4 10 9 8 7 and how to find the number of rows if n is given? For ex if n=10 how to find num of rows=4?? Is it Log 10 to the base of 2!! -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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 BEST REGARDS : AASHISH SUMAN MCA FINAL YEAR * *NIT DURGAPUR* *+91-9547969906* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- **Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Printing a Number triangle
Dave has given you the formula Rahul On Sun, Aug 14, 2011 at 7:49 PM, muruga vel murugavidya1...@gmail.comwrote: I was asked to find out the no of rows given n . i.e. how we say 4 rows for 10 ??? On 14 Aug 2011 10:54, sagar pareek sagarpar...@gmail.com wrote: here is sudo code take two variables int max=1; int count=1; int i,total_no_of_rows; while(total_no_of_rows--) { for(i=0;icount;i++) { printf(%d ,max-i); } printf(\n); count++; max+=count; } On Sun, Aug 14, 2011 at 10:25 AM, Rahul raikra...@gmail.com wrote: @Beginner If You Know How to implement a series whose difference in terms form An Arithmetic Progression Then Is quite easy to print the (n)TH Line Add n to the highest number seen so far and then subtract the 1 for n times (p = n-- , check for p ) @Everyone Else Can anyone one think of a more elegant method , to find #rows Rahul On Sun, Aug 14, 2011 at 10:09 AM, Ankur Khurana ankur.kkhur...@gmail.comwrote: to print from 10 to 7 in the row number 4. here prev will be 6. On Sun, Aug 14, 2011 at 10:05 AM, AASHISH SUMAN aashish.barn...@gmail.com wrote: @ankur what is the need of prev=((i-)*i)/2; On Sun, Aug 14, 2011 at 9:51 AM, Ankur Khurana ankur.kkhur...@gmail.com wrote: see , we can see that first lline have 1 number, second have 2 and third have 3 .and so on. we can observe that first number of every row is sum of first k narutal number, where k is the row number. so for k=4, n=((4+1)*4)/2=10; so run a for loop, for(int i=1;inum_rows;i++) { prev=((i-)*i)/2; k=((i+1)*i)/2; for(int j=k;i;kprev;j--) { coutprev ; } coutendl; } On Sun, Aug 14, 2011 at 9:43 AM, Dave dave_and_da...@juno.com wrote: @Beginner: The largest number n in row r satisfies n = (r^2 + r) / 2. So using the Quadratic Formula gives r = ( sqrt( 8*n + 1 ) - 1 ) / 2. For the row number r for any n (not necessarily the largest one in a row), r = ceil( sqrt( 8*n + 1 ) - 1 ) / 2 ) where ceil( x ) is the smallest integer not exceeding x. Dave On Aug 13, 10:22 pm, Beginner murugavidya1...@gmail.com wrote: How to print this triangle? 1 3 2 6 5 4 10 9 8 7 and how to find the number of rows if n is given? For ex if n=10 how to find num of rows=4?? Is it Log 10 to the base of 2!! -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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 BEST REGARDS : AASHISH SUMAN MCA FINAL YEAR * *NIT DURGAPUR* *+91-9547969906* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- **Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are
[algogeeks] c++ ques
How do you prevent a c++ class from being inherited?? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] SISO
An aptitude test of 1 hour containing 25 question of DI and 25 Puzzle reasoning A technical test of half hour containing 20 question all on c Followed by technical interview HR interview On 8/14/11, parag khanna khanna.para...@gmail.com wrote: Samsung india Software operations is visiting our campus ... can u plz tell about the recruitment process -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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 and Regards *Karan Bagaria* *MCA Final Year* Training and Placement Representative *NIT Durgapur* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: Printing a Number triangle
plz tell me that for this triangle.. if 12 is given then what to do? On Sun, Aug 14, 2011 at 7:49 PM, muruga vel murugavidya1...@gmail.comwrote: I was asked to find out the no of rows given n . i.e. how we say 4 rows for 10 ??? On 14 Aug 2011 10:54, sagar pareek sagarpar...@gmail.com wrote: here is sudo code take two variables int max=1; int count=1; int i,total_no_of_rows; while(total_no_of_rows--) { for(i=0;icount;i++) { printf(%d ,max-i); } printf(\n); count++; max+=count; } On Sun, Aug 14, 2011 at 10:25 AM, Rahul raikra...@gmail.com wrote: @Beginner If You Know How to implement a series whose difference in terms form An Arithmetic Progression Then Is quite easy to print the (n)TH Line Add n to the highest number seen so far and then subtract the 1 for n times (p = n-- , check for p ) @Everyone Else Can anyone one think of a more elegant method , to find #rows Rahul On Sun, Aug 14, 2011 at 10:09 AM, Ankur Khurana ankur.kkhur...@gmail.comwrote: to print from 10 to 7 in the row number 4. here prev will be 6. On Sun, Aug 14, 2011 at 10:05 AM, AASHISH SUMAN aashish.barn...@gmail.com wrote: @ankur what is the need of prev=((i-)*i)/2; On Sun, Aug 14, 2011 at 9:51 AM, Ankur Khurana ankur.kkhur...@gmail.com wrote: see , we can see that first lline have 1 number, second have 2 and third have 3 .and so on. we can observe that first number of every row is sum of first k narutal number, where k is the row number. so for k=4, n=((4+1)*4)/2=10; so run a for loop, for(int i=1;inum_rows;i++) { prev=((i-)*i)/2; k=((i+1)*i)/2; for(int j=k;i;kprev;j--) { coutprev ; } coutendl; } On Sun, Aug 14, 2011 at 9:43 AM, Dave dave_and_da...@juno.com wrote: @Beginner: The largest number n in row r satisfies n = (r^2 + r) / 2. So using the Quadratic Formula gives r = ( sqrt( 8*n + 1 ) - 1 ) / 2. For the row number r for any n (not necessarily the largest one in a row), r = ceil( sqrt( 8*n + 1 ) - 1 ) / 2 ) where ceil( x ) is the smallest integer not exceeding x. Dave On Aug 13, 10:22 pm, Beginner murugavidya1...@gmail.com wrote: How to print this triangle? 1 3 2 6 5 4 10 9 8 7 and how to find the number of rows if n is given? For ex if n=10 how to find num of rows=4?? Is it Log 10 to the base of 2!! -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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 BEST REGARDS : AASHISH SUMAN MCA FINAL YEAR * *NIT DURGAPUR* *+91-9547969906* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- **Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this
Re: [algogeeks] Re: Printing a Number triangle
8 times 12 is 96 96 + 1 is 97 take sqrt(97) 9.8488578017961047217462114149176 now 9.8488578017961047217462114149176 minus 1 EQUALS 8.8488578017961047217462114149176 Half IT And Take The Ceiling of it = 5 On Sun, Aug 14, 2011 at 8:05 PM, Anika Jain anika.jai...@gmail.com wrote: plz tell me that for this triangle.. if 12 is given then what to do? On Sun, Aug 14, 2011 at 7:49 PM, muruga vel murugavidya1...@gmail.comwrote: I was asked to find out the no of rows given n . i.e. how we say 4 rows for 10 ??? On 14 Aug 2011 10:54, sagar pareek sagarpar...@gmail.com wrote: here is sudo code take two variables int max=1; int count=1; int i,total_no_of_rows; while(total_no_of_rows--) { for(i=0;icount;i++) { printf(%d ,max-i); } printf(\n); count++; max+=count; } On Sun, Aug 14, 2011 at 10:25 AM, Rahul raikra...@gmail.com wrote: @Beginner If You Know How to implement a series whose difference in terms form An Arithmetic Progression Then Is quite easy to print the (n)TH Line Add n to the highest number seen so far and then subtract the 1 for n times (p = n-- , check for p ) @Everyone Else Can anyone one think of a more elegant method , to find #rows Rahul On Sun, Aug 14, 2011 at 10:09 AM, Ankur Khurana ankur.kkhur...@gmail.comwrote: to print from 10 to 7 in the row number 4. here prev will be 6. On Sun, Aug 14, 2011 at 10:05 AM, AASHISH SUMAN aashish.barn...@gmail.com wrote: @ankur what is the need of prev=((i-)*i)/2; On Sun, Aug 14, 2011 at 9:51 AM, Ankur Khurana ankur.kkhur...@gmail.com wrote: see , we can see that first lline have 1 number, second have 2 and third have 3 .and so on. we can observe that first number of every row is sum of first k narutal number, where k is the row number. so for k=4, n=((4+1)*4)/2=10; so run a for loop, for(int i=1;inum_rows;i++) { prev=((i-)*i)/2; k=((i+1)*i)/2; for(int j=k;i;kprev;j--) { coutprev ; } coutendl; } On Sun, Aug 14, 2011 at 9:43 AM, Dave dave_and_da...@juno.com wrote: @Beginner: The largest number n in row r satisfies n = (r^2 + r) / 2. So using the Quadratic Formula gives r = ( sqrt( 8*n + 1 ) - 1 ) / 2. For the row number r for any n (not necessarily the largest one in a row), r = ceil( sqrt( 8*n + 1 ) - 1 ) / 2 ) where ceil( x ) is the smallest integer not exceeding x. Dave On Aug 13, 10:22 pm, Beginner murugavidya1...@gmail.com wrote: How to print this triangle? 1 3 2 6 5 4 10 9 8 7 and how to find the number of rows if n is given? For ex if n=10 how to find num of rows=4?? Is it Log 10 to the base of 2!! -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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 BEST REGARDS : AASHISH SUMAN MCA FINAL YEAR * *NIT DURGAPUR* *+91-9547969906* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Ankur Khurana Computer Science Netaji Subhas Institute Of Technology Delhi. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- **Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups
Re: [algogeeks] SISO
itz the same procedure as that of Samsung SEL -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] c++ ques
http://www.parashift.com/c++-faq-lite/strange-inheritance.html#faq-23.8 On 14 August 2011 19:53, programming love love.for.programm...@gmail.comwrote: How do you prevent a c++ class from being inherited?? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- *Dilip Makwana* VJTI BTech Computers Engineering 2009-2013 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: TRee question...
Sorry about the tree, didn't keep in mind about BST while drawing that. But I think you all got the point that I was trying to point out. On 13 August 2011 23:18, rajul jain rajuljain...@gmail.com wrote: see WgpShashank second point carefully it say successor is parent of left node so solution of you BST is parent of 2 which is 4 On Sat, Aug 13, 2011 at 7:50 PM, Anika Jain anika.jai...@gmail.comwrote: @ashmantak: the figure of dipankar is incorrect but his point is correct.. for a tree like 4 /\ 2 10 / \ 13 successor of 3 shall be 4 not 2.. On Fri, Aug 12, 2011 at 4:48 PM, ashmantak ashman...@gmail.com wrote: @Dipankar Patro - The figure u have made isn't a BST.Read the problem. His soln. is correct. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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. -- ___ Please do not print this e-mail until urgent requirement. Go Green!! Save Papers = Save Trees -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] How to solve this problem
This is one question from Coreman 3rd Edition - 8-3-4 -- Sort n integers in the range 0 to n^3 -1 in O(n) time Any ideas how to do this in O(n) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: Closest ancestor of two nodes
Check the c language implementation: node* LeastCommonAncestor(const node* root, const int data1, const int data2, int* const status){ static node* ans = NULL; int l_st=0, r_st=0; if(root==NULL) return; if(root-left != NULL) LeastCommonAncestor(root-left, data1, data2, l_st); if(root-right != NULL) LeastCommonAncestor(root-right, data1, data2, r_st); if(l_st == 3 || r_st == 3)//if both data already found by subtrees return ans; if((l_st|r_st)==3){//if one data found in each subtree *status = 3; ans=root; return ans; } if( ((l_st|r_st)==2 root-data == data1) || ((l_st|r_st)==1 root-data == data2) ){ //if one data found in subtree and other is root itself ans = root; *status =3;} else//record if any one data found (case when both data found is catered above) *status |= l_st |= r_st; if(root-data == data1) *status |= 1; if(root-data == data2) *status |= 2; return ans; } Full Program here: https://github.com/monish001/CPP-Programs/blob/master/General/LeastCommonAncestor.c Program tested on Dev-CPP - Monish On Aug 9, 7:56 pm, Raman raman.u...@gmail.com wrote: Can anyone give me the recursive algo to find closest ancestor of two nodes in a tree(not a BST). -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] MS question
You have to make a package library which will do the calculation of (a^b)mod(c), where a, b, c are very large size of 1 digits. (^- power). Design a data structure for the numbers' storage and suggest what functions will you be providing to user with them. Also mention the advantages of using that DS. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: Jumping Puzzle
HI Rohit, Although i haven't checked test many cases also I am not saying algo is wrong but DP will always Gives us Optimal Solution, even for large data-set,but Greedy Will Fail in That Case.I was aware of the same Greedy Algo/Code That you posted but found DP Will Excite Interviewer :) Regards Shashank Mani Computer Science Is Awesome So Why I Write Code Computer Science Birla institute of Technology Mesra On Sat, Aug 13, 2011 at 11:08 PM, rohit jangid rohit.nsi...@gmail.comwrote: ok check this, https://ideone.com/hZboG there may be bugs in coding, but I'm quite sure that algo is correct need to check more cases though but working on all the cases discussed here is there any proof that greedy won't work in this case? On Sat, Aug 13, 2011 at 11:03 PM, rohit jangid rohit.nsi...@gmail.com wrote: found some bugs , will repost it On Sat, Aug 13, 2011 at 10:55 PM, rohit jangid rohit.nsi...@gmail.com wrote: I can only say that above code is wrong, check this code of mine, I have tested more cases and all are working, https://ideone.com/pEBs8 see if you can find any bug in this one . thanks. On Sat, Aug 13, 2011 at 8:03 PM, WgpShashank shashank7andr...@gmail.com wrote: @rohit , I think we will get some cases where greedy won't work check out its giving 3 jumps still https://ideone.com/6UWW1 checked in hurray , if anything wrong do send me over gmail ? Regards Shashank Mani Computer Science Is Awesome So Why I Write Code Computer Science Birla institute of Technology Mesra -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/Rerf5mzR7XcJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Rohit Jangid Under Graduate Student, Deptt. of Computer Engineering NSIT, Delhi University, India -- Rohit Jangid Under Graduate Student, Deptt. of Computer Engineering NSIT, Delhi University, India -- Rohit Jangid Under Graduate Student, Deptt. of Computer Engineering NSIT, Delhi University, India -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] How to solve this problem
if extra space is allowed .. can use counting sort On Sun, Aug 14, 2011 at 8:38 PM, Ankur Garg ankurga...@gmail.com wrote: This is one question from Coreman 3rd Edition - 8-3-4 -- Sort n integers in the range 0 to n^3 -1 in O(n) time Any ideas how to do this in O(n) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Thx, --Gopi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] String Question
@all I Went Through Similar Question Some Times back,i hope piyesh used the same idea, have a look @ Naive efficient Algorithm for doing the same. http://shashank7s.blogspot.com/2011/06/wap-to-output-all-intervals-i-j-where.html * **Regards Shashank Mani Computer Science Is Awesome So Why I Write Code Computer Science Birla institute of Technology Mesra * -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/tZZxNv9-OzgJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: atrenta
@aditi- yes ,they asked hardware question based on gates,multiplexer(not multiple secret sorry for that mistake),counter etc from digital and it is full section contain 8 to 9 question.. this company visited our collage and post offerd by them is software developer... section A- 8 to 9 simple question on c and c++ asked. section B-question mainly from digital electronic(hardware section) Section C-Aptitude -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] How to hash Strings
I came accross a problem where i need to hash strings.. What is the best way to hash strings?? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/LlcN35L2Su8J. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: Closest ancestor of two nodes
Guys, How about the below mentioned implementation? The only assumptions is that nodes should exist in the tree. (will fail if one node exists and another doesn't) static Node LCA(Node root, int d1, int d2){ if(root==null) return root; if(root.left!=null ( root.left.data == d1 || root.left.data==d2 ) ) // both nodes exists in left sub-tree return root; if(root.right!=null ( root.right.data == d1 || root.right.data==d2) ) // both nodes exists in right sub-tree return root; Node ltree = LCA(root.left, d1, d2); //check recursively in left subtree Node rtree = LCA(root.right, d1, d2);// check recursively in right subtree if(ltree!=null rtree!=null)// One node in left another in right return root; return (ltree==null)?rtree:ltree; } Just to mention that, closest ancestor of 54 OR 49 would be 3 in the following tree: 3 \ 4 /\ 5 8 / 9 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/24JUUQsBHvIJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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]
fibonacci series...??? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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 hash Strings
The easiest one is to take the sum of their ASCII values. On Sun, Aug 14, 2011 at 12:36 PM, rohit raman.u...@gmail.com wrote: I came accross a problem where i need to hash strings.. What is the best way to hash strings?? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/LlcN35L2Su8J. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Gaurav Menghani -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] Good Trie theory
google it http://lmgtfy.com/?q=trie On Sun, Aug 14, 2011 at 10:27 PM, rohit rajuljain...@gmail.com wrote: Is anybody know good links for trie description and their usage? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: How to solve this problem
@Ankur: Use a radix sort with radix n. It will take 3 passes to sort the 3 base-n digits, each of O(n), so the overall order will be O(n). On Aug 14, 10:08 am, Ankur Garg ankurga...@gmail.com wrote: This is one question from Coreman 3rd Edition - 8-3-4 -- Sort n integers in the range 0 to n^3 -1 in O(n) time Any ideas how to do this in O(n) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: akamai.....
In which college akamai coming? -Monish On Aug 11, 11:01 am, naveen ms naveenms...@gmail.com wrote: hey can any1 help me out...how ll be the akamai recruiment procedure...and if u have any akamai papers please upload it with regards naveen -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: How to solve this problem
@Gopi: Explain how a counting sort can be done without zeroing out an array of size n^3, and then scanning it, or explain how to do these operations in O(n). Dave On Aug 14, 10:52 am, *$* gopi.komand...@gmail.com wrote: if extra space is allowed .. can use counting sort On Sun, Aug 14, 2011 at 8:38 PM, Ankur Garg ankurga...@gmail.com wrote: This is one question from Coreman 3rd Edition - 8-3-4 -- Sort n integers in the range 0 to n^3 -1 in O(n) time Any ideas how to do this in O(n) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Thx, --Gopi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: How to solve this problem
Yes..i agree with Dave..Here is what i think. As you have integers upto n^3 in your input, it would need [3*lg(n) + 1] bits to represent each integer. So take each group of r = ceil(lg(n)) bits at a time. So this becomes number of bits needed to represent single digit. Each digit thus can take 2^r values. If you use counting sort to sort digits, it will take O(n+ 2^r ) time. You have 3 such groups. So 3 passes needed to sort whole input set. Overall complexity is 3*O(n+2^r) Correct me if i am wrong anywhere in the analysis. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] fork() question
int main() { fork(); fork(); fork(); printf(Hello world!); } ...this will print hello world 8 times...i.e . 2^n times but... int main() { fork(); fork(); fork(); fork() printf(Hello world!); } http://ideone.com/TRKTE ..but this prints only 11 times -- and for five forks 25 times...plz tell how..or is this a prob wit compiler??? Regards, $iva -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: How to hash Strings
@Rohit: Let T be an array of length 256 that contains a permutation of the numbers between 0 and 255. Then to hash string s[], h = 0; for( i = 0 ; s[i] ; ++i ) h = T[h^s[i]]; // or h = T[h] ^ s[i]; You can choose a random permutation for T, or, if you have a small known set of strings (e.g. C keywords), you can try to tailor T so that each given string has a unique hash value. Dave On Aug 14, 11:36 am, rohit raman.u...@gmail.com wrote: I came accross a problem where i need to hash strings.. What is the best way to hash strings?? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: fork() question
http://faq.programmerworld.net/networking/unix-interview-questions-answers.html refer 16 th ques in this site .. they ve told 2^n times..so only i asked whether its compiler dependent ?? On Sun, Aug 14, 2011 at 11:12 PM, sivaviknesh s sivavikne...@gmail.comwrote: int main() { fork(); fork(); fork(); printf(Hello world!); } ...this will print hello world 8 times...i.e . 2^n times but... int main() { fork(); fork(); fork(); fork() printf(Hello world!); } http://ideone.com/TRKTE ..but this prints only 11 times -- and for five forks 25 times...plz tell how..or is this a prob wit compiler??? Regards, $iva -- Regards, $iva -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: fork() question
search in group archive, this question has been discussed very deeply On 14 August 2011 23:14, sivaviknesh s sivavikne...@gmail.com wrote: http://faq.programmerworld.net/networking/unix-interview-questions-answers.html refer 16 th ques in this site .. they ve told 2^n times..so only i asked whether its compiler dependent ?? On Sun, Aug 14, 2011 at 11:12 PM, sivaviknesh s sivavikne...@gmail.comwrote: int main() { fork(); fork(); fork(); printf(Hello world!); } ...this will print hello world 8 times...i.e . 2^n times but... int main() { fork(); fork(); fork(); fork() printf(Hello world!); } http://ideone.com/TRKTE ..but this prints only 11 times -- and for five forks 25 times...plz tell how..or is this a prob wit compiler??? Regards, $iva -- Regards, $iva -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- ___ Please do not print this e-mail until urgent requirement. Go Green!! Save Papers = Save Trees -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: fork() question
Check out second run of same code: http://ideone.com/TK4qu. This time it printed only 8 times. The reason behind this is that, you are using a web based compiler and it sends back the output as soon as main completes its execution. However forked child are yet to complete. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/TYDV9_VeO-QJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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 question
@Dave nice algo. Really like it. So the whole complexity depends on the sorting. On 14 August 2011 22:58, Dave dave_and_da...@juno.com wrote: @Dipankar: If extra space is not allowed, I think the optimal solution is to sort the two arrays, which takes O(max(m log m, n log n)). Then the common element can be found in O(m + n) by a simple search that starts at i = j = 0 and increments the index of the lesser of a[i] and b[j]. Overall complexity is O(max(m log m, n log n)). Dave On Aug 14, 8:24 am, Dipankar Patro dip10c...@gmail.com wrote: @ Sagar: What if extra space in not allowed? I think then we have to use the binary search method... On 14 August 2011 18:50, sagar pareek sagarpar...@gmail.com wrote: Hashing O(n+m) On Sun, Aug 14, 2011 at 6:48 PM, Dipankar Patro dip10c...@gmail.com wrote: how about binary search of each element from array 1 on array 2? overall complexity : O(nlogn) On 14 August 2011 18:46, mohit verma mohit89m...@gmail.com wrote: example: array 1 :: 1 2 3 4 5 6 7 8 9 10 15 array 2:: 23 34 56 13 15 57 432 348 On Sun, Aug 14, 2011 at 6:44 PM, shady sinv...@gmail.com wrote: meaning ? what is a common element ? example ??? On Sun, Aug 14, 2011 at 6:37 PM, mohit verma mohit89m...@gmail.com wrote: given two arrays : with all distinct elements but one element in common. Find the common element in optimal time. -- *MOHIT VERMA* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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. -- *MOHIT VERMA* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- ___ Please do not print this e-mail until urgent requirement. Go Green!! Save Papers = Save Trees -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- ** Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- ___ Please do not print this e-mail until urgent requirement. Go Green!! Save Papers = Save Trees -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- ___ Please do not print this e-mail until urgent requirement. Go Green!! Save Papers = Save Trees -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks]
can anyone tell me what is the job provided by infosys and tcs? IF they do so much mass recruitment what kinda job the ppl get der? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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]
@ ghsjgl: At each step(m), the no. ways is equal to the sum of ways till m-1 and ways till m-2. Look at it as you have reached at m either by taking one step from m-1 or two steps from m-2. I hope that answers your query. On 14 August 2011 22:26, ghsjgl k ghsk...@gmail.com wrote: fibonacci series...??? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- ___ Please do not print this e-mail until urgent requirement. Go Green!! Save Papers = Save Trees -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] shop keeper and the buyer
*I GUESS THE example u have cited is a bit incomplete, as in you havent included anything for the 3rd item . If you want to buy all items then some provision for the 3rd item has to be made as well. Coreect me, if I am wrong.* On Sun, Aug 14, 2011 at 7:21 PM, Prakash D cegprak...@gmail.com wrote: no one to help ?? On Sat, Aug 13, 2011 at 10:48 PM, Prakash D cegprak...@gmail.com wrote: k lets assume that there are 10 kinds of item in the shop price[]={10,20,30,40,50,60,70,80,90,100} quantity[]={5,5,5,5,5,5,5,5,5,5} say no.of items having some free discounts : 5 say p,q,r denotes buying q nos. of p we will get one r for free.. let them be 5 4 1 2 5 1 8 2 10 9 1 10 1 5 10 explain for this case.. how will u proceed? On Sat, Aug 13, 2011 at 7:25 PM, Aditya Virmani virmanisadi...@gmail.com wrote: if k is fixed, sort the items according to their price, buy k cheapest items start taking the most expensive item fr free -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- R@$!-! DoN'T LimIt Ur cHaLlEngeS, ChAlLenGe uR LImItS. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: How to hash Strings
*My interpretation of the questions is that if number of strings are provided, you need to hash them to an array. So, in that case you can maintain an array of char pointers..and use some hash function such as some arithmetic on the ascii value of first character of the string...and the array element would contain address of that string. Correct me, if I am wrong. Thanks* On Sun, Aug 14, 2011 at 11:15 PM, Dave dave_and_da...@juno.com wrote: @Rohit: Let T be an array of length 256 that contains a permutation of the numbers between 0 and 255. Then to hash string s[], h = 0; for( i = 0 ; s[i] ; ++i ) h = T[h^s[i]]; // or h = T[h] ^ s[i]; You can choose a random permutation for T, or, if you have a small known set of strings (e.g. C keywords), you can try to tailor T so that each given string has a unique hash value. Dave On Aug 14, 11:36 am, rohit raman.u...@gmail.com wrote: I came accross a problem where i need to hash strings.. What is the best way to hash strings?? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- R@$!-! DoN'T LimIt Ur cHaLlEngeS, ChAlLenGe uR LImItS. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] Storing of data in memory (endianness)
@ dipankar : if ur talking abt todays winshuttle ppr thn it ws mentioned that its using x86 whch is little endian... On Sun, Aug 14, 2011 at 11:41 PM, Dipankar Patro dip10c...@gmail.comwrote: Hi all, I have come across quite a few questions like What is the way in which int m = 2 will be stored in memory? 2 0 0 0 or 0 0 0 2 Doesn't the answer depend upon the machine you are working on? I mean both are perfectly possible situations if you see. First option is little-endian, second one is big-endian. Which one should I probably go for in case I am not provided a machine dependent option? Reference: http://en.wikipedia.org/wiki/Endianness#Big-endian -- ___ Please do not print this e-mail until urgent requirement. Go Green!! Save Papers = Save Trees -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Aditi Garg Undergraduate Student Electronics Communication Divison NETAJI SUBHAS INSTITUTE OF TECHNOLOGY Sector 3, Dwarka New Delhi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: fork() question
do somebody tried the redirecting the output to file??? sometime results are unpredictable Thank you, Siddharam On Sun, Aug 14, 2011 at 11:25 PM, Yasir yasir@gmail.com wrote: Check out second run of same code: http://ideone.com/TK4qu. This time it printed only 8 times. The reason behind this is that, you are using a web based compiler and it sends back the output as soon as main completes its execution. However forked child are yet to complete. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/TYDV9_VeO-QJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: Storing of data in memory (endianness)
@Dipankar: You are correct. The answer, like the answer to so many questions, is It depends. Dave On Aug 14, 1:11 pm, Dipankar Patro dip10c...@gmail.com wrote: Hi all, I have come across quite a few questions like What is the way in which int m = 2 will be stored in memory? 2 0 0 0 or 0 0 0 2 Doesn't the answer depend upon the machine you are working on? I mean both are perfectly possible situations if you see. First option is little-endian, second one is big-endian. Which one should I probably go for in case I am not provided a machine dependent option? Reference:http://en.wikipedia.org/wiki/Endianness#Big-endian -- ___ Please do not print this e-mail until urgent requirement. Go Green!! Save Papers = Save Trees -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.