{"id":4997,"date":"2018-02-20T23:50:30","date_gmt":"2018-02-20T23:50:30","guid":{"rendered":"http:\/\/essaysparlor.com\/algorithm-analysis\/"},"modified":"2017-02-20T19:09:44","modified_gmt":"2017-02-20T19:09:44","slug":"algorithm-analysis","status":"publish","type":"post","link":"https:\/\/www.benedictsol.com\/blogs\/algorithm-analysis\/","title":{"rendered":"Algorithm Analysis"},"content":{"rendered":"<p>\nConsider the following pseudocode of a function which takes an integer n=0n=0 as input.<\/p>\n<p>Function bar(n)<br \/>\n   Print &#8216;*&#8217;;<br \/>\n   if n == 0 then<br \/>\n      Return;<br \/>\n   end<br \/>\n   for i = 0 to n &#8211; 1 do<br \/>\n      bar(i);<br \/>\n   end<\/p>\n<p>\nLet T(n) be the number of times the above function prints a star (*) when called with input n = 0. What is T(n) exactly, in terms of only n (and not values like T(n &#8211; 1) or T(n &#8211; 2))? Prove your statement by induction.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Consider the following pseudocode of a function which takes an integer n=0n=0 as input. Function bar(n) Print &#8216;*&#8217;; if n == 0 then Return; end for i = 0 to n &#8211; 1 do bar(i); end Let T(n) be the <a href=\"https:\/\/www.benedictsol.com\/blogs\/algorithm-analysis\/\" class=\"read-more\">Read More &#8230;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-4997","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/www.benedictsol.com\/blogs\/wp-json\/wp\/v2\/posts\/4997","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.benedictsol.com\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.benedictsol.com\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.benedictsol.com\/blogs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.benedictsol.com\/blogs\/wp-json\/wp\/v2\/comments?post=4997"}],"version-history":[{"count":0,"href":"https:\/\/www.benedictsol.com\/blogs\/wp-json\/wp\/v2\/posts\/4997\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.benedictsol.com\/blogs\/wp-json\/wp\/v2\/media?parent=4997"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.benedictsol.com\/blogs\/wp-json\/wp\/v2\/categories?post=4997"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.benedictsol.com\/blogs\/wp-json\/wp\/v2\/tags?post=4997"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}