Re: [algogeeks] problem regarding gcc installation
I second Charles thought . The quality of the list is detoriating day by day, due to such off topic questions. On 30-Apr-2011 12:27 AM, Charles Turner chtu...@gmail.com wrote: On 29/04/2011 19:52, himanshu kansal wrote: yeah i knw dt well...bt i jus asked if sum1 cd help me I really don't think people who have subscribed to read algorithm related discussions want to read about your problems installing a compiler. When you find the appropriate list (see hints in my previous mail) another tip I can give you is to actually explain the problem, such as what errors you see. Please, refrain from polluting this list with off-topic help requests. Charles. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] [brain teaser ] 17march
its lee. BTW no offense intended but what has this to do with algorithms ? On Thu, Mar 17, 2011 at 1:58 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote: *Problem Solution* * *Lee's parents have five children, the names of the first four are La, Le, Li, and Lo. What's the name of the fifth child? Update Your Answers at : Click Herehttp://dailybrainteaser.blogspot.com/2011/03/17march.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] amazon
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.
Re: [algogeeks] UVA Online Submission.
input and output are files only. :) On Sun, Feb 13, 2011 at 9:09 AM, Umer Farooq the.um...@gmail.com wrote: You mean that input/output is on console and that they don't appreciate filing? On Sat, Feb 12, 2011 at 7:51 PM, Wesley Mesquita wesleymesqu...@gmail.com wrote: You should use the standard input/output... simple scanf/printf for C and cin/cout C++ do the deal. I don't know about java. Regards, On Wed, Feb 9, 2011 at 3:37 PM, Umer Farooq the.um...@gmail.com wrote: Hello, I am new user of UVa website and I'm having problems in submitting the solution. Can anyone tell me 1- How do we take the input? via input file? command line arguments? 2- How do we print the output? In an output.txt file? on Console? 3- Do we have insert the package statement? (if we are using java) -- 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. -- Wesley Mesquita Computer Engineer http://www.wesleymesquita.com Mobile: +55 11 95249272 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- 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] m-permutation
search for modified josephus problem. you will get the answer :) On Wed, Feb 9, 2011 at 4:52 PM, punnu punnu.gino...@gmail.com wrote: Suppose n people are arranged in a circle. Number the people from 1 to n. in the clockwise order. We are given an integer ,m = n. Beginning with the person with designated number 1, we proceed around the circle (in clockwise order) removing every mth person. After each person is removed, counting continues around the circle that remains. This process continues until all the n people have been removed. . The .m-permutation is defined as the order in which the people have been removed. As an example, if n = 7, m = 3, then the 3 - permutation is 3,6,2,7,5,1,4. Give an O(n log n) time algorithm which given m and n outputs the m- permutation. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] extendible hashing
If you want to access disk blocks directly, hack to disk driver and create a flat file for block lookups. On Wed, Feb 9, 2011 at 11:32 PM, jagannath prasad das jpdasi...@gmail.com wrote: guys someone help me out..its urgent On Wed, Feb 9, 2011 at 1:18 PM, jagannath jpdasi...@gmail.com wrote: i want to implement extendible hashing for may major project.so the crux of the problem is to directly access the disk block without using the undelying os file system interface.one idea which comes to my mind is to build a virtual file system interface for my project but currently i want to avoid that.so is there any API in unix or windows which can do the job or is there any existing file system which uses the extendible hashing in its implementation.please help its urgent. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] Design question
top of mind thoughts. Chess layout one array of objects. Methods: - get_content() - set_postion() - is_check() etc. generic class each chessmen: sub class type of chessmen(knight,rook etc) methods: next_moves() make_move() is_alive() etc. On Mon, Feb 7, 2011 at 4:12 PM, Manmeet Singh mans.aus...@gmail.com wrote: How to design a chess board using OOPS ? ? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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: Good question
it has variable defined On Sun, Feb 6, 2011 at 7:47 AM, Venki venkatcollect...@gmail.com wrote: Hi Gajendra, See the following link http://geeksforgeeks.org/forum/topic/huwaei-interview-question-for-software-engineerdeveloper-2-5-years-about-cpuzzles#post-18725 On Feb 5, 7:28 pm, Gajendra Dadheech gajju3...@gmail.com wrote: Calculate size of a data type without using sizeof and without declaring any variable of it Thanks and regards, Gajendra Dadheech -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from 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] can i know the best way to learn programming??
any search engine will tell u that :) On Wed, Feb 2, 2011 at 11:53 AM, Ajay Kumar ajay...@gmail.com wrote: @ nishaanthh... what is SPOJ and topcoder...plz help!!! On Tue, Feb 1, 2011 at 9:31 PM, nishaanth nishaant...@gmail.com wrote: solve problems from SPOJ and topcoder.it helps a lot. On Tue, Feb 1, 2011 at 1:30 AM, sandy sandeep.aa...@gmail.com wrote: plz 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. -- 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. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
Re: [algogeeks] Google Technical Round
Can you give an example, to clarify certain points. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from 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] compression
Aren't all files sequence of 1s and 0s while getting stored on disk ? On Thu, Nov 4, 2010 at 4:36 PM, neeraj agarwal itsneerajagar...@gmail.comwrote: i have a file contain only 0's and 1's, how can i compress it efficiently. say for e.g (000101010110110101001011101011101010101010. . )obviously order of 1 and 0 is not same as above. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from 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: remove redundantt parenthesis
how can once evaluate a+b, when a and b are just variables.. Its not necessary that the expression contains all the constants. On Wed, Oct 13, 2010 at 10:07 AM, Shiyam code_for_life mailshyamh...@gmail.com wrote: For every pair of braces, Evaluate the expression within the outer braces of current braces under consideration (1)With current braces (2)Without current braces If both are the same, then you can drop the current braces that its redundant. P.S for outer most braces, evaluate the entire expression with and without it Ex: (a+[b+c]) Here to check if square braces are redundant (1)Evaluate (a+[b+c]) and (a+b+c) (2)If both are equal then drop the braces so expression can be reduced as (a+b+c) (3)Else the braces are required so they remain as (a+[b+c]) Cheers 'Coding is an art and I'm one of the finest of them' -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from 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] Yahoo!!!! Puzzle
This looked like a variant of the socks problem :) On Tue, Sep 14, 2010 at 5:20 PM, Sathaiah Dontula don.sat...@gmail.comwrote: How_to_Ace_the_Brainteaser_Interview.pdf find this book, this has good number of puzzles. Thanks, Sathaiah Dontula On Tue, Sep 14, 2010 at 3:01 PM, vishal raja vishal.ge...@gmail.comwrote: take out that one A pill that's there in the jar. take the half of all the four pills, that's how u'll make sure that u've had 1 of 'A' and 1 of 'B' pill. On Tue, Sep 14, 2010 at 2:52 PM, bittu shashank7andr...@gmail.comwrote: You are on a strict medical regimen that requires you to take two types of pills each day. You must take exactly one A pill and exactly one B pill at the same time. The pills are very expensive, and you don't want to waste any. So you open the bottle of A pills, and tap one out into your hand. Then you open the bottle of B pills and do the same thing -- but you make a mistake, and two B pills come out into your hand with the A pill. But the pills are all exactly identical. There is no way to tell A pills apart from B pills. How can you satisfy your regimen and take exactly one of each pill at the same time, without wasting any pills? Write Algorithm to Solve dis Problem in constant time..isn't it..??? Regard's Shashank Mani Narayan Don't Be Evil U Can Earn While U learn Computer Science Engineering Birla Institute of Technology,Mesra Cell No. +91-9166674831 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from 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] Amazon intern Question
trie On Wed, Sep 1, 2010 at 5:45 PM, Arun yourarunb...@gmail.com wrote: You are given the amazon.com database which consists of names of millions of products. When a user enters a search query for particular object with the keyword say foo , output all the products which have names having 50% or more similarity with the given keyword ie foo Write the most efficient algorithm for the same. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from 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: Longest Palindromic Substring
this has been discussed here before and if i remeber correctly the solution was O(nlogn). Please go through the archives. On Thu, Aug 26, 2010 at 12:20 PM, Aditya Shanker adit.sh...@gmail.comwrote: The question would be complete if we know what order of notation is needed for solution. On 23.08.2010 15:32, Chi Hoang wrote: I don't think so, I've have wriiten a kart-trie: http://sourceforge.net/projects/kart-trie which is basically a patricia-tree or radix-tree. Such a tree has maximum 2 leafs at each branch whilst a suffix-tree can has more then 2 leafs at each branch (BTW. can you explain to me what does edge means when talking about trees?). This is my understanding of a suffix-tree so far. I'm awaiting your anwser! 2010/8/21 Chonku cho...@gmail.com You use a trie when you want to model a number of strings. Suffix Tree is used only when you have one string in your model. Suffix Tree is a type of trie, but the difference lies in the intent. On Sat, Aug 21, 2010 at 7:22 PM, Chi c...@linuxdna.com wrote: Isn't that by definition a compressed trie, i.e patricia-tree, crit- bit tree (suffix-tree)? Or what is the difference? On Aug 20, 5:17 pm, Nikhil Jindal fundoon...@yahoo.co.in wrote: @chonku As i understand, a trie is used when we have a lot of strings (such as a dictionary). Here we just have a single string. The resultant trie will be: a \ b \ c \ l \ e \ v \ e \ l \ a \ b \ c We get a similar trie for the reverse string. So why are you using a trie here? I cant see any advantage of it here. On Fri, Aug 20, 2010 at 8:36 AM, Chonku cho...@gmail.com wrote: Can we use a trie here. Make first pass from left to right and construct the trie. Make second pass from right to left and look for the trie branch with maximum nodes that match the characters. On Thu, Aug 19, 2010 at 7:46 PM, Nikhil Jindal fundoon...@yahoo.co.inwrote: Hi All, Givan a string, you have to find the longest palindromic substring. For ex: Longest Palindromic substring for abclevelabc is level. What is the most optimised solution possible? Please access the attached hyperlink for an important electronic communications disclaimer: http://dce.edu/web/Sections/Standalone/Email_Disclaimer.php -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email toalgoge...@googlegroups.com. To unsubscribe from this group, send email toalgogeeks+unsubscr...@googlegroups.comtoalgogeeks%2bunsubscr...@googlegroups.com algogeeks%2bunsubscr...@googlegroups.comalgogeeks%252bunsubscr...@googlegroups.com . For more options, visit this group athttp:// 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 toalgoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups .com algogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. Please access the attached hyperlink for an important electronic communications disclaimer: http://dce.edu/web/Sections/Standalone/Email_Disclaimer.php -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- ...::: Chi Hoang :::... Freelancer/PHP/TYPO3/MySQL Tel: +49(0)221-9460023 Url1: http://www.chihoang.de Url2: http://nano-math.users.sourceforge.net e-Mail: info at chihoang.de Skype: tetramatrix -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at
Re: [algogeeks] Brent's algorithm
Check out this link http://en.wikipedia.org/wiki/Cycle_detection On Wed, Aug 18, 2010 at 5:12 AM, jayapriya surendran priya7...@gmail.comwrote: hi..i wanna know what is brent's algorithm n whether it can be used to detect loops in linked list.If yes..is it better than Floyd's cycle finding algo? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from 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: Scope of an variable
The Dragon book it is :) On Wed, Jul 14, 2010 at 11:01 AM, Gene gene.ress...@gmail.com wrote: The classic reference is the Dragon Book, Aho Sethi and Ullman, Compiler Design, but there are many others. Louden Compiler Construction is a little easier to read. I have not found much comprehensive material in the Internet. A good book is the best way to go. On Jul 14, 12:13 am, Anand anandut2...@gmail.com wrote: @ Gene: Thanks for the nice explanation. Any pointers on where we can find such detailed explanation about compilation/compiler. On Tue, Jul 13, 2010 at 6:25 PM, Ashish Goel ashg...@gmail.com wrote: the highest scope may not be true, it uses the current scope to chk if the variable is defined there any pointer to study material? Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 On Wed, Jul 14, 2010 at 6:28 AM, Gene gene.ress...@gmail.com wrote: On Jul 8, 1:34 pm, gopinath sikha gopisi...@gmail.com wrote: Hi guys, How gcc or any c compiler maintains the scope of the variable? Especially all the static variable are maintained in the data section. Can anyone please respond. As a compiler processes the program, it maintains a table that maps identifier strings to associated attributes like type information, line number of declaration, etc., etc. This is called the symbol table. It's often implemented as a hash table. Self-balancing trees work fine, too. There are at least a couple of different ways to process scopes. Here is one. The symbol table must allow duplicate keys for this technique, so it's a multi-map rather than map. The compiler gives every scope a number. It does this by keeping a counter initialized at 0. Every time it sees a {, it increments the counter and the new value becomes the scope number. It also pushes each new scope number on a stack. At any given time, the stack contains the numbers of open scopes, with the innermost scope at the top. When the compiler processes a declaration, the declared name is added to the symbol table, and the scope number becomes one of its attributes. If an attempt is made to add a variable twice with the same scope number, a re-declaration error is printed for the user. When the compiler processes a variable use (as in x = 42), it looks up the variable (x) in the symbol table. If there is more than a single x, it uses the one with the highest scope number because this must be the inner scope where there is an x. If the variable (x) is not found at all, then an undefined identifier error is printed for the user. When the compiler processes the end of a scope, a }, it pops the scope stack. Say the closing scope is number N. Then the compiler removes all symbol table entries with scope N as attributes and keeps on processing. That's about it. There are some details like handling the id's for fields within structs, but I'm sure you can figure out how that works on your own. I.e. when you have struct point { float x, y; } x; x.x = 42; think about what the compiler is doing when it processes the { in the strut declaration, when it sees the x and the y, when it sees the second x and the third. Cheers. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com algogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com algogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at
Re: [algogeeks] Re: Amazon Puzzle
awesome :) On Wed, Jul 7, 2010 at 9:07 AM, Dave dave_and_da...@juno.com wrote: There are 6 cases to consider (we can list them but we don't know which one applies): 1. Initially, all 4 coins are tails. 2. Initially, all 4 coins are heads. 3. Initially, 3 of the coins are heads, 1 is tails. 4. Initially, 3 of the coins are tails, 1 is heads. 5. Initially, 2 diagonal coins are heads, the others are tails. 6. Initially, 2 adjacent coins are heads, the others are tails. After every flip, we ask if all coins are heads. If so we have solved the puzzle, otherwise we continue to the next step. We proceed as follows: 1. Flip all coins. At this point, we have solved the puzzle if case 1 applies. 2. Flip all coins. At this point, we have solved the puzzle if case 2 applies. 3. Flip any two diagonal coins. 4. Flip all coins. At this point, we have solved the puzzle if case 5 applies. 5. Flip any two adjacent coins. 6. Flip all coins. 7. Flip any two diagonal coins. 8. Flip all coins. At this point, we have solved the puzzle if case 6 applies. Thus, we are left with cases 3 and 4. 9. Flip any one coin. 10. Flip all coins. At this point, if the one coin we flipped in step 9 was the odd one, we have solved the puzzle. Otherwise, the current configuration has 2 heads and 2 tails. 11. Flip any two diagonal coins. 12. Flip all coins. At this point, we have solved the puzzle if the result of step 10 was diagonal pairs. 13. Flip any two adjacent coins. 14. Flip all coins. 15. Flip any two diagonal coins. 16. Flip all coins. At this point, we have solved the puzzle. Dave On Jul 5, 11:10 pm, Jitendra Kushwaha jitendra.th...@gmail.com wrote: Seems tough to do as every time we dont know which coins we flipped in the previous move We can perform all the four operation one by one in circular fashion and we will have probabilitty of getting all head up at some time. this is because even if table rotated at random, each of the for step will do different thing from previous step. I have not proofed it rigorously. It seems to be a solution to me comments appreciated... -- regards Jitendra -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from 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: cycle in Linked List generalised
There are more efficient ways of doing this. Refer wiki http://en.wikipedia.org/wiki/Cycle_detection#Brent.27s_algorithm On Wed, Jul 7, 2010 at 9:16 AM, Dave dave_and_da...@juno.com wrote: @Anand. You've described one way to do it, and maybe the most efficient way, but not the only way. Dave On Jul 6, 8:42 pm, Anand anandut2...@gmail.com wrote: you increment slow pointer by 1 and fast pointer by 2 to find a loop in Linked list. On Mon, Jul 5, 2010 at 9:02 PM, amit amitjaspal...@gmail.com wrote: Consider the general fast and slow pointer strategy to detect loop in a LL. Now , Suppose we move the slowPtr 'm' nodes at a time and move the fastPtr 'n' nodes at a time. What are the constraints on 'm' and 'n' so that we that we are able to find whether the list is circular or not? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com algogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from 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] plotter
good problem modeling :) On Tue, Jul 6, 2010 at 10:21 AM, Jitendra Kushwaha jitendra.th...@gmail.com wrote: problem can be converted in a graph question we have nC2 paths in n node (here n represent total points) now do travelling salesman on this graph. And the question is done -- Regards Jitendra Kushwaha MNNIT, Allahabad -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from 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] lru cache
keep n bits (depending on the usage level you want) to track for each element (cell/page) etc in the cache. Now whenever an element is loaded into cache set all the bits and on further use increment by 1 if not max value. Decrement value by 1 for all the block periodically. Now whenever you need to remove an element, select one with least value. On Fri, Jul 2, 2010 at 6:59 PM, sharad kumar sharad20073...@gmail.comwrote: how would u implement LRU cache -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from 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] Some C language Problem
For header file creation see any standard c library header files example. One thing to take care is to create a C define which will cause the file to be included only once. Regarding inserting the function, its prototype should be defined in appropriate header file and the code in associated .c file. On Thu, Jul 1, 2010 at 6:51 PM, Ashish guptaashish...@gmail.com wrote: Q.) How to create our own Header file ? and Q) Can we insert a our function in the existing header file ?? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from 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 problems
can you explain what you meant when you said the program fails after allocationg about 800mg(appx. i dont remember). This is the excerpt from calloc man page, Calloc will either fail or succeed but there is no way you can tell so much was alloted and then it failed. *Return Value***For calloc() and malloc(), the value returned is a pointer to the allocated memory, which is suitably aligned for any kind of variable, or NULL if the request fails. On Fri, Jun 18, 2010 at 1:09 AM, amit amitjaspal...@gmail.com wrote: 1. a mad user tries to allocate 1 gb memory using calloc. but the program fails after allocationg about 800mg(appx. i dont remember). Tell me what could have gone wrong? 2. We know disabling interrupts works only if it is single processor(i.e local disabling of interrupts). Consider this case where we have a SMP(symmetric multi proc) the processor. Processor-1 wants to perform some critical operation so it disables all the interrupts. What will happen when processor-2 throws an interrupt. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from 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] lowest common ancestor
very nice and informative link. Thanks a lot :) On Thu, Jun 17, 2010 at 4:08 PM, Vivek Sundararajan s.vivek.ra...@gmail.com wrote: http://www.topcoder.com/tc?module=Staticd1=tutorialsd2=lowestCommonAncestor The above link gives a detailed explanation about LCA and RMQ On 17 June 2010 15:30, jalaj jaiswal jalaj.jaiswa...@gmail.com wrote: write an algo which gives the lowest common ancestor of two nodes in a general tree(not binary specifically) -- With Regards, Jalaj Jaiswal +919026283397 B.TECH IT 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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Reduce, Reuse and Recycle Regards, Vivek.S -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from 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: union- c
I second this opinion. Lets keep discussion limited to algorithms only. On Mon, Jun 14, 2010 at 5:47 AM, Roshan Mathews rmath...@gmail.com wrote: On Sun, Jun 13, 2010 at 18:36, souravsain souravs...@gmail.com wrote: Lets keep discussions in t his group limited to Algos and problems neutral to any language. Yes, please. -- http://roshan.mathews.in/ -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from 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] nibbles
Write a c-macro to use assembly swap opcode. On Sat, Jun 12, 2010 at 9:35 PM, jalaj jaiswal jalaj.jaiswa...@gmail.comwrote: write an algorithm to reverse a nibble in one pass...using bitwise operators -- With Regards, Jalaj Jaiswal +919026283397 B.TECH IT 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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from 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] Mirroring Binary Tree Pattern Problem
what is a virtualization concept ??? I am a newbie regarding the Algo Analysis. I was asked this question recently in an interview. Please let me know if anyone of you know how to solve this. *Question:* Assume You have a binary Tree (not sorted and not BST) with a specific pattern on a Desktop1. How can this same binary Tree has be to mirrored to another desktop? *My Approach:* 1. Traverse the binary tree and store the elements in an array. Transfer the same to another process present on another desktop through socket communication. But in this case how do i construct the same binary tree at the other end? Do i read in one of the in-order/post-order/pre-order and do it the same way at the other end? 2. Does this involve Virtualization concept? Regards, Vikas J -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from 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: identify the recurring part for a given decimal no
Won't we require to check recurring till at-least two complete iterations of recurrence pattern. Also what's the division logic are we going to use ? In all modern day processor systems, we are likely to have a math co/sub-processor which will efficiently crunch numbers and round them off to our desire. Another way to look at this problem is by considering the no as sequence of digit and can apply any substring algorithm to find recurrence with better efficiency. My 2 Paise. :) On Sat, Jun 12, 2010 at 8:07 PM, Anurag Sharma anuragvic...@gmail.comwrote: Since we are given numerator 'n' and denominator 'd' separately already. and considering n and d as integers and d!=0 we can safely assume n/d as either a terminating fraction or a non terminating but recurring fraction, in which case we have to find the recurring digits of the fraction. Now what I suggested was almost same as Ravi's approach. take a Set 'S' keeping tuples (R,Q) where R is the current remainder and Q is the factor such that d*Q is subtracted from the number to get R. In other words. if at an intermediate step of division we have 'a' as the divident left then Q=floor(a/d) and R=a%d Keep dividing 'n' by 'd' like it is done manually. After every division check- 1. If the current remainder is not present in 'S' then add current remainder 'R' and corresponding quotient 'Q' in the set 2. If R is found in the set S, then all the following entries in the set until end will constitute the recurring digits. taking Ravi's example:- Example: 7) 9 (1.*285714*28S=[] 7 -- 20 S=[(2,2)] 14 --- 60S=[(2,2), (6,8)] 56 --- 40 S=[(2,2), (6,8), (4,5)] 35 --- 50 S=[(2,2), (6,8), (4,5), (5,7)] 49 --- 10 S=[(2,2), (6,8), (4,5), (5,7), (1,1)] 7 30 S=[(2,2), (6,8), (4,5), (5,7), (1,1), (3,4)] 28 ^ | 20 2 is found in S here, so recurring digits are 285714 14 60 56 repeats hope its clear Anurag Sharma On Sat, Jun 12, 2010 at 4:02 PM, divya jain sweetdivya@gmail.comwrote: @anurag i dint get ur approach..which numerator n denominator u r talking about..plz explain.. thanks in advance On 11 June 2010 08:57, Anurag Sharma anuragvic...@gmail.com wrote: Please note that the fractional repeating part is recurring. and so that 4th temporary variable assignment will be this way- temp=x*1 - x= 233456.34563456... - 23.34563456 = 233433.0 ( mark the fractional part is 0 now since the infinitely repeating 3456... will get cancelled) In this case you can say that 4 places are repeating. But yes its according to the maths and in any programming language whenever you divide the numerator and denominator you wont get this infinitely recurring decimal places. @divya, also your approach wont work if the recurring fractional digits start after few places from the decimal like in the case of 23.123345634563456 (note here after the decimal place 123 is not repeating while 3456.. after this 123 is repeating.) What I suggest in this case is keep dividing the numerator by denominator and at every step keep inserting the tupple (remainder, quotient) of that division step in a set. and before inserting in the set check whether it already exists. If yes then the all the quotients following from that point (including the point) will be recurring. Regards, Anurag Sharma On Thu, Jun 10, 2010 at 8:25 AM, Veer Sharma thisisv...@rediffmail.comwrote: Seems it wont work... x=23.34563456 temp = x*100 -x = 233.4563456 - 23.34563456 = 210.11071104 temp = x*100 -x = 2334.563456 - 23.34563456 = 2311.21782144 temp = x*1000 -x = 23345.63456 - 23.34563456 = 23322.28892544 temp = x*1 -x = 233456.3456 - 23.34563456 = 233432.6544 temp = x*10 -x = 2334563.456 - 23.34563456 = 2334540.11036544 ... On Jun 9, 11:24 pm, Anurag Sharma anuragvic...@gmail.com wrote: multiply the original number x=23.34563456 Anurag Sharma On Wed, Jun 9, 2010 at 10:36 PM, Veer Sharma thisisv...@rediffmail.comwrote: One question: No x = 23.34563456 temp = x X 10 = 233.4563456 temp = temp - x = 210.11071104 decimal part zero? No. Now multiply the no.
Re: [algogeeks] stack
what do you mean by sorting elements in stack ? A stack is a data structure in which the relative position of elements depend on their order of insertion. If we sort elements in stack, how does it retain the property of a stack ? If we really want that property, we will have O(n) rather than O(1) insert and maintain two pointers. Stack next and sorted next. On Sun, Jun 13, 2010 at 1:05 PM, jalaj jaiswal jalaj.jaiswa...@gmail.comwrote: how to sort elements of stack using constant space -- With Regards, Jalaj Jaiswal +919026283397 B.TECH IT 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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from 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: binary nos
@Rohit: Junta is looking forward for explanation about how one resorted to Fibonacci for such solution ? Or was it some 'gyaan' like sun rise in east direction. Would be real glad if we can know methods to find such fits. On Wed, Jun 9, 2010 at 9:16 PM, Rohit Saraf rohit.kumar.sa...@gmail.comwrote: @junta : are fibonacci sequence is the answer of the prob, it is not used :D -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and Engineering IIT Bombay http://www.cse.iitb.ac.in/~rohitfeb14http://www.cse.iitb.ac.in/%7Erohitfeb14 On Wed, Jun 9, 2010 at 9:13 PM, Rohit Saraf rohit.kumar.sa...@gmail.comwrote: @debajyoti: read the prob before posting -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and Engineering IIT Bombay http://www.cse.iitb.ac.in/~rohitfeb14http://www.cse.iitb.ac.in/%7Erohitfeb14 On Wed, Jun 9, 2010 at 2:37 PM, Debajyoti Sarma sarma.debajy...@gmail.com wrote: First 20 fibo no as follows with binary form 0 = 0 1 = 1 1 = 1 2 = 10 3 = 11 5 = 101 8 = 1000 13 = 1101 21 = 10101 34 = 100010 55 = 110111 89 = 1011001 144 = 1001 233 = 11101001 377 = 10001 610 = 1001100010 987 = 011011 1597 = 1100001 2584 = 10111000 4181 = 101010101 Now please explain how fibo no is coming under consideration.Both kind of no is mixed here. On Wed, Jun 9, 2010 at 8:02 AM, Rohit Saraf rohit.kumar.sa...@gmail.com wrote: Fib comes because she wants the number of such sequences -- -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and Engineering IIT Bombay http://www.cse.iitb.ac.in/~rohitfeb14http://www.cse.iitb.ac.in/%7Erohitfeb14 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from 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: binary nos
hmmm ... Atleast I was of the opinion that such nos. were required and hence was thinking fib is not the thing. Thanks for clarifying. On Wed, Jun 9, 2010 at 8:02 AM, Rohit Saraf rohit.kumar.sa...@gmail.comwrote: Fib comes because she wants the number of such sequences -- -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and Engineering IIT Bombay http://www.cse.iitb.ac.in/~rohitfeb14http://www.cse.iitb.ac.in/%7Erohitfeb14 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from 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: constraints satisfied?
Using an n*n array, am afraid, will not solve the problem, since its not capable to capture transitivity. Consider the case: v1=v2 v3=v2 v3!=v1 we will place 0 in arr(1,2) arr(2,1) for v1=v2 we will place 0 in arr(2,3) arr(3,2) for v3=v2 and place 1 in arr(1,3) and arr(3,1) for v3!=v1. no overwrite :( and still the constraints cannot be satisfied. -jkd On Tue, Jun 8, 2010 at 10:07 PM, Minotauraus anike...@gmail.com wrote: Use a n x n array. initialize with -1 (don't care = no constraints). If there is an equality constraint, set to 1, if explicity non-equality constraint is expected, replace with 0. While doing either of these if you come across a situation where 0 has to be overwritten by 1 or 1 has to be overwritten by 0, the system constraints cannot be satisfied, else all is well. Space required = n^2 bytes. Time complexity = O(c) where c= number of constraints for the system. Therefore, independent of the number of variables. You can do this with hash tables too and probably save memory. Here you'll use not store = -1 = don't care. -Minotauraus. On Jun 7, 12:16 pm, divya sweetdivya@gmail.com wrote: Here's a problem that occurs in automatic program analysis. For a set of variables x1; .. ; xn, you are given some equality constraints, of the form xi = xj and some dis equality constraints, of the form xi != xj Is it possible to satisfy all of them? Give an efficient algorithm that takes as input m constraints over n variables and decides whether the constraints can be satisfied. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from 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] divisible by 3
how abt using FSA ? consider state as a remainder when the given no. is divided by 3. Then we get a FSA for any length no. as [image: fsa.JPG] On Sun, Jun 6, 2010 at 12:15 AM, divya sweetdivya@gmail.com wrote: Find if a number is divisible my 3, without using %,/ or *. You can use atoi(). -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. fsa.JPG
Re: [algogeeks] Valid permutation of the brackets
Believe it won't be simple, since its not following a language like hierarchy. try to evolve set of solution for 4 from 3 and you will notice that its not a straight function. On Fri, Jun 4, 2010 at 1:40 PM, Rohit Saraf rohit.kumar.sa...@gmail.comwrote: @jitendra: How can you say that no polynomial algo can be found. I think you are wrong. A simple memoized formulation will make this polynomial because of the optimal substructure.. -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and Engineering IIT Bombay http://www.cse.iitb.ac.in/~rohitfeb14http://www.cse.iitb.ac.in/%7Erohitfeb14 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from 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] Check if 2 linked lists are identical
@ Raj, Just to clarify, same elements refer to copy of identical data or link list members pointing to same data ? On Wed, Jun 2, 2010 at 10:47 PM, Raj N rajn...@gmail.com wrote: @Antony: The 2 lists should have the same elements as well the number must be equal On Wed, Jun 2, 2010 at 5:38 PM, Antony Vincent Pandian.S. sant...@gmail.com wrote: @Raj What do you mean by identical? You are just concerned about the presence of one element in another LL or you are concerned about the equality of number of elements too? On 6/2/10, Raj N rajn...@gmail.com wrote: @sharad kumar: But don't you think this'll consume a lot of space. Merge sort will give O(nlogn) complexity when a separate LL is used to store the sorted elements but if we disbuild the same LL it'll be O(n2). And also wat do u mean by combining LL can u explain On Wed, Jun 2, 2010 at 6:48 AM, sharad kumar aryansmit3...@gmail.com wrote: @Raj:sorting can be done in O(nlogn)..sort both and compare both.or use a hash map to store all elements of one LL and then compare it with otheror combine both the LL perform merge sort and start deleting adjacent elements.if adjacent elements in equal count then LL are equal and at end of process we get an empty list. On Tue, Jun 1, 2010 at 11:55 PM, Raj N rajn...@gmail.com wrote: Hi all, Can someone suggest an efficient algorithm to check if 2 linked lists are identical. If 2 lists have to be sorted then there'll be a lot of space consumption for 2 separate linked lists. Can the whole process be done O(n2) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com algogeeks%2bunsubscr...@googlegroups.comalgogeeks%252bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- yezhu malai vaasa venkataramana Govinda Govinda -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com algogeeks%2bunsubscr...@googlegroups.comalgogeeks%252bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- Sent from my mobile device Luv, S.Antony Vincent Pandian -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from 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] sizrof imolementation
As you already mentioned sizeof is an operator and not a lib fn. Which means it will be evaluated/code for it will be replaced at compile time rather than during execution. It will follow the following grammar, unary_operator: sizeof , and others sizeof: ( unary expression | type_name) and so on for unary expression and type_name which would eventually result in built-in or user-defined data-types whose 'size' can be inferred from symbol table. If some one needs to code a size of operator, it won;t be possible since you can not actually pass type in c, there can be ways to do this using macros like using stringization of macro. On Mon, May 31, 2010 at 1:14 PM, debajyotisarma sarma.debajy...@gmail.comwrote: This is not about algorithms,but related to C programming. How to implement sizeof operator? macro for this #define my_sizeof(a) (char*)(a+1)-(char*)a this works fine of variables int a; printf(%d,my_sizeof(a)); //or even for user defined structures but it will not work for data types like printf(%d,my_sizeof(int)); so please get another solution. function will be preferable.not macro -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.