Re: [algogeeks] making a graphical c++ programme
What is your primary purpose . If you want to make a game , OpenGL and AllegroGL is way to go .Other wiase to make appliations , you can use visual c++. Can you be more specific ? Regards, Ankur On Sat, Feb 26, 2011 at 1:22 PM, Logic King crazy.logic.k...@gmail.comwrote: I also want to know how to start making graphical program in c++..also can we integrate database with a c++ application. actually i want to make a c++ application using both c++ and databasehow should i start please guide me !!! On Sat, Feb 26, 2011 at 1:20 AM, UTKARSH SRIVASTAV usrivastav...@gmail.com wrote: can anybody give me code of making a simple c++ graphical program. please also write statement of compiling and running the program in linux. and if you wish please explain the statements of program with comments... -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: Puzzle For Puzzled Minds -How Many Rounds..???
Yeah. Sorry, it is my bad missed to observe N = 5623. Regards, Venki. On Feb 25, 11:22 pm, Dave dave_and_da...@juno.com wrote: @Venki. Hmmm. Let me see. The problem specified that there were 5623 participants. That makes n = 5623. You say that n-1 games are needed, and compute that as 5621. So you are saying that 5623 - 1 = 5621. Is that some kind of new math? Dave On Feb 25, 4:01 am, Venki venkatcollect...@gmail.com wrote: Yeah, Dave. It is simple, but small correction, we need 5621 games to figure out the winner. In general, if we are having n participants we need n - 1 games to determine the final winner. We can conclude the fact, by drawing the tournament tree for small numbers and count for the games to be held at each level (an omitted participant can be grouped in next level). Thanks, Regards, Venki. On Feb 25, 7:58 am, Dave dave_and_da...@juno.com wrote: Simpler. Every game eliminates one participant. Since 5,622 participants must be eliminated to have one winner, it takes 5,622 games. Dave On Feb 24, 5:43 pm, bittu shashank7andr...@gmail.com wrote: If you had 5,623 participants in a tournament, how many games would need to be played to determine the winner According to me if Tournament strategy is is used then i think its ok... After each round, you would have half the number that started the previous round; except if it were an odd number it would he half + 1. So 13 rounds. 2812 1 1406 2 703 3 352 4 176 5 88 6 44 7 22 8 11 9 6 10 3 11 2 12 1 13 Correct me if i am wrong Some Discussion Needed..??? Thanks Shashank The Best Way to Escape From The Problem is to Solve It- Hide quoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: 25february
19(I m d driver and I m 19) On Feb 26, 12:35 pm, Lavesh Rawat lavesh.ra...@gmail.com wrote: *Bus Driver Problem Solution* ok let's say you're driving a bus and it's empty. At the first stop two(2) people get on. At the second stop five(5) people get on and one(1) person exits. At the third stop six(6) people get on and four(4) people exit. How old is the bus driver? Update Your Answers at : Click Herehttp://dailybrainteaser.blogspot.com/2011/02/25february.html Solution: Will be updated after 1 day -- Never explain yourself. Your friends don’t need it and your enemies won’t believe it . -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Call For Papers: Int'l Conf. on Software Engineering Research and Practice (SERP'11), USA, July 18-21, 2011
Dear colleagues: Please share the appended announcement with those who may be interested. Thank you - Steering Committee, SERP CALL FOR PAPERS and Call For Workshop/Session Proposals = SERP'11 The 2011 International Conference on Software Engineering Research and Practice Date and Location: July 18-21, 2011, Las Vegas, USA http://www.world-academy-of-science.org/ = You are invited to submit a full paper for consideration. All accepted papers will be published in the SERP conference proceedings (in printed book form; later, the proceedings will also be accessible online) - the proceedings will be indexed in Inspec / IET / The Institute for Engineering Technology, DBLP / Computer Science Bibliography, and others. Those interested in proposing workshops/sessions, should refer to the relevant sections that appear below. The main keynote lecture will be delivered by Prof. David Lorge Parnas (Fellow of IEEE, ACM, RSC, CAE, GI; MRIA); there will also be 8 other distinguished speakers, 12 planned tutorials and panel discussions as well as about 70 research paper presentations. SCOPE: Topics of interest include, but are not limited to, the following: O Software architectures O Software design and design patterns O Architectural analysis, verifications and validation methods O Quality oriented software architecture (design and Support) O Software reliability, safety critical systems and security methods O Software reuse and component engineering O UML/MDA and AADL O Object oriented technology (design and analysis) O Software metrics O Reverse and architectural recovery methods O Domain specific software engineering O Aerospace software and system engineering O Software engineering methodologies O Survivable systems O Engineering of safety/mission critical systems O Software testing, evaluation and analysis technologies O Workflow - Computer Supported Cooperative Work (CSCW) O Project management issues O Distributed and parallel systems O Legal issues and standards O Automated software design O Real-time embedded software engineering O Automated software design and synthesis O Software security engineering O Theoretic approaches (formal methods, graph, ...) O Software, domain modeling and meta-modeling O Model driven engineering O Software maintenance O Reflection and metadata methodologies O AI approaches to software engineering O Component based software engineering O Software engineering standards and guidelines O Reports on intelligent CASE tools and eclipse plugins issues O Multimedia in software engineering O Usability engineering O Novel software tools and environments O Pervasive software engineering O Requirement engineering and processes O Critical and embedded software design O Service oriented software architecture O Software cost estimation O Web engineering and web-based applications O Human computer interaction and usability engineering O Model based software engineering O Aspect oriented software engineering O Agent oriented software engineering O Programming languages and compilers O Education and law O Case studies and emerging technologies USEFUL WEB LINKS: To see the DBLP list of accepted papers of SERP 2010, go to: http://www.informatik.uni-trier.de/~ley/db/conf/serp/serp2010.html The main web site of SERP'11 can be accessed via: http://www.world-academy-of-science.org/ IMPORTANT DATES: March 10, 2011: Submission of papers (about 5 to 7 pages) April 03, 2011: Notification of acceptance (+/- two days) April 24, 2011: Final papers + Copyright/Consent + Registration July 18-21, 2011: The 2011 International Conference on Software Engineering Research and Practice (SERP'11) ACADEMIC CO-SPONSORS: Currently being prepared - The Academic sponsors of the last offering of SERP (2010) included research labs and centers affiliated with (a partial list): University of California, Berkeley; University of Southern California; University of Texas at Austin; Harvard University, Cambridge, Massachusetts; Georgia Institute of Technology, Georgia; Emory University, Georgia; University of Minnesota; University of Iowa; University of North Dakota; NDSU-CIIT Green Computing Comm. Lab.; University of Siegen, Germany; UMIT, Austria; SECLAB (University of Naples Federico II + University of Naples Parthenope + Second University of Naples, Italy); National Institute for Health Research; World Academy of Biomedical Sciences and Technologies; Russian Academy of Sciences, Russia; International Society of Intelligent Biological Medicine (ISIBM4042); The International Council on Medical and Care Compunetics; Eastern Virginia Medical School the American College of
Re: [algogeeks] Mathematics Problem
As the competition is over I can reveal u the answer. There is only one number satisfying given condition and that is 578 so the answer is 20 :) On Fri, Feb 25, 2011 at 10:33 PM, vaibhav shukla vaibhav200...@gmail.comwrote: nothing to do with complexity... just the ans On Fri, Feb 25, 2011 at 10:23 PM, Rel Guzman Apaza rgap...@gmail.comwrote: Is there a maximum time complexity? 2011/2/25 vaibhav shukla vaibhav200...@gmail.com Find the sum of digits of all the numbers whose digits are all in ascending order from left to right. All these numbers lie between 500 to 1000 and satisfy M divides (M-1)* !* + 1 , where M is any natural number. (* ! * denotes factorial of the number) -- best wishes!! Vaibhav Shukla DU-MCA -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- best wishes!! Vaibhav Shukla DU-MCA -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards Gunjan Sharma Chairman IEEE Students Chapter IIT Roorkee B.Tech IV year CSE Contact No- +91 9997767077 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: Lets C Who Really Loves Perfect Square .................
@all hi what do you think about this https://ideone.com/8QAig Please Let Me Know if something wrong with this Thanks Regards Shashank The Best Way to Escape From The Problem is Solve It -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Array , Number Missing or Duplicate ..
Given an array of integers where some numbers repeat 1 time, some numbers repeat 2 times and only one number repeats 3 times, how do you find the number that repeat 3 times. Thanks Shashank -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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 , Number Missing or Duplicate ..
XOR :P On Sat, Feb 26, 2011 at 10:11 PM, bittu shashank7andr...@gmail.com wrote: Given an array of integers where some numbers repeat 1 time, some numbers repeat 2 times and only one number repeats 3 times, how do you find the number that repeat 3 times. Thanks Shashank -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] Mathematics Problem
hi Gunjan, Can you please give the methodhow you achieved this answer... On Sat, Feb 26, 2011 at 9:36 PM, Gunjan Sharma gunjan.khan...@gmail.com wrote: As the competition is over I can reveal u the answer. There is only one number satisfying given condition and that is 578 so the answer is 20 :) On Fri, Feb 25, 2011 at 10:33 PM, vaibhav shukla vaibhav200...@gmail.com wrote: nothing to do with complexity... just the ans On Fri, Feb 25, 2011 at 10:23 PM, Rel Guzman Apaza rgap...@gmail.com wrote: Is there a maximum time complexity? 2011/2/25 vaibhav shukla vaibhav200...@gmail.com Find the sum of digits of all the numbers whose digits are all in ascending order from left to right. All these numbers lie between 500 to 1000 and satisfy M divides (M-1) ! + 1 , where M is any natural number. ( ! denotes factorial of the number) -- best wishes!! Vaibhav Shukla DU-MCA -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- best wishes!! Vaibhav Shukla DU-MCA -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards Gunjan Sharma Chairman IEEE Students Chapter IIT Roorkee B.Tech IV year CSE Contact No- +91 9997767077 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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, Mohan Mangal Software Engineer, Bangalore Mob- 80952-03670 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] Mathematics Problem
There are only few numbers satisfying the 1st property and for them I checked using python the second condition. :) Competition name - Codematics On Sun, Feb 27, 2011 at 1:18 AM, Rel Guzman Apaza rgap...@gmail.com wrote: what competition? 2011/2/26 Gunjan Sharma gunjan.khan...@gmail.com As the competition is over I can reveal u the answer. There is only one number satisfying given condition and that is 578 so the answer is 20 :) On Fri, Feb 25, 2011 at 10:33 PM, vaibhav shukla vaibhav200...@gmail.com wrote: nothing to do with complexity... just the ans On Fri, Feb 25, 2011 at 10:23 PM, Rel Guzman Apaza rgap...@gmail.comwrote: Is there a maximum time complexity? 2011/2/25 vaibhav shukla vaibhav200...@gmail.com Find the sum of digits of all the numbers whose digits are all in ascending order from left to right. All these numbers lie between 500 to 1000 and satisfy M divides (M-1)* !* + 1 , where M is any natural number. (* ! * denotes factorial of the number) -- best wishes!! Vaibhav Shukla DU-MCA -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- best wishes!! Vaibhav Shukla DU-MCA -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards Gunjan Sharma Chairman IEEE Students Chapter IIT Roorkee B.Tech IV year CSE Contact No- +91 9997767077 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] need help with a classic algorithm
You are given n coins, at least one of which is bad. All the good coins weigh the same, and all the bad coins weigh the same. The bad coins are lighter than the good coins. Find the exact number of bad coins by making O(logn)^2 weighings on a balance. Each weighing tells you whether the total weight of the coins you put on the left side of the balance is smaller than, equal to, or larger than the total weight of the coins you put on the right side. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: Lets C Who Really Loves Perfect Square .................
Another optimization: Since the sum of the digits of n^2 is 45, n^2 is divisible by 9. Thus, we need consider only n values that are divisible by 3. Thus, the outer for-loop can be written for( n = 31992 ; n 99381 ; n+=3 ) Dave On Feb 23, 7:02 pm, Dave dave_and_da...@juno.com wrote: Try this: int i,k,n; long long j,nsq; for( n = 31623 ; n 10 ; ++n ) { nsq = (long long)n * (long long)n; j = nsq; k = 0; for( i = 0 ; i 10; ++i ) { k |= (1 (j % 10)); j /= 10; } if( k == 01777 ) printf(%i %lli\n,n,nsq); } It finds 76 answers in the blink of an eye, the first being 32043^2 and the last being 99066^2. Dave On Feb 22, 3:17 pm, bittu shashank7andr...@gmail.com wrote: How to find a number of 10 digits (non repeated digits) which is a perfect square? perfect square examples: 9 (3x3) 16 (4x4) 25(5x) etc. Ten digit number example 1,234,567,890 Thanks Regards Shashank- Hide quoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: Array , Number Missing or Duplicate ..
@Radha: Please explain your method further. You can use this data: 0, 1, 2, 4, 4, 5, 5, 6, 6, 6. Dave On Feb 26, 10:44 am, radha krishnan radhakrishnance...@gmail.com wrote: XOR :P On Sat, Feb 26, 2011 at 10:11 PM, bittu shashank7andr...@gmail.com wrote: Given an array of integers where some numbers repeat 1 time, some numbers repeat 2 times and only one number repeats 3 times, how do you find the number that repeat 3 times. Thanks Shashank -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/algogeeks?hl=en.- Hide quoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] [brain teaser ] 25february
The age guy of bus driver is the age of the puzzle solver. Best Regards Abhijit On Sat, Feb 26, 2011 at 1:05 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote: *Bus Driver Problem Solution* ok let's say you're driving a bus and it's empty. At the first stop two(2) people get on. At the second stop five(5) people get on and one(1) person exits. At the third stop six(6) people get on and four(4) people exit. How old is the bus driver? Update Your Answers at : Click Herehttp://dailybrainteaser.blogspot.com/2011/02/25february.html Solution: Will be updated after 1 day -- Never explain yourself. Your friends don’t need it and your enemies won’t believe it . -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: Lets C Who Really Loves Perfect Square .................
@Dave great one. On Sun, Feb 27, 2011 at 3:33 AM, Dave dave_and_da...@juno.com wrote: Another optimization: Since the sum of the digits of n^2 is 45, n^2 is divisible by 9. Thus, we need consider only n values that are divisible by 3. Thus, the outer for-loop can be written for( n = 31992 ; n 99381 ; n+=3 ) Dave On Feb 23, 7:02 pm, Dave dave_and_da...@juno.com wrote: Try this: int i,k,n; long long j,nsq; for( n = 31623 ; n 10 ; ++n ) { nsq = (long long)n * (long long)n; j = nsq; k = 0; for( i = 0 ; i 10; ++i ) { k |= (1 (j % 10)); j /= 10; } if( k == 01777 ) printf(%i %lli\n,n,nsq); } It finds 76 answers in the blink of an eye, the first being 32043^2 and the last being 99066^2. Dave On Feb 22, 3:17 pm, bittu shashank7andr...@gmail.com wrote: How to find a number of 10 digits (non repeated digits) which is a perfect square? perfect square examples: 9 (3x3) 16 (4x4) 25(5x) etc. Ten digit number example 1,234,567,890 Thanks Regards Shashank- Hide quoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Thanks Regards, Gaurav Gupta Associate Software Engineer IBM Software Lab India Email: gauravgupta[at]in[dot]ibm[dot]com Ph No. : +91-7676-999-350 Quality is never an accident. It is always result of intelligent effort - John Ruskin -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: 25february
19 (I'm driving ) Ironically I read this puzzle in chacha chaudhary comics :P On Feb 26, 8:31 pm, anuja verma kcrazy...@gmail.com wrote: 19(I m d driver and I m 19) On Feb 26, 12:35 pm, Lavesh Rawat lavesh.ra...@gmail.com wrote: *Bus Driver Problem Solution* ok let's say you're driving a bus and it's empty. At the first stop two(2) people get on. At the second stop five(5) people get on and one(1) person exits. At the third stop six(6) people get on and four(4) people exit. How old is the bus driver? Update Your Answers at : Click Herehttp://dailybrainteaser.blogspot.com/2011/02/25february.html Solution: Will be updated after 1 day -- Never explain yourself. Your friends don’t need it and your enemies won’t believe it . -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Lets C Who Really Loves Perfect Square .................
Why not try all possibilities? Not many numbers to enumerate. 2011/2/23 bittu shashank7andr...@gmail.com How to find a number of 10 digits (non repeated digits) which is a perfect square? perfect square examples: 9 (3x3) 16 (4x4) 25(5x) etc. Ten digit number example 1,234,567,890 Thanks Regards Shashank -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 此致 敬礼! 林夏祥 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Amazon Online Test
Here is the algo : while(read string in reverse) { if(str = L) create node and push to stack continue if(str = N) pop 2 nodes from stack and asign them as children of N and push N on stack //Here we can get //multiple trees } pop root from stack On Thu, Feb 24, 2011 at 12:59 AM, Aviral Gupta aviral@gmail.com wrote: with the given constraints there is only one possible tree Regards Aviral http://coders-stop.blogspot.com On Feb 23, 5:47 pm, murthy.krishn...@gmail.com murthy.krishn...@gmail.com wrote: hii vinay, the prob is we can get many such trees given a preorder traversal with the condition that each node has zero or two children. Please correct me if I am wrong. Thanks, Krishna. On Wed, Feb 23, 2011 at 6:00 PM, murthy.krishn...@gmail.com murthy.krishn...@gmail.com wrote: thanks vinay :-) On Wed, Feb 23, 2011 at 5:39 PM, vinay reddy gvina...@gmail.com wrote: U need to construct a binary tree given only PreOrder traversal with the condition that each node has zero or two children. On Wed, Feb 23, 2011 at 10:52 AM, murthy.krishn...@gmail.com murthy.krishn...@gmail.com wrote: hii vinay, can u elaborate the third question thanks, Krishna On Wed, Feb 23, 2011 at 9:34 AM, vinay reddy gvina...@gmail.com wrote: Hi Anurag, I have taken that online test there were 3 questions ... 1. given a linked list check if it is a palindrome. 2.given two sorted arrays a[m] b[2*m], each contains m elements only. You need to merge those two arrays into second array b[2*m] 3. construct a Binary tree from a given String, where every node has zero or two children. e.g String = NNNLLL , N represents internal Node , L represents leaf Node. The alloted time was 1hr. and asked to write the function only ... no main function and all. hope this helps Thanks vinay On Wed, Feb 16, 2011 at 3:45 PM, Anurag Bhatia abhati...@gmail.com wrote: Has anyone give any first round online test for Amazon? If yes, can you please share details? --Anurag -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Regards Pranjal -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: Antipodal points
The points must satisfy the equation (x-x1)(x-x2)+(y-y1)(y-y2)=0 Circle centered at origin x2+y2=Some radius .With N points on the circle , we find out the radius In order to find if the two points are antipodal , we check the first equation putting the two points and checking for any other point on the circle if it satisfies the equation . Test for antinodality . This will do in O(1) . Given N points and we have to find if two points are antinodal On Feb 26, 11:15 am, Mohan Mangal mohan.mangal...@gmail.com wrote: Hi Vinay, Here the condition is Point lies on same circle.. hope you got it. On Sat, Feb 26, 2011 at 10:58 AM, vinay reddy gvina...@gmail.com wrote: Hi Dave, I don't think ur logic will cover all cases like (1,1)(-3,-3), (1,1) (2,2) a line connecting these points passes through origin, i think the solution is, we need to compute the slope of the point at index i with origin and build a binary tree with theses slopes. but worst cases of this algo is N*N , if we try balancing the tree while inserting I guess it can be done in NlogN Thanks Vinay On Fri, Feb 25, 2011 at 9:20 AM, Gene gene.ress...@gmail.com wrote: Dave's solution is best if numerical error is possible. If the points are precise, you can also do it in linear time. Just hash the points on abs(y/x). -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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, Mohan Mangal Software Engineer, Bangalore Mob- 80952-03670 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] An interesting question
A NxN binary matrix is given. If a row contains a 0 all element in the row will be set to 0 and if a column contains a 0 all element of the column will be set to 0. You have to do it in O(1) space. example : input array : 1 0 1 1 0 0 1 1 1 0 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 result array : 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 1 0 Thanks Regards, Gaurav Gupta -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Pairwise Sum Array
I think the output is wrong. It should be 1 3 4 9 n in no call them ai's a[1] to a[n] 4 5 10 7 12 13 m in no call them bi's b[1] to b[m] I assume starting from 1 to make manipulation easier n(n-1)/2= m n(n-1)=2m n2 -n -2m=0 using quadratic formula:- n=1 + sqrt( 1+8m)/2 This will always be a whole no if it isnt then error. Once I know n then what remains is algebraic manipulation. fill in the following matrix :- a1+a2 a1+a3 ... a1+an = b1 .. bn NOTE! n not m a2+a3 .. a2+an = b(n+1)..b(2n) an-1+an=bm 12 13 1n 23 2n (n-1)n 1st ALL C[i][j]=0; i : 1 to n-1 and j : 2 to n offset=0 Then for( i=1; i=(n-1) ; i++) for( j=i+1; j=n ; j++) { C[i][j] = b[ offset + j - 1 ] ; } offset= offset+j-1; } for( i=1; i=(n-1) ; i++) for( j=i+1; j=n ; j++) { D[i][j] = C[i][j] - C[i+1][j]; } } now C[i][j] = a[i] + a[j] D[i][j+1] = a[i]-a[j] We may solve for the a[i]'s. ( see rough figure below) Subtract R i+1 from R i a1+a2 (a1-a2) ... a1-a2 = RHS a2+a3 ...a2-a3 = RHS an-2+an-1 an-2-an-1 =RHS an-1+an=RHS I am in a hurry as I have to go home now, sorry, but I think people will see the solution. Is there a better way? Ashim. On Thu, Feb 24, 2011 at 2:52 AM, radha krishnan radhakrishnance...@gmail.com wrote: This s a topcoder problem :) On Wed, Feb 23, 2011 at 7:16 PM, bittu shashank7andr...@gmail.com wrote: If pairwise sums of 'n' numbers are given in non-decreasing order identify the individual numbers. If the sum is corrupted print -1 Example: i/p: 4 5 7 10 12 13 o/p: 1 3 4 9 Thanks Regards Shashank -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Array , Number Missing or Duplicate ..
Kind of brute force with O(n*log(n)) map mint, int; for( int i=0; iN; i++) m[a[i]]++; for each element in hashmap if( m[i] == 3) print i; On Sun, Feb 27, 2011 at 3:59 AM, Dave dave_and_da...@juno.com wrote: @Radha: Please explain your method further. You can use this data: 0, 1, 2, 4, 4, 5, 5, 6, 6, 6. Dave On Feb 26, 10:44 am, radha krishnan radhakrishnance...@gmail.com wrote: XOR :P On Sat, Feb 26, 2011 at 10:11 PM, bittu shashank7andr...@gmail.com wrote: Given an array of integers where some numbers repeat 1 time, some numbers repeat 2 times and only one number repeats 3 times, how do you find the number that repeat 3 times. Thanks Shashank -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/algogeeks?hl=en.- Hide quoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Thanks Regards, Gaurav Gupta Associate Software Engineer IBM Software Lab India Email: gauravgupta[at]in[dot]ibm[dot]com Ph No. : +91-7676-999-350 Quality is never an accident. It is always result of intelligent effort - John Ruskin -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: String of Max Length Which Repeats More Then Onep
@Dave: I think it is to find the longest substring which appears more than once in the given string. @bittu: You could use suffix tree: http://en.wikipedia.org/wiki/Suffix_tree, and find the deepest branch node. or use suffix array: http://en.wikipedia.org/wiki/Suffix_array, and find the length of common prefix of neighbouring elements, then choose the maximum. On 2011-2-25 1:46, Dave wrote: @Bittu: Your statement of the problem doesn't make any sense. Apparently, you are given a string and somehow that string is repeated. Can you clarify it and give an example? Dave On Feb 24, 10:24 am, bittushashank7andr...@gmail.com wrote: Given a string (assume there no spaces or punctuations), write a program that returns the max. length of the string that has repeated more than once. Thanks Shashank -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] Parallel algorithms
Practical - Good mix of theory and practice 1. The Art of Multiprocessor Programming by Maurice Herlihy Nir Shavit 2. Introduction to Parallel Computing, Second Edition. By Ananth Grama, Anshul Gupta, George Karypis, Vipin Kumar 3. Herb Sutter's Blog on Concurrency API Specific 4. Oreilly's Intel TBB. 5. Programming Massively Parallel Processors (CUDA) 6. Using OpenMP Portable Shared Memory Parallel Programming Advanced and more theoretical - Principles of Concurrent and Distributed Programming by M.Ben Ari On Fri, Feb 18, 2011 at 3:07 PM, Umer Farooq the.um...@gmail.com wrote: Hello, Can anyone suggest me a good book for parallel algorithms? -- Umer -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] Pairwise Sum Array
That is exactly what my solution is doing. On Thu, Feb 24, 2011 at 5:09 PM, ashish agarwal ashish.cooldude...@gmail.com wrote: There must be another good solution..please let me know . Thanks On Thu, Feb 24, 2011 at 5:09 PM, ashish agarwal ashish.cooldude...@gmail.com wrote: I think.. As like no are a,b,c,d,e so sum will be a+b,a+c,a+d,a+e,b+c,b+d,b+e,c+d,c+e,d+e; so maximuum value will be d+e which is last element of array given take last three value 1.c+d 2.c+e 3.d+e eq(1)-eq(2)=d-e; solving it with 3rd eq will give d and e and with these value we can get other values On Thu, Feb 24, 2011 at 2:52 AM, radha krishnan radhakrishnance...@gmail.com wrote: This s a topcoder problem :) On Wed, Feb 23, 2011 at 7:16 PM, bittu shashank7andr...@gmail.com wrote: If pairwise sums of 'n' numbers are given in non-decreasing order identify the individual numbers. If the sum is corrupted print -1 Example: i/p: 4 5 7 10 12 13 o/p: 1 3 4 9 Thanks Regards Shashank -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: amazon
I guess macro can be a work arround for this. in configuration you can provide files which can access a global variable ProtectedVariable you have defined PROTECTEDVARIABLE_ACCESSIBLE_IN_FILEONE like *global.c * int ProtectedVariable = 10; /* other stuff */ *fileone.c * #ifdef PROTECTEDVARIABLE_ACCESSIBLE_IN_FILEONE extern int ProtectedVariable #elseif static int ProtectedVariable; #endif /* some stuff which can access ProtectedVariable */ *filetwo.c * #ifdef PROTECTEDVARIABLE_ACCESSIBLE_IN_FILETWO extern int ProtectedVariable; #elseif static int ProtectedVariable; #endif /* some stuff which try to access ProtectedVariable but it wont be able to acess global one, it will access the local ProtectedVariable . */ So fileone can access global variable but filetwo not, I guess this was asked by Jalaj? On Fri, Feb 25, 2011 at 5:11 PM, Arulanandan P arulanan...@gmail.com wrote: @jalaj guys please understand how the static and extern work first. static makes the variables or functions defined in an object file to be local to that object file. When you declare the variable or function as extern , it means that definition is present in some other object file and it will be resolved at the link time only. By default all the global variables and functions are visible to other object files. Example: a.c === int var = 10; // global variable so accessible to other files. static void func() // static - so not accessible to other files { } b.c === extern int var ; main() { var = 20 ; func() ; // this is not permitted since the func() is declared as static } This is how the compilation works: gcc -c -o a.o a.c gcc -c -o b.o b.c gcc -o exe b.o a.o // This will lead to linker error since func is declared static. Regards Arul On Fri, Feb 25, 2011 at 12:00 AM, nishaanth nishaant...@gmail.com wrote: Declare it as static. On Wed, Feb 23, 2011 at 11:33 PM, Jammy xujiayiy...@gmail.com wrote: Are you talking about IPC? On Feb 22, 10:05 am, jaladhi dave jaladhi.k.d...@gmail.com wrote: What do you mean by data element here ? Also by file you mean the file where you wrote the code ? And above all which programming language are we talking ? You hit send button too early I guess :) On 22-Feb-2011 7:39 PM, jalaj jaiswal jalaj.jaiswa...@gmail.com wrote: Is there any way by which a data element in a file is accessible by another file, where the program has multiple files. That data element should be accessible to a particular file only and inaccessible to the rest.? declaring it as an extern will make it accessible to all i think .. what cud be the answer ? -- With Regards, *Jalaj Jaiswal* (+919019947895) Software developer, Cisco Systems B.Tech IIIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- S.Nishaanth, Computer Science and engineering, IIT Madras. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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. -- Thanks Regards, Gaurav Gupta Quality is never an accident. It is always result of intelligent effort - John Ruskin -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: Lets C Who Really Loves Perfect Square .................
@Sankalp: There are 10^10 - 10^9 10-digit numbers. We investigate only about the sqrt of that many to find out how many both are perfect squares and have non-repeating digits. Dave On Feb 26, 11:31 pm, sankalp srivastava richi.sankalp1...@gmail.com wrote: @dave But you are going over elements from 35000 to 98000 something anyway How is it O(sqrt n) ? But I don't think any other approach exists .(One is to use permutations (10!-9!) ) On Feb 27, 3:03 am, Dave dave_and_da...@juno.com wrote: Another optimization: Since the sum of the digits of n^2 is 45, n^2 is divisible by 9. Thus, we need consider only n values that are divisible by 3. Thus, the outer for-loop can be written for( n = 31992 ; n 99381 ; n+=3 ) Dave On Feb 23, 7:02 pm, Dave dave_and_da...@juno.com wrote: Try this: int i,k,n; long long j,nsq; for( n = 31623 ; n 10 ; ++n ) { nsq = (long long)n * (long long)n; j = nsq; k = 0; for( i = 0 ; i 10; ++i ) { k |= (1 (j % 10)); j /= 10; } if( k == 01777 ) printf(%i %lli\n,n,nsq); } It finds 76 answers in the blink of an eye, the first being 32043^2 and the last being 99066^2. Dave On Feb 22, 3:17 pm, bittu shashank7andr...@gmail.com wrote: How to find a number of 10 digits (non repeated digits) which is a perfect square? perfect square examples: 9 (3x3) 16 (4x4) 25(5x) etc. Ten digit number example 1,234,567,890 Thanks Regards Shashank- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] Re: An interesting question
1.) Traverse the whole matrix and replace each 0 value with -1. 2.) Traverse the matrix again,all the 1 values are replaced with 0 in the row and column of the index where a -1 value is found. 3.) Set all -1 values to zero and we have the output array. time complexity: O(n^2) space complexity: O(1) On Feb 27, 2:29 am, gaurav gupta 1989.gau...@googlemail.com wrote: A NxN binary matrix is given. If a row contains a 0 all element in the row will be set to 0 and if a column contains a 0 all element of the column will be set to 0. You have to do it in O(1) space. example : input array : 1 0 1 1 0 0 1 1 1 0 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 result array : 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 1 0 Thanks Regards, Gaurav Gupta -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Re: Antipodal points
Okk...I got my mistake... Thank you all for clearing my doubts.. On Sun, Feb 27, 2011 at 10:53 AM, sankalp srivastava richi.sankalp1...@gmail.com wrote: The points must satisfy the equation (x-x1)(x-x2)+(y-y1)(y-y2)=0 Circle centered at origin x2+y2=Some radius .With N points on the circle , we find out the radius In order to find if the two points are antipodal , we check the first equation putting the two points and checking for any other point on the circle if it satisfies the equation . Test for antinodality . This will do in O(1) . Given N points and we have to find if two points are antinodal On Feb 26, 11:15 am, Mohan Mangal mohan.mangal...@gmail.com wrote: Hi Vinay, Here the condition is Point lies on same circle.. hope you got it. On Sat, Feb 26, 2011 at 10:58 AM, vinay reddy gvina...@gmail.com wrote: Hi Dave, I don't think ur logic will cover all cases like (1,1)(-3,-3), (1,1) (2,2) a line connecting these points passes through origin, i think the solution is, we need to compute the slope of the point at index i with origin and build a binary tree with theses slopes. but worst cases of this algo is N*N , if we try balancing the tree while inserting I guess it can be done in NlogN Thanks Vinay On Fri, Feb 25, 2011 at 9:20 AM, Gene gene.ress...@gmail.com wrote: Dave's solution is best if numerical error is possible. If the points are precise, you can also do it in linear time. Just hash the points on abs(y/x). -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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, Mohan Mangal Software Engineer, Bangalore Mob- 80952-03670 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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.