{"id":2232,"date":"2018-01-04T13:30:45","date_gmt":"2018-01-04T20:30:45","guid":{"rendered":"https:\/\/blogs.ubc.ca\/cpsc3202017winter2\/?page_id=2232"},"modified":"2018-01-16T16:36:02","modified_gmt":"2018-01-16T23:36:02","slug":"sample-problems-for-tutorial-1","status":"publish","type":"page","link":"https:\/\/blogs.ubc.ca\/cpsc3202017winter2\/sample-problems-for-tutorial-1\/","title":{"rendered":"Sample problems for tutorial week #1"},"content":{"rendered":"<ol>\n<li>Rank the following functions by order of growth. That is, order them so that f<sub>1<\/sub> \u2208 O(f<sub>2<\/sub>), f<sub>2<\/sub> \u2208 O(f<sub>3<\/sub>), etc. Make sure to indicate whether or not f<sub>i<\/sub> \u2208 \u0398(f<sub>i+1<\/sub>). For instance you could use the notation n &lt; n^2 = 2n^2 &lt; n^4&#8230;<br \/>\n<table border=\"3\">\n<tbody>\n<tr>\n<td width=\"140\">n<sup>3<\/sup> &#8211; n <span style=\"white-space: nowrap;\">\u221a<span style=\"text-decoration: overline;\">\u00a0n\u00a0<\/span><br \/>\n<\/span><\/td>\n<td width=\"120\">n!<\/td>\n<td>log<sub>2<\/sub>n<\/td>\n<td width=\"120\">2<sup>n<\/sup><\/td>\n<\/tr>\n<tr>\n<td>3<sup>2n<\/sup><\/td>\n<td>log<sub>3<\/sub>n<\/td>\n<td width=\"140\">n<sup>1.2<\/sup><\/td>\n<td>3<sup>2n-1<\/sup><\/td>\n<\/tr>\n<tr>\n<td width=\"140\">1.5<sup>1.5<sup>n<\/sup><\/sup><\/td>\n<td><span style=\"white-space: nowrap;\">\u221a<span style=\"text-decoration: overline;\">\u00a0n\u00a0<\/span><br \/>\n<\/span><\/td>\n<td>3<sup>n<\/sup><\/td>\n<td>n<sup>3<\/sup> + log n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/li>\n<li>An undirected graph is <i>connected<\/i> if for every two nodes <i>N1<\/i> and <i>N2<\/i>, there is a path from <i>N1<\/i> to <i>N2<\/i> in the graph. Describe a simple algorithm to determine if a given graph is connected. What is the running time of your algorithm?<\/li>\n<li>Suppose you begin with a pile of <tt>n<\/tt> stones, and split this pile into <tt>n<\/tt> piles of one stone each by successively splitting a pile of stones into two smaller piles. Each time you split a pile you multiply the number of stones in each of the two smaller piles you form, so that if these piles have <tt>r<\/tt> and <tt>s<\/tt> stones in them, respectively, you compute <tt>rs<\/tt>. Show that no matter how you split the pile, the sum of the products computed at each step equals <tt>n(n-1)\/2<\/tt>. Here is an example that shows how the computation proceeds:<br \/>\n<blockquote><p><img decoding=\"async\" src=\"https:\/\/blogs.ubc.ca\/cpsc3202017winter2\/files\/2018\/01\/tree.jpg\" \/><\/p><\/blockquote>\n<p>The sum is 21+2+12+1+3+2+2+1+1 = 45, which is indeed 10 * 9 \/ 2.<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Rank the following functions by order of growth. That is, order them so that f1 \u2208 O(f2), f2 \u2208 O(f3), etc. Make sure to indicate whether or not fi \u2208 \u0398(fi+1). For instance you could use the notation n &lt; n^2 = 2n^2 &lt; n^4&#8230; n3 &#8211; n \u221a\u00a0n\u00a0 n! log2n 2n 32n log3n n1.2 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blogs.ubc.ca\/cpsc3202017winter2\/sample-problems-for-tutorial-1\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Sample problems for tutorial week #1&#8221;<\/span><\/a><\/p>\n","protected":false},"author":55633,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-2232","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/blogs.ubc.ca\/cpsc3202017winter2\/wp-json\/wp\/v2\/pages\/2232","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.ubc.ca\/cpsc3202017winter2\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/blogs.ubc.ca\/cpsc3202017winter2\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.ubc.ca\/cpsc3202017winter2\/wp-json\/wp\/v2\/users\/55633"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.ubc.ca\/cpsc3202017winter2\/wp-json\/wp\/v2\/comments?post=2232"}],"version-history":[{"count":5,"href":"https:\/\/blogs.ubc.ca\/cpsc3202017winter2\/wp-json\/wp\/v2\/pages\/2232\/revisions"}],"predecessor-version":[{"id":2305,"href":"https:\/\/blogs.ubc.ca\/cpsc3202017winter2\/wp-json\/wp\/v2\/pages\/2232\/revisions\/2305"}],"wp:attachment":[{"href":"https:\/\/blogs.ubc.ca\/cpsc3202017winter2\/wp-json\/wp\/v2\/media?parent=2232"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}