<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Algorithms on Unnamed Website</title><link>https://unnamed.website/tags/algorithms/</link><description>Recent content in Algorithms on Unnamed Website</description><generator>Hugo</generator><language>en-us</language><managingEditor>Anthony Wang</managingEditor><webMaster>Anthony Wang</webMaster><lastBuildDate>Thu, 10 Apr 2025 14:13:20 -0400</lastBuildDate><atom:link href="https://unnamed.website/tags/algorithms/index.xml" rel="self" type="application/rss+xml"/><item><title>Proving That Fenwick Trees are Fast</title><link>https://unnamed.website/posts/proving-fenwick-trees-fast/</link><pubDate>Thu, 10 Apr 2025 14:13:20 -0400</pubDate><author>Anthony Wang</author><guid>https://unnamed.website/posts/proving-fenwick-trees-fast/</guid><description>&lt;p&gt;Fenwick trees are really fast (although you can speed them up 10x using &lt;a href="https://en.algorithmica.org/hpc/data-structures/segment-trees/#wide-segment-trees"&gt;cache and SIMD tricks&lt;/a&gt;). But can we prove this using Dafny?&lt;/p&gt;
&lt;style&gt;
.chardiv {
	float: left;
	width: 100px;
}
.charimg {
	height: 60px;
}
blockquote {
	min-height: 60px;
}
&lt;/style&gt;
&lt;div class="chardiv"&gt;
	&lt;img src="https://unnamed.website/img/char/kublai.png" class="charimg"&gt;
&lt;/div&gt;
&lt;blockquote&gt;&lt;strong&gt;Kublai&lt;/strong&gt;:
Oh nooooo not Dafny again!&lt;/blockquote&gt;

&lt;p&gt;Don&amp;rsquo;t worry, we&amp;rsquo;ll only write a few lines of Dafny code this time. Still, you should read my previous &lt;a href="https://unnamed.website/tags/fenwick-trees/"&gt;Fenwick tree posts&lt;/a&gt; since otherwise this post probably won&amp;rsquo;t make much sense.&lt;/p&gt;</description></item><item><title>Formally Verifying Fenwick Trees</title><link>https://unnamed.website/posts/formally-verifying-fenwick-trees/</link><pubDate>Sat, 15 Mar 2025 21:30:06 -0400</pubDate><author>Anthony Wang</author><guid>https://unnamed.website/posts/formally-verifying-fenwick-trees/</guid><description>&lt;style&gt;
.chardiv {
	float: left;
	width: 100px;
}
.charimg {
	height: 60px;
}
blockquote {
	min-height: 60px;
}
&lt;/style&gt;
&lt;div class="chardiv"&gt;
	&lt;img src="https://unnamed.website/img/char/kublai.png" class="charimg"&gt;
&lt;/div&gt;
&lt;blockquote&gt;&lt;strong&gt;Kublai&lt;/strong&gt;:
Hey, it&amp;rsquo;s you again! That formal verification thing you mentioned last time sucks!&lt;/blockquote&gt;

&lt;p&gt;Huh? You mean our &lt;a href="https://unnamed.website/posts/i-can-prove-it-can-sort/"&gt;proof of the ICan&amp;rsquo;tBelieveItCanSort algorithm&lt;/a&gt;?&lt;/p&gt;
&lt;style&gt;
.chardiv {
	float: left;
	width: 100px;
}
.charimg {
	height: 60px;
}
blockquote {
	min-height: 60px;
}
&lt;/style&gt;
&lt;div class="chardiv"&gt;
	&lt;img src="https://unnamed.website/img/char/kublai.png" class="charimg"&gt;
&lt;/div&gt;
&lt;blockquote&gt;&lt;strong&gt;Kublai&lt;/strong&gt;:
Yeah! ICan&amp;rsquo;tBelieveItCanSort? More like ICanBelieveItObviouslyCanSort! After watching that visualization a few times, it intuitively makes so much sense. It&amp;rsquo;s trivial.&lt;/blockquote&gt;

