{"id":6364,"date":"2025-11-13T11:16:46","date_gmt":"2025-11-13T05:46:46","guid":{"rendered":"https:\/\/study.madeeasy.in\/?p=6364"},"modified":"2025-11-13T11:58:39","modified_gmt":"2025-11-13T06:28:39","slug":"recursion","status":"publish","type":"post","link":"https:\/\/www.madeeasy.in\/study\/cs-it\/recursion","title":{"rendered":"Recursion and Recursive Function"},"content":{"rendered":"<p>The stack is used to store and restore the recursive function and its argument(s).<\/p>\n<p>(i) Tail recursion<br \/>\n(ii) Non-tail recursion<br \/>\n(iii) Indirect recursion<br \/>\n(iv) Nested recursion<\/p>\n<p style=\"text-align: justify;\">(i) Tail recursion: It is a recursive function where the function calls itself at the end (\u201ctail\u201d) of the function, and no computation is done after the return of the recursive call.<\/p>\n<p><strong>Example:<\/strong><\/p>\n<p>printarray(a, i, j)\u00a0 \/\/ recursive function to print array elements<br \/>\n{<br \/>\nif (i = = j)<br \/>\n{<br \/>\n1. printf(a[i]);<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\n2. printf(a[i]);<br \/>\n3. printarray(a, i + 1, j);<br \/>\n}<br \/>\n}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The stack is used to store and restore the recursive function and its argument(s). (i) Tail recursion (ii) Non-tail recursion<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,94],"tags":[1888,1887,1889,1886],"class_list":["post-6364","post","type-post","status-publish","format-standard","hentry","category-cs-it","category-operating-system","tag-indirect-recursion","tag-nested-recursion","tag-non-tail-recursion","tag-tail-recursion"],"_links":{"self":[{"href":"https:\/\/www.madeeasy.in\/study\/wp-json\/wp\/v2\/posts\/6364","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.madeeasy.in\/study\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.madeeasy.in\/study\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.madeeasy.in\/study\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.madeeasy.in\/study\/wp-json\/wp\/v2\/comments?post=6364"}],"version-history":[{"count":0,"href":"https:\/\/www.madeeasy.in\/study\/wp-json\/wp\/v2\/posts\/6364\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.madeeasy.in\/study\/wp-json\/wp\/v2\/media?parent=6364"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.madeeasy.in\/study\/wp-json\/wp\/v2\/categories?post=6364"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.madeeasy.in\/study\/wp-json\/wp\/v2\/tags?post=6364"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}