<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Data Structures &#8211; Inga X</title>
	<atom:link href="https://ingax.com/tag/data-structures/feed/" rel="self" type="application/rss+xml" />
	<link>https://ingax.com</link>
	<description>An education platform for people passionate about software engineering to learn problem solving techniques and useful algorithms and data structures</description>
	<lastBuildDate>Sat, 12 Nov 2022 17:40:57 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.5.18</generator>
	<item>
		<title>Binary Tree Traversal</title>
		<link>https://ingax.com/binary-tree-traversal/</link>
					<comments>https://ingax.com/binary-tree-traversal/#respond</comments>
		
		<dc:creator><![CDATA[David Inga]]></dc:creator>
		<pubDate>Mon, 14 Feb 2022 22:45:05 +0000</pubDate>
				<category><![CDATA[Algorithms]]></category>
		<category><![CDATA[BST Traversal]]></category>
		<category><![CDATA[Data Structures]]></category>
		<category><![CDATA[GIP]]></category>
		<category><![CDATA[Swift]]></category>
		<guid isPermaLink="false">https://ingax.com/?p=6498</guid>

					<description><![CDATA[How to Recall Tree Traversal Orders Let L denote the left child. Let R denote the right child. Let P denote the parent and position....]]></description>
										<content:encoded><![CDATA[
<h3>How to Recall Tree Traversal Orders</h3>



<p>Let <strong>L</strong> denote the left child.</p>



<p>Let <strong>R</strong> denote the right child.</p>



<p>Let <strong>P</strong> denote the parent and position.</p>



<p>To easily remember tree traversal orders, pay attention to the position of <strong>P</strong> in the following strings.</p>



<p>When <strong>P</strong> is in the center, it is <strong>In Order</strong>. When it is first, it is <strong>Pre Order</strong>. And when it is last, it is <strong>Post Order</strong>.</p>



<p>L &#8211; <span style="text-decoration: underline;">P</span> &#8211; R |    <strong>In Order</strong></p>



<p><span style="text-decoration: underline;">P</span> &#8211; L &#8211; R |    <strong>Pre Order</strong></p>



<p>L &#8211; R &#8211; <span style="text-decoration: underline;">P</span> |    <strong>Post Order</strong></p>



<p>Note that L and R are always in the same order. The only element changing order is the parent.</p>



<h3>In Order</h3>



<pre class="wp-block-prismatic-blocks"><code class="language-swift">leftChild -> parent -> rightChild</code></pre>



<p>Integer values come out in order when traversing a Binary Search Tree.</p>



<h3>Pre Order</h3>



<pre class="wp-block-prismatic-blocks"><code class="language-swift">parent -> leftChild -> rightChild</code></pre>



<p>Traverse parent first (pre).</p>



<h3>Post Order</h3>



<pre class="wp-block-prismatic-blocks"><code class="language-swift">leftChild -> rightChild -> parent</code></pre>



<p>Traverse parent last (post).</p>



<h3>Code</h3>



<pre class="wp-block-prismatic-blocks"><code class="language-swift">class BST {
    var value: Int?
    var left: BST?
    var right: BST?
    
    init(value: Int) {
        self.value = value
        left = nil
        right = nil
    }
}

// O(n) time | O(n) space, because we're storing all values in array
// Note: If were were just printing values, space will be O(h), where
// h is the height of the tree.

func inOrderTraversal(tree: BST?, array: inout [Int]) -> [Int] {
    guard let node = tree, let value = node.value else { return array }
    
    inOrderTraversal(tree: node.left, array: &array)
    array.append(value)
    inOrderTraversal(tree: node.right, array: &array)
    
    return array
}

func preOrderTraversal(tree: BST?, array: inout [Int]) -> [Int] {
    guard let node = tree, let value = node.value else { return array }
    
    array.append(value)
    preOrderTraversal(tree: node.left, array: &array)
    preOrderTraversal(tree: node.right, array: &array)
    
    return array
}

func postOrderTraversal(tree: BST?, array: inout [Int]) -> [Int] {
    guard let node = tree, let value = node.value else { return array }
    
    postOrderTraversal(tree: node.left, array: &array)
    postOrderTraversal(tree: node.right, array: &array)
    array.append(value)
    
    return array
}</code></pre>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://ingax.com/binary-tree-traversal/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Simple Hash Table in Swift</title>
		<link>https://ingax.com/simple-hash-table-in-swift/</link>
					<comments>https://ingax.com/simple-hash-table-in-swift/#respond</comments>
		
		<dc:creator><![CDATA[David Inga]]></dc:creator>
		<pubDate>Mon, 26 Aug 2019 22:04:07 +0000</pubDate>
				<category><![CDATA[Data Structures]]></category>
		<category><![CDATA[GIP]]></category>
		<category><![CDATA[Swift]]></category>
		<guid isPermaLink="false">https://ingax.com/?p=6667</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[<p><script src="https://gist.github.com/davidinga/c27385cfd717f9b53082c5d252cc1277.js"></script></p>
]]></content:encoded>
					
					<wfw:commentRss>https://ingax.com/simple-hash-table-in-swift/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Graph with Adjacency List</title>
		<link>https://ingax.com/graph-with-adjacency-list/</link>
					<comments>https://ingax.com/graph-with-adjacency-list/#respond</comments>
		
		<dc:creator><![CDATA[David Inga]]></dc:creator>
		<pubDate>Mon, 26 Aug 2019 06:50:25 +0000</pubDate>
				<category><![CDATA[Data Structures]]></category>
		<category><![CDATA[GIP]]></category>
		<category><![CDATA[Swift]]></category>
		<guid isPermaLink="false">https://ingax.com/?p=6640</guid>

					<description><![CDATA[Quick Facts Array of Linked Lists Array size equal to number of vertices. Each index in array corresponds to linked list with vertices connecting to...]]></description>
										<content:encoded><![CDATA[
<h3>Quick Facts</h3>



<ul><li>Array of Linked Lists</li><li>Array size equal to number of vertices.</li><li>Each index in array corresponds to linked list with vertices connecting to the vertex at this index.</li></ul>



<p>Pros:</p>



<ul><li>Saves space \(O( |V| + |E| )\), worst case \(O( V^2 )\)</li><li>Adding a vertex is easier.</li></ul>



<p>Cons:</p>



<ul><li>Checking whether an edge exists between two vertices takes \(O( V )\) time.</li></ul>


<p><script src="https://gist.github.com/davidinga/212c3b8c2244e7ae1c4ba2e0ecb49fc3.js"></script></p>


<h3>References</h3>



<ul><li><a rel="noreferrer noopener" aria-label="https://www.geeksforgeeks.org/graph-and-its-representations/ (opens in a new tab)" href="https://www.geeksforgeeks.org/graph-and-its-representations/" target="_blank">https://www.geeksforgeeks.org/graph-and-its-representations/</a></li><li><a rel="noreferrer noopener" aria-label="https://www.programiz.com/dsa/graph-adjacency-list (opens in a new tab)" href="https://www.programiz.com/dsa/graph-adjacency-list" target="_blank">https://www.programiz.com/dsa/graph-adjacency-list</a></li><li><a href="https://en.wikipedia.org/wiki/Adjacency_list" target="_blank" rel="noreferrer noopener" aria-label="https://en.wikipedia.org/wiki/Adjacency_list (opens in a new tab)">https://en.wikipedia.org/wiki/Adjacency_list</a></li></ul>
]]></content:encoded>
					
					<wfw:commentRss>https://ingax.com/graph-with-adjacency-list/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Graph with Adjacency Matrix</title>
		<link>https://ingax.com/graph-with-adjacency-matrix/</link>
					<comments>https://ingax.com/graph-with-adjacency-matrix/#respond</comments>
		
		<dc:creator><![CDATA[David Inga]]></dc:creator>
		<pubDate>Sun, 25 Aug 2019 22:02:08 +0000</pubDate>
				<category><![CDATA[Data Structures]]></category>
		<category><![CDATA[GIP]]></category>
		<category><![CDATA[Swift]]></category>
		<guid isPermaLink="false">https://ingax.com/?p=6637</guid>

					<description><![CDATA[Quick Facts Represents graph with &#8220;V&#8221; nodes into a \(V x V\) binary matrix. A 1 means the two vertices are connected; and a 0...]]></description>
										<content:encoded><![CDATA[
<h3>Quick Facts</h3>



<ul><li>Represents graph with &#8220;V&#8221; nodes into a \(V x V\) binary matrix.</li><li>A 1 means the two vertices are connected; and a 0 means they are not connected.</li></ul>



<p>Pros:</p>



<ul><li>Easy to implement.</li><li>Adding and removing an edge, and checking whether there is an edge from one vertex to another is very efficient. Time complexity is \(O(1)\).</li><li>Good choice of implementation if the graph is dense and there are a large number of edges.</li><li>By performing operations on the adjacency matrix, we can get important insights into the nature of the graph and the relationship between its vertices. </li></ul>



<p>Cons:</p>



<ul><li>Takes up \(O(V^2)\) space. For large graphs, too much memory is consumed. Most real world applications for graphs do not have many connections. Therefore, in these situations, too much space is wasted.</li><li>Adding vertex takes \(O( V^2 )\) time.</li></ul>


<p><script src="https://gist.github.com/davidinga/5c02eb8dfbfbdf201677903de518eb4b.js"></script></p>


<h3>References</h3>



<ul><li><a rel="noreferrer noopener" aria-label="https://www.geeksforgeeks.org/graph-and-its-representations/ (opens in a new tab)" href="https://www.geeksforgeeks.org/graph-and-its-representations/" target="_blank">https://www.geeksforgeeks.org/graph-and-its-representations/</a></li><li><a rel="noreferrer noopener" aria-label="https://github.com/raywenderlich/swift-algorithm-club/blob/master/Graph/Graph/AdjacencyMatrixGraph.swift (opens in a new tab)" href="https://github.com/raywenderlich/swift-algorithm-club/blob/master/Graph/Graph/AdjacencyMatrixGraph.swift" target="_blank">https://github.com/raywenderlich/swift-algorithm-club/blob/master/Graph/Graph/AdjacencyMatrixGraph.swift</a></li><li><a href="https://www.programiz.com/dsa/graph-adjacency-matrix">https://www.programiz.com/dsa/graph-adjacency-matrix</a></li><li><a href="https://en.wikipedia.org/wiki/Adjacency_matrix" target="_blank" rel="noreferrer noopener" aria-label="https://en.wikipedia.org/wiki/Adjacency_matrix (opens in a new tab)">https://en.wikipedia.org/wiki/Adjacency_matrix</a></li></ul>
]]></content:encoded>
					
					<wfw:commentRss>https://ingax.com/graph-with-adjacency-matrix/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Graph with Objects and Pointers</title>
		<link>https://ingax.com/graph-with-objects-and-pointers/</link>
					<comments>https://ingax.com/graph-with-objects-and-pointers/#respond</comments>
		
		<dc:creator><![CDATA[David Inga]]></dc:creator>
		<pubDate>Sun, 25 Aug 2019 03:10:04 +0000</pubDate>
				<category><![CDATA[Data Structures]]></category>
		<category><![CDATA[GIP]]></category>
		<category><![CDATA[Swift]]></category>
		<guid isPermaLink="false">https://ingax.com/?p=6631</guid>

					<description><![CDATA[Quick Facts Pros: Time complexity of edge and vertex insertion \(O(1)\). Consumes \(O(E + V)\) space. Searching for edge or vertex takes \(O(1)\) time. Dynamic...]]></description>
										<content:encoded><![CDATA[
<h3>Quick Facts</h3>



<p>Pros:</p>



<ul><li>Time complexity of edge and vertex insertion \(O(1)\).</li><li>Consumes \(O(E + V)\) space.</li><li>Searching for edge or vertex takes \(O(1)\) time.</li><li>Dynamic size.</li></ul>



<p>Cons:</p>



<ul><li>Deletion of vertices takes \(O(E)\) in the worst case, when an edge has a vertex to every edge.</li><li>Objects not stored in continuous space in memory. Not cache friendly.</li></ul>


<p><script src="https://gist.github.com/davidinga/56ead53a4a5045cdbad56945a8de30b4.js"></script></p>


<h3>References</h3>



<ul><li><a rel="noreferrer noopener" aria-label=" (opens in a new tab)" href="https://www.geeksforgeeks.org/graph-and-its-representations/" target="_blank">https://www.geeksforgeeks.org/graph-and-its-representations/</a></li><li><a rel="noreferrer noopener" aria-label="https://www.raywenderlich.com/773-swift-algorithm-club-graphs-with-adjacency-list (opens in a new tab)" href="https://www.raywenderlich.com/773-swift-algorithm-club-graphs-with-adjacency-list" target="_blank">https://www.raywenderlich.com/773-swift-algorithm-club-graphs-with-adjacency-list</a></li><li><a href="https://en.wikipedia.org/wiki/Graph_(abstract_data_type)" target="_blank" rel="noreferrer noopener" aria-label="https://en.wikipedia.org/wiki/Graph_(abstract_data_type) (opens in a new tab)">https://en.wikipedia.org/wiki/Graph_(abstract_data_type)</a></li></ul>
]]></content:encoded>
					
					<wfw:commentRss>https://ingax.com/graph-with-objects-and-pointers/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Graphs</title>
		<link>https://ingax.com/graphs/</link>
					<comments>https://ingax.com/graphs/#respond</comments>
		
		<dc:creator><![CDATA[David Inga]]></dc:creator>
		<pubDate>Thu, 20 Jun 2019 03:24:54 +0000</pubDate>
				<category><![CDATA[Data Structures]]></category>
		<category><![CDATA[GIP]]></category>
		<category><![CDATA[Swift]]></category>
		<guid isPermaLink="false">https://ingax.com/?p=6563</guid>

					<description><![CDATA[Quick Facts Constructed from edges (nodes) and vertices that connect them. Graph types include: Directed or Undirected Weighted or Unweighted Connected or Disconnected Represented in...]]></description>
										<content:encoded><![CDATA[
<h3>Quick Facts</h3>



<ul><li>Constructed from edges (nodes) and vertices that connect them.</li><li>Graph types include:<ul><li>Directed or Undirected</li><li>Weighted or Unweighted</li><li>Connected or Disconnected</li></ul></li><li>Represented in code as:<ul><li>Adjacency List</li><li>Adjacency Matrix</li><li>Objects and Pointers</li></ul></li><li>A tree is a graph, but a graph isn&#8217;t always a tree.</li></ul>



<h4>Graph Traversal</h4>



<ul><li>Depth First Search (DFS)</li><li>Breadth First Search (BFS)</li></ul>



<h4>Shortest Path</h4>



<ul><li>Dijkstra</li><li>A*</li></ul>



<h3>Graph Representation</h3>



<ul><li><a href="https://ingax.com/graph-with-adjacency-list/">Adjacency List</a></li><li><a href="https://ingax.com/graph-with-adjacency-matrix/">Adjacency Matrix</a></li><li><a href="https://ingax.com/graph-with-objects-and-pointers/">Objects and Pointers</a></li></ul>
]]></content:encoded>
					
					<wfw:commentRss>https://ingax.com/graphs/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Heaps</title>
		<link>https://ingax.com/heaps/</link>
					<comments>https://ingax.com/heaps/#respond</comments>
		
		<dc:creator><![CDATA[David Inga]]></dc:creator>
		<pubDate>Mon, 10 Jun 2019 05:57:40 +0000</pubDate>
				<category><![CDATA[Data Structures]]></category>
		<category><![CDATA[GIP]]></category>
		<category><![CDATA[Swift]]></category>
		<guid isPermaLink="false">https://ingax.com/?p=6520</guid>

					<description><![CDATA[Quick Facts]]></description>
										<content:encoded><![CDATA[
<h3>Quick Facts</h3>


<div class="col span_6" data-animation="" data-delay="0">


<ul><li>Complete Binary Tree</li><li>Either a Min-Heap or Max-Heap</li><li>Self Balancing</li><li>Two most important operations are Insertion and the Extraction of highest priority element.</li><li>The node at the top of the Heap has the greatest priority, the same is true for every node recursively moving down the tree structure.</li><li>Moving down the tree, each level has twice as many nodes as the previous level.</li></ul>


</div><div class="col span_6 col_last" data-animation="" data-delay="0">


<ul><li>Min-Heap is synonymous with Priority Queue</li><li>HeapSort uses a Max-Heap</li><li>An Array is a great data structure for storing nodes in a Heap.</li><li>Building helper functions greatly assists in calculations of indices, swapping node positions, and more.</li></ul>


</div><div class="clear"></div>
<p><script src="https://gist.github.com/davidinga/925ea2878ae8581977fd1d55b1bcc038.js"></script></p>]]></content:encoded>
					
					<wfw:commentRss>https://ingax.com/heaps/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Binary Tree Descriptors</title>
		<link>https://ingax.com/binary-tree-descriptors/</link>
					<comments>https://ingax.com/binary-tree-descriptors/#comments</comments>
		
		<dc:creator><![CDATA[David Inga]]></dc:creator>
		<pubDate>Sun, 09 Jun 2019 06:14:57 +0000</pubDate>
				<category><![CDATA[Data Structures]]></category>
		<category><![CDATA[GIP]]></category>
		<guid isPermaLink="false">https://ingax.com/?p=6522</guid>

					<description><![CDATA[Complete Binary Tree Every level of the tree is filled, except for perhaps the last level. The last level must be filled from left to...]]></description>
										<content:encoded><![CDATA[
<h3>Complete Binary Tree</h3>



<p>Every level of the tree is filled, except for perhaps the last level. The last level must be filled from left to right.</p>



<h3>Full Binary Tree</h3>



<p>Every node has zero or both children.</p>



<h3>Perfect Binary Tree</h3>



<p>Every node has a left and right child. It is both a Complete Binary Tree and a Full Binary Tree.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://ingax.com/binary-tree-descriptors/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Binary Trees</title>
		<link>https://ingax.com/binary-trees/</link>
					<comments>https://ingax.com/binary-trees/#respond</comments>
		
		<dc:creator><![CDATA[David Inga]]></dc:creator>
		<pubDate>Thu, 06 Jun 2019 07:48:17 +0000</pubDate>
				<category><![CDATA[Data Structures]]></category>
		<category><![CDATA[GIP]]></category>
		<category><![CDATA[Swift]]></category>
		<guid isPermaLink="false">https://ingax.com/?p=6475</guid>

					<description><![CDATA[Quick Facts A tree where each parent node has at most two child nodes. The first node is called the root node. Any nodes without...]]></description>
										<content:encoded><![CDATA[
<h3>Quick Facts</h3>



<ul><li>A tree where each parent node has at most two child nodes. </li><li>The first node is called the root node. </li><li>Any nodes without child nodes are called leaf or terminal nodes. </li><li>Each node stores a pointer to a left child, right child, and data. </li><li>Sometimes nodes will also store a pointer to the parent node.</li></ul>



<h3>Binary Tree Enumeration</h3>


<p><script src="https://gist.github.com/davidinga/505409f2a5f83988377bdab32cf7fd2d.js"></script></p>


<h3>References</h3>



<ul><li><a rel="noreferrer noopener" aria-label="https://www.geeksforgeeks.org/binary-tree-data-structure/ (opens in a new tab)" href="https://www.geeksforgeeks.org/binary-tree-data-structure/" target="_blank">https://www.geeksforgeeks.org/binary-tree-data-structure/</a></li><li><a rel="noreferrer noopener" aria-label="https://en.wikipedia.org/wiki/Binary_tree (opens in a new tab)" href="https://en.wikipedia.org/wiki/Binary_tree" target="_blank">https://en.wikipedia.org/wiki/Binary_tree</a></li><li><a href="https://www.raywenderlich.com/990-swift-algorithm-club-swift-binary-search-tree-data-structure" target="_blank" rel="noreferrer noopener" aria-label="https://www.raywenderlich.com/990-swift-algorithm-club-swift-binary-search-tree-data-structure (opens in a new tab)">https://www.raywenderlich.com/990-swift-algorithm-club-swift-binary-search-tree-data-structure</a></li></ul>
]]></content:encoded>
					
					<wfw:commentRss>https://ingax.com/binary-trees/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Hash Sets</title>
		<link>https://ingax.com/hash-sets/</link>
					<comments>https://ingax.com/hash-sets/#respond</comments>
		
		<dc:creator><![CDATA[David Inga]]></dc:creator>
		<pubDate>Wed, 05 Jun 2019 23:14:39 +0000</pubDate>
				<category><![CDATA[Data Structures]]></category>
		<category><![CDATA[GIP]]></category>
		<category><![CDATA[Swift]]></category>
		<guid isPermaLink="false">https://ingax.com/?p=6325</guid>

					<description><![CDATA[A Hash Set is an unordered collection of unique elements, where elements are stored in a table using a hash function. In my implementation, elements...]]></description>
										<content:encoded><![CDATA[<p>A Hash Set is an unordered collection of unique elements, where elements are stored in a table using a hash function. In my implementation, elements are stored in an Array of Linked Lists.</p>
<div class="col span_6" data-animation="" data-delay="0"></p>
<h3>Quick Facts</h3>
<ul>
<li>An unordered collection of unique elements.</li>
<li>Elements in set must be hashable.</li>
<li>Swift&#8217;s Set implementation in Foundation is a Hash Set.</li>
</ul>
<h3>Use Cases</h3>
<ul>
<li>Test efficiency for membership.</li>
<li>When not concerned about order of elements.</li>
<li>When need to ensure elements in collection only appear once.</li>
</ul>
<p></div> <div class="col span_6 col_last" data-animation="" data-delay="0"></p>
<h3>Structure</h3>
<div class="code-toolbar">
<pre class=" language-swift"><code class=" language-swift"><span class="token keyword">var</span> <span class="token builtin">isEmpty</span><span class="token punctuation">:</span> <span class="token builtin">Bool</span></code></pre>
<div class="toolbar">
<div class="toolbar-item"><button>Copy</button></div>
</div>
</div>
<p>Returns true if the set is empty or false if it contains elements.</p>
<div class="code-toolbar">
<pre class=" language-swift"><code class=" language-swift"><span class="token keyword">var</span> <span class="token builtin">count</span><span class="token punctuation">:</span> <span class="token builtin">Int</span></code></pre>
<div class="toolbar">
<div class="toolbar-item"><button>Copy</button></div>
</div>
</div>
<p>Returns the number of elements in the set.</p>
<pre><code class="language-swift">func insert(_ element: Element) -&gt; Bool</code></pre>
<p>Inserts the element into the set the set does not already contain it. Returns true if the element was inserted and false if it was not.</p>
<pre><code class="language-swift">func remove(_ element: Element) -&gt; Element?</code></pre>
<p>Removes an element from the set. Returns the element if it is in the set.</p>
<pre><code class="language-swift">func removeAll()</code></pre>
<p>Removes all elements from the set.</p>
<pre><code class="language-swift">func contains(_ element: Element) -&gt; Element?</code></pre>
<p>Tests for membership. The element is returned if the set contains it.</p>
<pre><code class="language-swift">func union(_ hashSet: HashSet) -&gt; HashSet</code></pre>
<p>Returns a new set with the elements of both this set and the given set.</p>
<pre><code class="language-swift">func intersection(_ hashSet: HashSet) -&gt; HashSet</code></pre>
<p>Returns a new set with the elements that are common to both this set and the given set.</p>
<pre><code class="language-swift">func difference(_ hashSet: HashSet) -&gt; HashSet</code></pre>
<p>Removes the elements of the given set from this set.</p>
<p></div><div class="clear"></div> <div class="divider-wrap" data-alignment="default"><div  data-width="100%" data-animate="" data-animation-delay="" data-color="default" class="divider-border"></div></div>
<p><script src="https://gist.github.com/davidinga/6e6ed69c49fede21068d9c091b058e62.js"></script><br />
<div class="divider-wrap" data-alignment="default"><div  data-width="100%" data-animate="" data-animation-delay="" data-color="default" class="divider-border"></div></div>
<h3>References</h3>
<ol>
<li><a href="https://developer.apple.com/documentation/swift/set" target="_blank" rel="noopener noreferrer">https://developer.apple.com/documentation/swift/set</a></li>
<li><a href="https://github.com/raywenderlich/swift-algorithm-club/tree/master/Hash%20Set" target="_blank" rel="noopener noreferrer">https://github.com/raywenderlich/swift-algorithm-club/tree/master/Hash%20Set</a></li>
<li><a href="https://developer.apple.com/documentation/swift/hashable" target="_blank" rel="noopener noreferrer">https://developer.apple.com/documentation/swift/hashable</a></li>
</ol>
]]></content:encoded>
					
					<wfw:commentRss>https://ingax.com/hash-sets/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/

Object Caching 21/166 objects using disk
Page Caching using disk: enhanced 
Database Caching using disk

Served from: ingax.com @ 2026-04-27 07:13:06 by W3 Total Cache
-->