&lt;p&gt;Trivial? I&amp;rsquo;m banning that word. If you consider something to be trivial, you probably haven&amp;rsquo;t pondered it deeply enough.&lt;/p&gt;</description></item><item><title>ICanProveItCanSort!</title><link>https://unnamed.website/posts/i-can-prove-it-can-sort/</link><pubDate>Sun, 23 Feb 2025 19:46:46 -0500</pubDate><author>Anthony Wang</author><guid>https://unnamed.website/posts/i-can-prove-it-can-sort/</guid><description>&lt;p&gt;I previously blogged about the &lt;a href="https://unnamed.website/posts/i-cant-believe-it-can-sort/"&gt;ICan&amp;rsquo;tBelieveItCanSort algorithm&lt;/a&gt;, which is a weird insertion sort-like algorithm that defies all common sense and somehow sorts arrays. Well, if you read that post and watch the visualization a few times, it should make more intuitive sense why it works.&lt;/p&gt;
&lt;style&gt;
.chardiv {
	float: left;
	width: 100px;
}
.charimg {
	height: 60px;
}
blockquote {
	min-height: 60px;
}
&lt;/style&gt;
&lt;div class="chardiv"&gt;
	&lt;img src="https://unnamed.website/img/char/kublai.png" class="charimg"&gt;
&lt;/div&gt;
&lt;blockquote&gt;&lt;strong&gt;Kublai&lt;/strong&gt;:
Hey, I don&amp;rsquo;t believe you! Your visualization looks pretty cool, but how can you be sure this wacky algorithm works for &lt;em&gt;all&lt;/em&gt; inputs?&lt;/blockquote&gt;

&lt;p&gt;Glad you asked! To dispel all doubt, here&amp;rsquo;s a formal proof.&lt;/p&gt;</description></item><item><title>Fenwick Trees are Awesome!</title><link>https://unnamed.website/posts/fenwick-trees-awesome/</link><pubDate>Tue, 14 Jan 2025 20:53:04 -0500</pubDate><author>Anthony Wang</author><guid>https://unnamed.website/posts/fenwick-trees-awesome/</guid><description>&lt;link rel="stylesheet" href="https://unnamed.website/katex/katex.min.css" crossorigin="anonymous"&gt;
&lt;script defer src="https://unnamed.website/katex/katex.min.js" crossorigin="anonymous"&gt;&lt;/script&gt;
&lt;script defer src="https://unnamed.website/katex/contrib/auto-render.min.js" crossorigin="anonymous" onload="renderMathInElement(document.body, {delimiters: [{left: '$', right: '$', display: false}, {left: '\\(', right: '\\)', display: false}, {left: '\\[', right: '\\]', display: true}, {left: '\\begin{equation}', right: '\\end{equation}', display: true}, {left: '\\begin{equation*}', right: '\\end{equation*}', display: true}, {left: '\\begin{align}', right: '\\end{align}', display: true}, {left: '\\begin{align*}', right: '\\end{align*}', display: true}]});"&gt;&lt;/script&gt;

