tag:blogger.com,1999:blog-6849619265483407528.post3672194242645226506..comments2024-03-28T21:19:24.965-07:00Comments on Programming Interview Questions and Answers: Recursion–concepts and codeNikhil Singhalhttp://www.blogger.com/profile/03662183414943720702noreply@blogger.comBlogger23125tag:blogger.com,1999:blog-6849619265483407528.post-5056499748931949212024-03-13T21:43:48.589-07:002024-03-13T21:43:48.589-07:00excellent blog. thanks for sharing. Full Stack Cou...excellent blog. thanks for sharing. <a href="https://www.iteducationcentre.com/full-stack-training-institute-in-pune.php" rel="nofollow">Full Stack Course In Pune</a>jeetuThhttps://www.blogger.com/profile/09361817099714062113noreply@blogger.comtag:blogger.com,1999:blog-6849619265483407528.post-78648791817773423322023-09-29T02:25:19.895-07:002023-09-29T02:25:19.895-07:00Recursion is a fundamental programming concept tha...Recursion is a fundamental programming concept that allows functions to call themselves. <a href="https://www.creatisimo.net/security-of-wordpress-plugins-how-to-choose-safe-ones/" rel="nofollow">The Security Wordpess</a> It's a powerful tool for solving complex problems by breaking them down into smaller, more manageable steps.VPNGAMNGhttps://www.blogger.com/profile/18392618934254147038noreply@blogger.comtag:blogger.com,1999:blog-6849619265483407528.post-26100536994864026802021-12-15T00:11:03.057-08:002021-12-15T00:11:03.057-08:00Hi Dear, have you been certainly visiting this sit...Hi Dear, have you been certainly visiting this site daily, if that's the case you then will certainly get good knowledge.<br /><a href="https://twollow.com/want-to-design-your-own-logo-best-logo-maker-app/" rel="nofollow">business logo design company</a><br />Petter Johnhttps://www.blogger.com/profile/08884887707262443304noreply@blogger.comtag:blogger.com,1999:blog-6849619265483407528.post-76621261427282049372021-02-22T00:10:12.146-08:002021-02-22T00:10:12.146-08:00Aivivu chuyên vé máy bay, tham khảo
vé máy bay đi...Aivivu chuyên vé máy bay, tham khảo<br /><br /><a href="https://aivivu.com/ve-may-bay-di-my-us-gia-re-bao-nhieu-tien/" rel="nofollow">vé máy bay đi Mỹ khứ hồi</a><br /><br /><a href="https://aivivu.com/ve-may-bay-tu-my-ve-viet-nam-gia-re/" rel="nofollow">chuyến bay từ mỹ về việt nam hôm nay</a><br /><br /><a href="https://aivivu.com/ve-may-bay-tu-canada-ve-viet-nam-gia-re/" rel="nofollow">ve may Huongkvhttps://www.blogger.com/profile/09167457771171306382noreply@blogger.comtag:blogger.com,1999:blog-6849619265483407528.post-32389718353644790882020-11-17T12:06:34.256-08:002020-11-17T12:06:34.256-08:00Great Blog to read,Its gives more useful informati...Great Blog to read,Its gives more useful information.Thank lot. <br /><br /><a href="https://prwatech.in/apache-spark-training-institute-in-pune/" rel="nofollow"> Apache Spark Training in Pune </a><br /><a href="https://prwatech.in/apache-spark-training-institute-in-pune/" rel="nofollow"> Spark Training Institute in Pune </a>Mohd Shariquehttps://www.blogger.com/profile/04899266769471022618noreply@blogger.comtag:blogger.com,1999:blog-6849619265483407528.post-26691551044440529382018-06-17T21:52:04.938-07:002018-06-17T21:52:04.938-07:00Nice blog has been shared by you. it will be reall...Nice blog has been shared by you. it will be really helpful to many peoples who are all working under the technology.thank you for sharing this blog.<br /><br /><a href="https://www.zuaneducation.com/php-training-courses" rel="nofollow"> Php course in chennai</a>sriramhttps://www.blogger.com/profile/09683538147321194792noreply@blogger.comtag:blogger.com,1999:blog-6849619265483407528.post-90317946466265123702018-05-08T21:56:26.211-07:002018-05-08T21:56:26.211-07:00Pretty blog, so many ideas in a single site, thank...Pretty blog, so many ideas in a single site, thanks for the informative article, keep updating more article.<br /><a href="https://www.zuaneducation.com/php-training-courses" rel="nofollow">PHP course in chennai</a>Naveen Shttps://www.blogger.com/profile/06482963596732633713noreply@blogger.comtag:blogger.com,1999:blog-6849619265483407528.post-20669727889501487092018-04-18T21:24:44.147-07:002018-04-18T21:24:44.147-07:00Hi There,
Amaze! I have been looking bing for ho...Hi There, <br /><br />Amaze! I have been looking bing for hours because of this and i also in the end think it is in this article! Maybe I recommend you something helps me all the time?<br /><br /><br />I am trying to scraping a web-site using Jsoup. <br /><br />I have Login successfully and while move to the next page (Result page) the data are loading by Restful web-service as JSON. need to Anonymoushttps://www.blogger.com/profile/04859983121687046225noreply@blogger.comtag:blogger.com,1999:blog-6849619265483407528.post-46083374276170442902017-05-13T04:45:11.607-07:002017-05-13T04:45:11.607-07:00Who actually uses recursion in real life?
Who actually uses recursion in real life?<br />Anonymoushttps://www.blogger.com/profile/16132255219965806286noreply@blogger.comtag:blogger.com,1999:blog-6849619265483407528.post-30111989069145395242017-05-07T06:33:57.621-07:002017-05-07T06:33:57.621-07:00you can use iteration too
public static int Gcd...you can use iteration too<br /><br /> public static int Gcd(int number1, int number2)<br /> {<br /> while (true)<br /> {<br /> // find the remainder<br /> int remainder = number1 % number2;<br /> // base condition - if the number divide<br /> if (remainder == 0)<br /> return number2;<br />Thiagohttps://www.blogger.com/profile/02749490781901689972noreply@blogger.comtag:blogger.com,1999:blog-6849619265483407528.post-76725790175243907422017-04-27T16:54:34.342-07:002017-04-27T16:54:34.342-07:00I usually ask during coding interviews a question ...I usually ask during coding interviews a question about recursion: http://www.codeavenger.com/2017/04/26/Ask-about-recursion-during-coding-interviews-to-identify-good-talent.htmlVMASOFThttps://www.blogger.com/profile/12320709880532441459noreply@blogger.comtag:blogger.com,1999:blog-6849619265483407528.post-86536568487555527512015-08-12T21:40:11.272-07:002015-08-12T21:40:11.272-07:00GCD's program has error of stack overflow Exce...GCD's program has error of stack overflow Exception<br />when supplying values like 5 and 4 or 5 and 3, <br />and can be solved as<br />public int GCD(int num1, int num2)<br /> {<br /> int reminder = num1 % num2;<br /> if (reminder == 0)<br /> return num2;<br /> else<br /> {<br /> num1 = num2;<br />Anonymoushttps://www.blogger.com/profile/17732005912811991149noreply@blogger.comtag:blogger.com,1999:blog-6849619265483407528.post-68583123876419129682014-02-06T07:27:41.336-08:002014-02-06T07:27:41.336-08:00 public static int Gcd(int number1, int number2)
... public static int Gcd(int number1, int number2)<br /> {<br /> if (number2 == 0)<br /> return number1;<br /> else // recurse<br /> return Gcd(number2, number1 % number2);<br /> }Anonymoushttps://www.blogger.com/profile/06242493876176812126noreply@blogger.comtag:blogger.com,1999:blog-6849619265483407528.post-76400542758625064362014-02-06T07:19:24.293-08:002014-02-06T07:19:24.293-08:00GCD would fail if the 2nd number is 0.GCD would fail if the 2nd number is 0.Anonymoushttps://www.blogger.com/profile/06242493876176812126noreply@blogger.comtag:blogger.com,1999:blog-6849619265483407528.post-25780775632118524712014-01-08T18:42:59.959-08:002014-01-08T18:42:59.959-08:00You fibonacci code is wrong, 2 would return 2 not ...You fibonacci code is wrong, 2 would return 2 not 1. you need if(n == 0) return 0;RoyalPinehttps://www.blogger.com/profile/02098196514918332867noreply@blogger.comtag:blogger.com,1999:blog-6849619265483407528.post-15912445576475681902013-09-04T22:37:07.824-07:002013-09-04T22:37:07.824-07:00You are correct, i noticed this too.You are correct, i noticed this too.WillWorkForFoodhttps://www.blogger.com/profile/04741484962722493927noreply@blogger.comtag:blogger.com,1999:blog-6849619265483407528.post-79332760322386174712013-04-22T05:43:10.063-07:002013-04-22T05:43:10.063-07:00My Gcd runs faster than yours (:-)
public static ...My Gcd runs faster than yours (:-)<br /><br />public static int Gcd2(int x, int y)<br /> {<br /> if (x==y) return x;<br /> return( Gcd2( Math.min(x, y), (Math.max(x,y)- Math.min(x,y)) ));<br /> }<br />ambrooks1@gmail.comAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-6849619265483407528.post-27856766762176432392012-12-09T03:08:33.842-08:002012-12-09T03:08:33.842-08:00THanks Nikhil - nice explanation. The factorial i...THanks Nikhil - nice explanation. The factorial is a really common question, I was asked it at Amazon interview too. I was looking around for a more challenging recursion interview question and I found this one:<br /><br /><br />http://www.programmerinterview.com/index.php/general-miscellaneous/nested-list-recursion/Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6849619265483407528.post-35689810516585088542012-11-13T14:28:47.704-08:002012-11-13T14:28:47.704-08:00no. Try 4 and 8.no. Try 4 and 8.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6849619265483407528.post-4673918067248900152012-11-13T14:26:59.810-08:002012-11-13T14:26:59.810-08:00....no. Otherwise nothing would ever get returned........no. Otherwise nothing would ever get returned.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6849619265483407528.post-11543727599758357272012-04-25T19:04:44.829-07:002012-04-25T19:04:44.829-07:00number1 must be bigger than number2 otherwise won&...number1 must be bigger than number2 otherwise won't work....Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6849619265483407528.post-59260442125248954342012-01-22T02:27:50.651-08:002012-01-22T02:27:50.651-08:00Mayuran:
The code GDC is correct in the article.
...Mayuran:<br /><br />The code GDC is correct in the article.<br /><br />There is a minor mistake in the GenerateFibonacci() function as it doesn't take fib(0) = 0 case.<br /><br /> private static int Fibonacci(int x)<br /> {<br /> if (x <= 0)<br /> return 0;<br /> else if (x == 1)<br /> return 1;<br /> else<br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6849619265483407528.post-56914924159873088932011-12-31T22:34:58.482-08:002011-12-31T22:34:58.482-08:00very good explanation.A little observation for the...very good explanation.A little observation for the GCD code, the last line should be :<br /> Gcd(number2, remainder);<br />and not<br />return Gcd(number2, remainder);Ogahhttps://www.blogger.com/profile/14987040495802902891noreply@blogger.com