<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Yuji Yamauchiのブログ</title>
<link>https://ameblo.jp/eugene-y/</link>
<atom:link href="https://rssblog.ameba.jp/eugene-y/rss20.xml" rel="self" type="application/rss+xml" />
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com" />
<description>The collection of computer science problems(And answers from me! hahahwehahaha duh meh yhwh wer)</description>
<language>ja</language>
<item>
<title>Some T or Fs</title>
<description>
<![CDATA[ All from Algorithm Design p.188-190.<br><br>和訳はまだ<br><br>Question1:<br><br>T or F?<br>Let G be an arbitrary connected, undirected graph with a distinct cost c(e) on every edge e. Suppose<br>e* is the cheapest edge in G. Then there is a minimum spanning tree T of G that contains the edge e*.<br><br>Answer:<br>True. Refer to the proof of correctness of Prim's alg.<br><br>Q2:<br>(a)Suppose we are given an instance of the minimum spanning tree problem on a graph G with edge costs that are all positive and distinct. Let T be a minimum spanning tree for this instance. Now suppose we replace each edge cost by its square, thereby creating a new instance the problem with the same graph but different costs.<br>T or F? T must still be a minimum spanning tree for this new instance.<br><br>Answer:<br>True. When a &gt;= b and c &gt;= d(all positive integers), a^2 + c^2 &gt; b^2 + d^2. This shows T's cost must still be minimum.<br><br>(b)Suppose we are given an instance of the shortest s-t path problem on a directed graph G. We assume that all edge costs are positive and distinct. Let P be a minimum-cost s-t path for this instance. Now suppose we replace each edge cost c(e) by its square c(e)^2, thereby creating a instance of the problem with the same graph but different costs.<br>T or F? P must still be a minimum-cost s-t path for this new instance.<br><br>Answer:<br>False. Suppose it is true. Then when a+b&gt;=c+d, a^2+b^2&gt;=c^2+d^2. This is simply false(consider the case where a = 3, b = 1, c = 2 and d = 2).<br><br><br><br>
]]>
</description>
<link>https://ameblo.jp/eugene-y/entry-10752250752.html</link>
<pubDate>Thu, 30 Dec 2010 07:16:10 +0900</pubDate>
</item>
<item>
<title>The number of A's</title>
<description>
<![CDATA[ Question:<br><br> C言語により記述された次の関数fがある。ここで、display()は  <br> 画面に1個の文字Aを書く手続きであるとする。  <br> Consider the following function f written in C. Here, display() is a function <br>that prints an 'A'.<br><br> int f(int x){  <br> display();  <br> if(x==0)return 1;  <br> if(x==1)return 3;  <br> if(x==2)return 5;  <br> return(f(x-1)+f(x-2)+f(x-3));  <br> }  <br> <br>いま、f(x)を呼び出したとき、値105が返された。このf(x)が呼び出されてから  <br> 値を返すまでの間に、文字Aは画面にいくつ書かれたか。  <br> Upon a call to f(x), 105 is returned. How many A's have been printed since this call?<br><br>１．43　２．44　３．45　４．46　５．47<br><br>(Source: 2ch)<br><br>Answer:<br><br>Naive approach:<br>x    f(x)    #A's<br>7    105    46<br>6    57      25<br>5    31      13<br>4    17      7<br>3    9       4<br>2    5       1<br>1    3        1<br>0    1        1<br><br><br><br><br>
]]>
</description>
<link>https://ameblo.jp/eugene-y/entry-10752207393.html</link>
<pubDate>Thu, 30 Dec 2010 05:21:54 +0900</pubDate>
</item>
<item>
<title>computer science problems and answers</title>
<description>
<![CDATA[ I'll post problems related to computer science found online, textbook, etc. and my answers to them in this blog.<br>The main objective is to help me improve my rotten brain by making it a rule to think about how to solve problems.<br><br>
]]>
</description>
<link>https://ameblo.jp/eugene-y/entry-10752205914.html</link>
<pubDate>Thu, 30 Dec 2010 05:11:47 +0900</pubDate>
</item>
</channel>
</rss>