&lt;p&gt;&lt;em&gt;This post will only use one-based indexing since that&amp;rsquo;s what Fenwick trees traditionally use, although they can also be modified to use zero-based indexing.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;So imagine you have an array $A$ of size $N$, and you&amp;rsquo;d like to support two operations. The first one, called $Update(i, v)$, is trivial: Given an index $i$, add $v$ to $A_i$. Easy peasy!&lt;/p&gt;</description></item><item><title>Solving Shortest Paths With Transformers</title><link>https://unnamed.website/posts/solving-shortest-paths-with-transformers/</link><pubDate>Wed, 11 Dec 2024 11:29:07 -0500</pubDate><author>Anthony Wang</author><guid>https://unnamed.website/posts/solving-shortest-paths-with-transformers/</guid><description>&lt;p&gt;&lt;link rel="stylesheet" href="https://unnamed.website/katex/katex.min.css" crossorigin="anonymous"&gt;
&lt;script defer src="https://unnamed.website/katex/katex.min.js" crossorigin="anonymous"&gt;&lt;/script&gt;
&lt;script defer src="https://unnamed.website/katex/contrib/auto-render.min.js" crossorigin="anonymous" onload="renderMathInElement(document.body, {delimiters: [{left: '$', right: '$', display: false}, {left: '\\(', right: '\\)', display: false}, {left: '\\[', right: '\\]', display: true}, {left: '\\begin{equation}', right: '\\end{equation}', display: true}, {left: '\\begin{equation*}', right: '\\end{equation*}', display: true}, {left: '\\begin{align}', right: '\\end{align}', display: true}, {left: '\\begin{align*}', right: '\\end{align*}', display: true}]});"&gt;&lt;/script&gt;

&lt;style&gt;
 
 
.mpld3-staticpaths:has(:nth-child(10)) {
 transform: rotate(180deg) translate(-520px,-423px);
}
.mpld3-figure {
 display: block;
 margin: auto;
}
&lt;/style&gt;
&lt;/p&gt;
&lt;h2 id="introduction"&gt;Introduction&lt;/h2&gt;
&lt;h3 id="motivation"&gt;Motivation&lt;/h3&gt;
&lt;p&gt;Neural networks are capable of impressive feats of off-distribution generalization. For instance, we discussed in class a program trained to convert sketches of cats into realistic looking pictures of cats that was able to draw a cat with three eyes given a sketch with three eyes, even though there were no 3-eyed cats in the training data. However, neural networks also often learn non-robust features that cause them to perform poorly off-distribution (e.g., adversarial examples for an image classifier). In this project, we will investigate the question of when transformers generalize off-distribution via a case study on a simple synthetic task. More specifically, the goal of our project is to make progress towards answering the following question:&lt;/p&gt;</description></item><item><title>ICan'tBelieveItCanSort!</title><link>https://unnamed.website/posts/i-cant-believe-it-can-sort/</link><pubDate>Mon, 04 Nov 2024 12:20:49 -0500</pubDate><author>Anthony Wang</author><guid>https://unnamed.website/posts/i-cant-believe-it-can-sort/</guid><description>&lt;p&gt;I recently learned a new sorting algorithm called the ICan&amp;rsquo;tBelieveItCanSort algorithm:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-cpp" data-lang="cpp"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;for&lt;/span&gt; (&lt;span style="color:#66d9ef"&gt;int&lt;/span&gt; i &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;; i &lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt; n; i&lt;span style="color:#f92672"&gt;++&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;for&lt;/span&gt; (&lt;span style="color:#66d9ef"&gt;int&lt;/span&gt; j &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;; j &lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt; n; j&lt;span style="color:#f92672"&gt;++&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;if&lt;/span&gt; (A[i] &lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt; A[j])
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; swap(A[i], A[j]);
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Wait what? The more I think about this, the more I think it shouldn&amp;rsquo;t work. This sorts in increasing order?&lt;/p&gt;
&lt;p&gt;But it does actually work, and I think watching a visualization is the best way to convince yourself.&lt;/p&gt;
&lt;button onclick="run()"&gt;Run visualization&lt;/button&gt;
&lt;pre id="visualization"&gt;
&lt;/pre&gt;
&lt;script&gt;
let running = false

function render(n, A, i, j) {
	let line1 = Array(n).fill(" ")
	if (i == j) {
		line1[i] = "ĳ"
	}
	else {
		line1[j] = "j"
		line1[i] = "i"
	}
	document.getElementById("visualization").innerHTML = line1.join(" ") + "\n" + A.join(" ")
}

