<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title/><link>https://notes.bencuan.me/cs61b/abstract-data-types/</link><description>Recent content on</description><generator>Hugo</generator><language>en</language><atom:link href="https://notes.bencuan.me/cs61b/abstract-data-types/index.xml" rel="self" type="application/rss+xml"/><item><title/><link>https://notes.bencuan.me/cs61b/abstract-data-types/graphs/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://notes.bencuan.me/cs61b/abstract-data-types/graphs/</guid><description>&lt;h2 id="introduction"&gt;
 Introduction
 &lt;a class="anchor" href="#introduction"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Graphs are simply a collection of &lt;strong&gt;vertices&lt;/strong&gt; connected by &lt;strong&gt;edges.&lt;/strong&gt; They&amp;rsquo;re very similar to trees, but are much more versatile and don&amp;rsquo;t require hierarchical relationships like trees do.&lt;/p&gt;
&lt;p&gt;


&lt;img src="https://notes.bencuan.me/cs61b/abstract-data-types/../img/assets/image%20%2855%29.png" width="auto" alt="A very simple graph." /&gt;&lt;/p&gt;
&lt;p&gt;For most purposes, we will be working with &lt;strong&gt;simple graphs&lt;/strong&gt; that follow two rules:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;There are &lt;strong&gt;no loops&lt;/strong&gt; (a connection of a node to itself).&lt;/li&gt;
&lt;li&gt;There are &lt;strong&gt;no parallel edges&lt;/strong&gt; (two edges that connect the same two vertices).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;


&lt;img src="https://notes.bencuan.me/cs61b/abstract-data-types/../img/assets/image%20%2856%29.png" width="auto" alt="Don&amp;rsquo;t make these graphs pls. Keep life simple!" /&gt;&lt;/p&gt;</description></item><item><title>Hashing and Hash Tables</title><link>https://notes.bencuan.me/cs61b/abstract-data-types/hashing/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://notes.bencuan.me/cs61b/abstract-data-types/hashing/</guid><description>&lt;h2 id="data-indexed-sets-introduction"&gt;
 Data Indexed Sets: Introduction
 &lt;a class="anchor" href="#data-indexed-sets-introduction"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;So far, we&amp;rsquo;ve explored a whole bunch of ways we can store items, but they aren&amp;rsquo;t really optimized for general searching. What if we could get searching in $\Theta(1)$ time??? Wouldn&amp;rsquo;t that be nice!&lt;/p&gt;
&lt;p&gt;See also: [[cs186/04 Sorting and Hashing]] (external hashing for databases that don&amp;rsquo;t fit in memory), [[cs70/probability/hashing-and-the-union-bound]] (the probability of collisions and the birthday problem), and [[cs161/Cryptography]] (cryptographic hash functions used for integrity).&lt;/p&gt;</description></item><item><title>Union Find (Disjoint Sets)</title><link>https://notes.bencuan.me/cs61b/abstract-data-types/union-find-disjoint-sets/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://notes.bencuan.me/cs61b/abstract-data-types/union-find-disjoint-sets/</guid><description>&lt;h1 id="union-find-disjoint-sets"&gt;
 Union Find (Disjoint Sets)
 &lt;a class="anchor" href="#union-find-disjoint-sets"&gt;#&lt;/a&gt;
&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;[!info] Content Note&lt;/p&gt;
&lt;p&gt;This is not a complete entry, because I feel like existing course materials already cover this in an extremely intuitive manner. See 
&lt;a href="https://inst.eecs.berkeley.edu/~cs61b/sp20/materials/lab/lab14/index.html" rel="noopener"&gt;lab 14&lt;/a&gt; for a guide on how to implement your own Union Find structure!&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The Union Find data structure is a way of representing a bunch of nodes that are connected to each other in subsets. It&amp;rsquo;s used in 





&lt;a href="https://notes.bencuan.me/cs61b/algorithms/minimum-spanning-trees/kruskals-algorithm/" rel="noopener"
 class="internal-link" data-src="https://notes.bencuan.me/cs61b/algorithms/minimum-spanning-trees/kruskals-algorithm/"&gt;Kruskal&amp;rsquo;s Algorithm&lt;/a&gt; among other things.&lt;/p&gt;</description></item><item><title/><link>https://notes.bencuan.me/cs61b/abstract-data-types/comparables-and-comparators/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://notes.bencuan.me/cs61b/abstract-data-types/comparables-and-comparators/</guid><description>&lt;h2 id="what-is-it"&gt;
 What is it?
 &lt;a class="anchor" href="#what-is-it"&gt;#&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;A &lt;strong&gt;Comparable&lt;/strong&gt; is a &lt;strong&gt;generic type&lt;/strong&gt; that allows standardized comparisons between objects.&lt;/p&gt;
&lt;p&gt;In other words, anything that has a &lt;code&gt;compareTo()&lt;/code&gt; method can be a Comparable!&lt;/p&gt;
&lt;p&gt;Many Java libraries already use Comparable without you knowing! Some of the more well-known ones are &lt;code&gt;Collection&lt;/code&gt; and &lt;code&gt;String&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id="compareto-cant-return-anything-you-want"&gt;
 CompareTo can&amp;rsquo;t return anything you want!
 &lt;a class="anchor" href="#compareto-cant-return-anything-you-want"&gt;#&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;There are some very specific properties CompareTo needs to have! Usually, we take them for granted but might forget about them when making our own.&lt;/p&gt;</description></item></channel></rss>