{"id":673,"date":"2013-12-21T13:51:08","date_gmt":"2013-12-21T18:51:08","guid":{"rendered":"http:\/\/wcarss.ca\/log\/?p=673"},"modified":"2013-12-21T13:55:48","modified_gmt":"2013-12-21T18:55:48","slug":"pro-tip","status":"publish","type":"post","link":"https:\/\/wcarss.ca\/log\/2013\/12\/pro-tip\/","title":{"rendered":"pro-tip:"},"content":{"rendered":"<p>don&#8217;t try to keep it all in your head.<\/p>\n<p>I&#8217;m reading about the <a title=\"wikipedia link to cycle detection, subsection \" href=\"http:\/\/en.wikipedia.org\/wiki\/Cycle_detection#Tortoise_and_hare\">tortoise and hare algorithm<\/a> for finding cycle detection. Just moments ago, I read the following in the (awful) comment on wikipedia:<\/p>\n<pre># now the position of tortoise which is the distance between\r\n# hare and tortoise is divisible by the length of the cycle.<\/pre>\n<p>So, the position of the tortoise is x, and the position of the hare is 2x, and x is divisible by L, the length of the cycle. I&#8217;m surprised that x is necessarily divisible by L, so I figured it&#8217;s time to do a thought experiment. So I sat here and thought &#8220;okay so let&#8217;s imagine a graph with a cycle in it &#8212; maybe 2 nodes going in, and 3 nodes cycling back and forth&#8221;. Next, I thought &#8220;Now let&#8217;s consider the tortoise at the point of entry into the cycle &#8212; he&#8217;s moved 2 steps, so the hare would have moved 4&#8230; so the hare would be&#8221; and I started trying to picture the point the hare would be at. Meanwhile, I&#8217;m thinking &#8220;maybe I should try fewer vertices? Or more&#8230;&#8221;, and &#8220;Maybe I should go step by step and keep track of each of their progress through the sequence.&#8221;<\/p>\n<p>If that sounds confusing, good. Because it is. Keeping a ton of stuff in your head like that is silly, and error-prone, and vulnerable to distraction. Just by thinking &#8220;I should write a short blog post about this&#8221;, I lost some of the state I&#8217;d built up. Actually writing the blog has obliterated any progress I&#8217;d made.<\/p>\n<p><strong>Instead of trying to keep things in your head<\/strong> &#8212; whether you do it out of laziness, or because you want to prove you can do it*, or because it just doesn&#8217;t occur to you to do otherwise &#8212; <strong>just write things down<\/strong>. Open a text editor and plop things in there, or my personal recommendation: grab a pencil and some paper and write\/draw it out. The physical world can do the job of remembering where and what everything is, and you just have to figure out the transformations. <strong>Much easier. Much smarter.<\/strong><\/p>\n<p>* I fall into this trap whenever I use Khan Academy&#8217;s tests. I start off on something easy enough that it makes sense to keep in my head. Then it gets a little harder, for a long time, and eventually I&#8217;m struggling to multiply 5 digit numbers in my head for no reason other than a misguided sense of pride. I&#8217;ll usually give up around then, too, which shows that it&#8217;s not a smart path.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>don&#8217;t try to keep it all in your head. I&#8217;m reading about the tortoise and hare algorithm for finding cycle detection. Just moments ago, I read the following in the (awful) comment on wikipedia: # now the position of tortoise which is the distance between # hare and tortoise is divisible by the length of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/wcarss.ca\/log\/wp-json\/wp\/v2\/posts\/673"}],"collection":[{"href":"https:\/\/wcarss.ca\/log\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wcarss.ca\/log\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wcarss.ca\/log\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wcarss.ca\/log\/wp-json\/wp\/v2\/comments?post=673"}],"version-history":[{"count":5,"href":"https:\/\/wcarss.ca\/log\/wp-json\/wp\/v2\/posts\/673\/revisions"}],"predecessor-version":[{"id":678,"href":"https:\/\/wcarss.ca\/log\/wp-json\/wp\/v2\/posts\/673\/revisions\/678"}],"wp:attachment":[{"href":"https:\/\/wcarss.ca\/log\/wp-json\/wp\/v2\/media?parent=673"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wcarss.ca\/log\/wp-json\/wp\/v2\/categories?post=673"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wcarss.ca\/log\/wp-json\/wp\/v2\/tags?post=673"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}