async function run() {
	if (running) return
	running = true

	let n = 10
	let A = Array(n).fill().map(() =&gt; Math.floor(Math.random() * 10))
	for (let i = 0; i &lt; n; i++) {
		for (let j = 0; j &lt; n; j++) {
			render(n, A, i, j)
			await new Promise(resolve =&gt; setTimeout(resolve, 500))
			if (A[i] &lt; A[j]) {
				let tmp = A[i]
				A[i] = A[j]
				A[j] = tmp
				render(n, A, i, j)
				await new Promise(resolve =&gt; setTimeout(resolve, 500))
			}
		}
	}

	running = false
}
&lt;/script&gt;

&lt;p&gt;I still can&amp;rsquo;t believe it can sort! But this algorithm does have a certain aesthetic elegance so I definitely encourage you to use it in all your programs to troll the next person who reads your code!&lt;/p&gt;</description></item><item><title>"Bad Apple!!" But It's An Animated QR Code of "Bad Apple!!"</title><link>https://unnamed.website/posts/bad-apple-animated-qr-code/</link><pubDate>Wed, 15 May 2024 00:14:48 -0400</pubDate><author>Anthony Wang</author><guid>https://unnamed.website/posts/bad-apple-animated-qr-code/</guid><description>&lt;p&gt;Rejected intro for our final report:&lt;/p&gt;
&lt;p&gt;Imagine a scenario where Kevin and Anthony are on an airplane, and Kevin would like to share a PDF of the 6.8301 textbook on his phone with Anthony. But in an unfortunate twist of fate, Kevin has an iPhone and cannot AirDrop the file to Anthony&amp;rsquo;s Android phone, and neither person wants to pay for airplane Wi-Fi. Other data transfer methods like Ethernet or USB drives require additional hardware and for both devices to have the necessary ports. This scenario is not unique, and there are other cases where existing data transfer methods fail, such as in remote locations or during power outages.&lt;/p&gt;</description></item><item><title>Fast Multipole Methods</title><link>https://unnamed.website/posts/fast-multipole-methods/</link><pubDate>Wed, 08 May 2024 11:52:04 -0400</pubDate><author>Anthony Wang</author><guid>https://unnamed.website/posts/fast-multipole-methods/</guid><description>&lt;p&gt;Help I&amp;rsquo;m trapped in a final projects factory!&lt;/p&gt;
&lt;p&gt;Fortunately this semester I have no final exams, just five freaking final projects. One of them was due last week and already graded, so I&amp;rsquo;m publishing it on this website &lt;a href="https://unnamed.website/src/18.335-project.jl"&gt;here&lt;/a&gt;. It&amp;rsquo;s a Pluto notebook and has some flashy visualizations, but it&amp;rsquo;s honestly pretty light on substance, although it did get a grade of 100%. I probably wasted too much time playing with trying to find stable 3-body configurations. You can either download the notebook and run it in Pluto.jl, or copy the link and run it on &lt;a href="https://binder.plutojl.org/"&gt;Binder&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>854 Rap</title><link>https://unnamed.website/posts/854-rap/</link><pubDate>Wed, 24 Jan 2024 21:46:18 -0500</pubDate><author>Anthony Wang</author><guid>https://unnamed.website/posts/854-rap/</guid><description>&lt;p&gt;In November 30, 2022, ChatGPT was released. Actually, this has nothing to do with the topic of today&amp;rsquo;s post. For that, we need to go back three weeks.&lt;/p&gt;
&lt;p&gt;6.854, now known as 6.5210, is MIT&amp;rsquo;s Advanced Algorithms class taught by Professor David Karger, known for being a great but tough class. Back in November 2022, some friends and I were taking the class, and fortunately, none of the assignments involve writing a rap about algorithms, but we decided to write one anyways for fun and perform it in-class. (We also orchestrated a live performance of a splay tree with humans representing the nodes, but it ended up being too hectic.)&lt;/p&gt;</description></item><item><title>Dead Pixels</title><link>https://unnamed.website/posts/dead-pixels/</link><pubDate>Tue, 19 Dec 2023 21:15:01 +0000</pubDate><author>Anthony Wang</author><guid>https://unnamed.website/posts/dead-pixels/</guid><description>&lt;h2 id="the-problem"&gt;The problem&lt;/h2&gt;
&lt;p&gt;Billiam Wender just bought a new BenQ gaming monitor! His monitor is an N by M rectangle of pixels. Each pixel currently has a brightness level between 0 and 255 inclusive.&lt;/p&gt;
&lt;p&gt;However, Billiam suspects that his gaming monitor is defective and contains &lt;a href="https://en.wikipedia.org/wiki/Dead_pixel"&gt;dead pixels&lt;/a&gt;! Oh no! He would like to find which subrectangle (a smaller rectangle contained inside the entire rectangle) of the monitor&amp;rsquo;s grid of pixels has the lowest average brightness level, because that&amp;rsquo;s probably where the dead pixels are located. Help Billiam find the dead pixels! Output a single integer, the smallest average brightness of any subrectangle of the monitor&amp;rsquo;s rectangular grid of pixels.&lt;/p&gt;</description></item><item><title>Spelling Reform is Hard, NP-Hard</title><link>https://unnamed.website/posts/spelling-reform-np-hard/</link><pubDate>Tue, 07 Nov 2023 15:54:08 +0000</pubDate><author>Anthony Wang</author><guid>https://unnamed.website/posts/spelling-reform-np-hard/</guid><description>&lt;p&gt;Spelling sucks. &amp;ldquo;Though&amp;rdquo; rhymes with &amp;ldquo;go&amp;rdquo;. &amp;ldquo;Thought&amp;rdquo; rhymes with &amp;ldquo;got&amp;rdquo;. &amp;ldquo;Through&amp;rdquo; rhymes with&amp;hellip; &amp;ldquo;true&amp;rdquo;, &amp;ldquo;grew&amp;rdquo;, &amp;ldquo;who&amp;rdquo;, &amp;ldquo;lieu&amp;rdquo;, &amp;ldquo;you&amp;rdquo;, &amp;ldquo;flu&amp;rdquo;, &amp;ldquo;moo&amp;rdquo;, &amp;ldquo;shoe&amp;rdquo;, &amp;ldquo;coup&amp;rdquo;, &amp;ldquo;queue&amp;rdquo;, and &amp;ldquo;view&amp;rdquo;. Enough examples, let&amp;rsquo;s fix this madness!&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s a hypothetical procedure to reform English spelling: for every word, it has some IPA pronunciation. For instance, &amp;ldquo;through&amp;rdquo; is pronounced &amp;ldquo;θɹu&amp;rdquo;. Now let&amp;rsquo;s replace every letter in the IPA pronunciations with strings of one or more letters, such as mapping all occurrences of &amp;ldquo;θ&amp;rdquo; to &amp;ldquo;th&amp;rdquo;, &amp;ldquo;ɹ&amp;rdquo; to &amp;ldquo;r&amp;rdquo; and &amp;ldquo;u&amp;rdquo; to &amp;ldquo;oo&amp;rdquo;. Of course, we don&amp;rsquo;t want the new phonetics-based spellings to get too crazy, so we should minimize the total number of changes between the old and new spellings. Let&amp;rsquo;s define the &amp;ldquo;amount of change&amp;rdquo; between two spellings as the minimum number of insertions, deletions, and single-character replacements, which is technically called the &lt;strong&gt;Levenshtein edit distance&lt;/strong&gt;. In our little example, the edit distance between &amp;ldquo;through&amp;rdquo; and &amp;ldquo;throo&amp;rdquo; is 3, because we have to replace the &amp;ldquo;u&amp;rdquo; with an &amp;ldquo;o&amp;rdquo; and delete the last two characters. Lastly, we should make this sum of edit distances weighted by the frequency of each word in typical English, since people care a lot more if the spelling of &amp;ldquo;through&amp;rdquo; changes versus the spelling of &amp;ldquo;queue&amp;rdquo;.&lt;/p&gt;</description></item><item><title>Beating the Time Limit</title><link>https://unnamed.website/posts/beating-time-limit/</link><pubDate>Wed, 25 Jan 2023 01:30:50 +0000</pubDate><author>Anthony Wang</author><guid>https://unnamed.website/posts/beating-time-limit/</guid><description>&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-cpp" data-lang="cpp"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;#pragma GCC optimize(&amp;#34;O3,unroll-loops&amp;#34;)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;#pragma GCC target(&amp;#34;avx2,bmi,bmi2,lzcnt,popcnt&amp;#34;)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;#include&lt;/span&gt; &lt;span style="color:#75715e"&gt;&amp;lt;bits/stdc++.h&amp;gt;&lt;/span&gt;&lt;span style="color:#75715e"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;using&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;namespace&lt;/span&gt; std;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;int&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;main&lt;/span&gt;() {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	&lt;span style="color:#66d9ef"&gt;int&lt;/span&gt; N &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;1e5&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	&lt;span style="color:#66d9ef"&gt;long&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;long&lt;/span&gt; sum &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	&lt;span style="color:#66d9ef"&gt;for&lt;/span&gt; (&lt;span style="color:#66d9ef"&gt;int&lt;/span&gt; i &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;; i &lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt; N; &lt;span style="color:#f92672"&gt;++&lt;/span&gt;i) {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;		&lt;span style="color:#66d9ef"&gt;for&lt;/span&gt; (&lt;span style="color:#66d9ef"&gt;int&lt;/span&gt; j &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;; j &lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt; N; &lt;span style="color:#f92672"&gt;++&lt;/span&gt;j) {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;			sum &lt;span style="color:#f92672"&gt;+=&lt;/span&gt; i&lt;span style="color:#f92672"&gt;^&lt;/span&gt;j;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;		}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;	cout &lt;span style="color:#f92672"&gt;&amp;lt;&amp;lt;&lt;/span&gt; sum;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Hey you! We have here an O(N^2) algorithm with N = 10^5, doing a ridiculous number of operations. How long do you think it takes for this code to run on my laptop?&lt;/p&gt;</description></item><item><title>Installing Every Arch Package</title><link>https://unnamed.website/posts/installing-every-arch-package/</link><pubDate>Wed, 26 Jan 2022 21:52:58 -0600</pubDate><author>Anthony Wang</author><guid>https://unnamed.website/posts/installing-every-arch-package/</guid><description>&lt;p&gt;&lt;img src="https://unnamed.website/img/install-every-arch-package-matrix.png" alt="A stupid idea on Matrix"&gt;&lt;/p&gt;
&lt;p&gt;Challenge accepted. Let&amp;rsquo;s do it!&lt;/p&gt;
&lt;p&gt;First things first, let&amp;rsquo;s generate a list of &lt;a href="https://archlinux.org/packages/"&gt;all official Arch Linux packages&lt;/a&gt;. Fortunately, &lt;code&gt;pacman&lt;/code&gt;, the best pragmatic package manager in existence, makes this a breeze.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-sh" data-lang="sh"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;pacman -Sql
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Great, now let&amp;rsquo;s install it all!&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-sh" data-lang="sh"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo pacman -S &lt;span style="color:#66d9ef"&gt;$(&lt;/span&gt;pacman -Sql&lt;span style="color:#66d9ef"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;10 seconds later, you&amp;rsquo;ll find yourself with&amp;hellip; unresolvable package conflicts detected?&lt;/p&gt;
&lt;p&gt;OK, fine, let&amp;rsquo;s disable dependency checking then:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-sh" data-lang="sh"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo pacman -Sdd &lt;span style="color:#66d9ef"&gt;$(&lt;/span&gt;pacman -Sql&lt;span style="color:#66d9ef"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Nope, didn&amp;rsquo;t work. We have to do something about the conflicting packages!&lt;/p&gt;</description></item></channel></rss>