<?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>Algorithms &#8211; Inga X</title>
	<atom:link href="https://ingax.com/category/algorithms/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>Thu, 17 Nov 2022 18:19:26 +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>Tower of Hanoi Puzzle</title>
		<link>https://ingax.com/tower-of-hanoi-puzzle/</link>
					<comments>https://ingax.com/tower-of-hanoi-puzzle/#respond</comments>
		
		<dc:creator><![CDATA[David Inga]]></dc:creator>
		<pubDate>Thu, 17 Nov 2022 18:19:25 +0000</pubDate>
				<category><![CDATA[Algorithms]]></category>
		<guid isPermaLink="false">https://ingax.com/?p=7031</guid>

					<description><![CDATA[The&#160;Tower of Hanoi&#160;(also called&#160;The problem of Benares Temple[1]&#160;or&#160;Tower of Brahma&#160;or&#160;Lucas&#8217; Tower[2]&#160;and sometimes pluralized as&#160;Towers, or simply&#160;pyramid puzzle[3]) is a&#160;mathematical game&#160;or&#160;puzzle&#160;consisting of three rods and a...]]></description>
										<content:encoded><![CDATA[
<p>The&nbsp;<strong>Tower of Hanoi</strong>&nbsp;(also called&nbsp;<strong>The problem of Benares Temple</strong><sup><a href="https://en.wikipedia.org/wiki/Tower_of_Hanoi#cite_note-oeis-1">[1]</a></sup>&nbsp;or&nbsp;<strong>Tower of Brahma</strong>&nbsp;or&nbsp;<strong>Lucas&#8217; Tower</strong><sup><a href="https://en.wikipedia.org/wiki/Tower_of_Hanoi#cite_note-2">[2]</a></sup>&nbsp;and sometimes pluralized as&nbsp;<strong>Towers</strong>, or simply&nbsp;<strong>pyramid puzzle</strong><sup><a href="https://en.wikipedia.org/wiki/Tower_of_Hanoi#cite_note-3">[3]</a></sup>) is a&nbsp;<a href="https://en.wikipedia.org/wiki/Mathematical_game">mathematical game</a>&nbsp;or&nbsp;<a href="https://en.wikipedia.org/wiki/Puzzle">puzzle</a>&nbsp;consisting of three rods and a number of disks of various&nbsp;<a href="https://en.wikipedia.org/wiki/Diameter">diameters</a>, which can slide onto any rod. The puzzle begins with the disks stacked on one rod in order of decreasing size, the smallest at the top, thus approximating a&nbsp;<a href="https://en.wikipedia.org/wiki/Cone">conical</a>&nbsp;shape. The objective of the puzzle is to move the entire stack to the last rod, obeying the following rules:</p>



<ol><li>Only one disk may be moved at a time.</li><li>Each move consists of taking the upper disk from one of the stacks and placing it on top of another stack or on an empty rod.</li><li>No disk may be placed on top of a disk that is smaller than it.</li></ol>



<p>Prints n moves in the Tower of Hanoi puzzle.</p>



<pre class="wp-block-prismatic-blocks"><code class="language-swift">func tower_of_hanoi(_ n: Int) -> [[Int]] {
    var result: [[Int]] = []
    
    func helper(_ n: Int, _ src: Int, _ aux: Int, _ dst: Int) {
        if n == 1  {
            result.append([src, dst])
            return
        }
        
        helper(n - 1, src, dst, aux)
        result.append([src, dst])
        helper(n - 1, aux, src, dst)
    }
    
    helper(n, 1, 2, 3)
    
    return result
}

print(tower_of_hanoi(3))</code></pre>
]]></content:encoded>
					
					<wfw:commentRss>https://ingax.com/tower-of-hanoi-puzzle/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<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>Selection Sort</title>
		<link>https://ingax.com/selection-sort/</link>
					<comments>https://ingax.com/selection-sort/#respond</comments>
		
		<dc:creator><![CDATA[David Inga]]></dc:creator>
		<pubDate>Sun, 28 Nov 2021 16:46:44 +0000</pubDate>
				<category><![CDATA[Algorithms]]></category>
		<category><![CDATA[Interviews]]></category>
		<guid isPermaLink="false">https://ingax.com/?p=6963</guid>

					<description><![CDATA[Two sections. One sorted. One unsorted. Select the smallest/largest value in the unsorted section and place it at the end of the sorted section. Continue...]]></description>
										<content:encoded><![CDATA[
<p>Two sections. One sorted. One unsorted. Select the smallest/largest value in the unsorted section and place it at the end of the sorted section. Continue until no values are left in the unsorted section.</p>



<pre class="wp-block-prismatic-blocks"><code class="language-swift">func selectionSort(array: inout [Int]) -> [Int] {
    for i in 0 ..< array.count - 1 {
        var indexOfSmallestValue = i
        for j in i ..< array.count {
            indexOfSmallestValue = array[j] < array[indexOfSmallestValue] ? j : indexOfSmallestValue
        }
        array.swapAt(i, indexOfSmallestValue)
    }
    return array
}</code></pre>
]]></content:encoded>
					
					<wfw:commentRss>https://ingax.com/selection-sort/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Bubble Sort</title>
		<link>https://ingax.com/bubble-sort/</link>
					<comments>https://ingax.com/bubble-sort/#respond</comments>
		
		<dc:creator><![CDATA[David Inga]]></dc:creator>
		<pubDate>Thu, 25 Nov 2021 02:33:39 +0000</pubDate>
				<category><![CDATA[Algorithms]]></category>
		<category><![CDATA[Interviews]]></category>
		<guid isPermaLink="false">https://ingax.com/?p=6957</guid>

					<description><![CDATA[At each iteration, the largest element bubbles into correct order. The bubbling operation takes \(O(n)\) time and this operation is performed \(n\) times. Therefore, Bubble...]]></description>
										<content:encoded><![CDATA[
<p>At each iteration, the largest element bubbles into correct order.</p>



<p>The bubbling operation takes \(O(n)\) time and this operation is performed \(n\) times. Therefore, Bubble Sort runs in \(O(n^2)\) time.</p>



<p>The swaps are performed in place. If the given array is mutable, the algorithm can be performed in constant space.</p>



<pre class="wp-block-prismatic-blocks"><code class="language-swift">func bubbleSort(_ array: inout [Int]) -> [Int] {
    for _ in 0..<array.count {
        for i in 0..<array.count - 1 {
            if array[i] > array[i+1] {
                array.swapAt(i, i+1)
            }
        }
    }
    return array
}</code></pre>



<p>Here&#8217;s a couple of real world optimizations. </p>



<p>Add a counter to avoid checking the part of the list that has already been sorted.</p>



<pre class="wp-block-prismatic-blocks"><code class="language-swift">func bubbleSort(_ array: inout [Int]) -> [Int] {
    var counter = 0
    for _ in 0..<array.count {
        for i in 0..<array.count - 1 - counter {
            if array[i] > array[i+1] {
                array.swapAt(i, i+1)
            }
        }
        counter += 1
    }
    return array
}</code></pre>



<p>Add a bool to return the list if it is already sorted.</p>



<pre class="wp-block-prismatic-blocks"><code class="language-swift">func bubbleSort(_ array: inout [Int]) -> [Int] {
    var counter = 0
    var inOrder = false
    while !inOrder {
        inOrder = true
        for i in 0..<array.count - 1 - counter {
            if array[i] > array[i+1] {
                array.swapAt(i, i+1)
                inOrder = false
            }
        }
        counter += 1
    }
    return array
}</code></pre>
]]></content:encoded>
					
					<wfw:commentRss>https://ingax.com/bubble-sort/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Fibonacci Sequence Algorithms Revisited</title>
		<link>https://ingax.com/fibonacci-sequence-algorithms-revisited/</link>
					<comments>https://ingax.com/fibonacci-sequence-algorithms-revisited/#respond</comments>
		
		<dc:creator><![CDATA[David Inga]]></dc:creator>
		<pubDate>Mon, 12 Jul 2021 16:38:41 +0000</pubDate>
				<category><![CDATA[Algorithms]]></category>
		<guid isPermaLink="false">https://ingax.com/?p=6943</guid>

					<description><![CDATA[The algorithm for returning the \(nth \) number in the Fibonacci Sequence provides a simple demonstration on how different design choices effect the run time,...]]></description>
										<content:encoded><![CDATA[
<p>The algorithm for returning the \(nth \) number in the Fibonacci Sequence provides a simple demonstration on how different design choices effect the run time, storage, and readability of the code.</p>



<p>The sequence is as follows:</p>



<p><code>1, 1, 2, 3, 5, 8, 13, 21, 34, 55</code></p>



<p>The sequence follows the pattern of:</p>



\(fib(n) = fib(n &#8211; 1) + fib(n &#8211; 2)\) where \(n &gt; 0 \)



<p>I&#8217;ve written three algorithms. Each has pros and cons.</p>



<p>First I want to create a simple Error for a case where \(n\) is out of bounds. We will use this with all our algorithms.</p>



<pre class="wp-block-prismatic-blocks"><code class="language-swift">enum FibError: Error {
    case OutOfBounds
}</code></pre>



<p>Our first algorithm will use an iterative approach.</p>



<pre class="wp-block-prismatic-blocks"><code class="language-swift">func fib(of n: Int) throws -> Int {
    guard n > 0 else { throw FibError.OutOfBounds }
    guard n > 2 else { return 1 }
    var result = 0, nMinusOne = 1, nMinusTwo = 1
    for _ in 3...n {
        result = (nMinusOne + nMinusTwo)
        nMinusTwo = nMinusOne
        nMinusOne = result
    }
    return result
}</code></pre>



<p>Our second algorithm will use a recursive approach. Notice how this algorithm is easier to read, but slightly more difficult to conceive.</p>



<pre class="wp-block-prismatic-blocks"><code class="language-swift">func fib(of n: Int) throws -> Int {
    guard n > 0 else { throw FibError.OutOfBounds }
    guard n > 2 else { return 1 }
    return try fib(of: n - 1) + fib(of: n - 2)
}</code></pre>



<p>Our third algorithm is a more optimal version of the recursive algorithm. Because of the nature of the recursive function calls, and more specifically the operation<code> try fib(of: n - 1) + fib(of: n - 2)</code>, we use a dictionary to avoid repetitive function calls.</p>



<pre class="wp-block-prismatic-blocks"><code class="language-swift">var sequenceValues = [Int: Int]()

func fib(of n: Int) throws -> Int {
    guard n > 0 else { throw FibError.OutOfBounds }
    guard n > 2 else { return 1 }
    var value: Int
    if sequenceValues[n] != nil  {
        value = sequenceValues[n]!
    } else {
        value = try fib(of: n - 1) + fib(of: n - 2)
        sequenceValues[n] = value
    }
    return value
}</code></pre>



<p>I hope this was helpful!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://ingax.com/fibonacci-sequence-algorithms-revisited/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Principle of Recursion</title>
		<link>https://ingax.com/principle-of-recursion/</link>
					<comments>https://ingax.com/principle-of-recursion/#respond</comments>
		
		<dc:creator><![CDATA[David Inga]]></dc:creator>
		<pubDate>Wed, 02 Dec 2020 21:21:44 +0000</pubDate>
				<category><![CDATA[Algorithms]]></category>
		<category><![CDATA[Recursion]]></category>
		<category><![CDATA[Swift]]></category>
		<guid isPermaLink="false">https://ingax.com/?p=6937</guid>

					<description><![CDATA[Print string in reverse order. You can easily solve this problem iteratively,&#160;i.e.&#160;looping through the string starting from its last character. But how about solving it...]]></description>
										<content:encoded><![CDATA[
<h3>Print string in reverse order.</h3>



<p>You can easily solve this problem iteratively,&nbsp;<em>i.e.</em>&nbsp;looping through the string starting from its last character. But how about solving it recursively?</p>



<p>First, we can define the desired function as&nbsp;<code>printReverse(str[0...n-1])</code>, where&nbsp;<code>str[0]</code>&nbsp;represents the first character in the string. Then we can accomplish the given task in two steps:</p>



<ol><li><code>printReverse(str[1...n-1])</code>: print the substring&nbsp;<code>str[1...n-1]</code>&nbsp;in reverse order.</li><li><code>print(str[0])</code>: print the first character in the string.</li></ol>



<p>Notice that we call the function itself in the first step, which by definition makes the function recursive.</p>



<p>Here is the code snippet:</p>



<pre class="wp-block-prismatic-blocks"><code class="language-swift">func printReverse(_ string: String) {
    let charArray = Array(string)
    helper(charArray, index: 0)
}

func helper(_ string: [Character], index: Int) {
    guard index < string.count else {
        return
    }
    
    helper(string, index: index + 1)
    print(string[index])
}</code></pre>



<h3>Reverse String</h3>



<p>Write a function that reverses a string. The input string is given as an array of characters&nbsp;<code>char[]</code>.</p>



<p>Do not allocate extra space for another array, you must do this by&nbsp;<strong>modifying the input array&nbsp;<a href="https://en.wikipedia.org/wiki/In-place_algorithm" target="_blank" rel="noreferrer noopener">in-place</a></strong>&nbsp;with O(1) extra memory.</p>



<p>You may assume all the characters consist of&nbsp;<a href="https://en.wikipedia.org/wiki/ASCII#Printable_characters" target="_blank" rel="noreferrer noopener">printable ascii characters</a>.</p>



<p><strong>Example 1:</strong></p>



<pre class="wp-block-preformatted"><strong>Input: </strong>["h","e","l","l","o"]
<strong>Output: </strong>["o","l","l","e","h"]
</pre>



<p><strong>Example 2:</strong></p>



<pre class="wp-block-preformatted"><strong>Input: </strong>["H","a","n","n","a","h"]
<strong>Output: </strong>["h","a","n","n","a","H"]</pre>



<p>Here's my solution. I noticed it's only necessary to recurse halfway through the input.</p>



<pre class="wp-block-prismatic-blocks"><code class="language-swift">    func reverseString(_ s: inout [Character]) {
        helper(&s, index: 0)
    }
    func helper(_ s: inout [Character], index: Int) {
        guard index < s.count / 2 else {
            return
        }
        helper(&#038;s, index: index + 1)
        s.swapAt(index, s.count - 1 - index)
    }</code></pre>
]]></content:encoded>
					
					<wfw:commentRss>https://ingax.com/principle-of-recursion/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Reverse a Linked List</title>
		<link>https://ingax.com/reverse-a-linked-list/</link>
					<comments>https://ingax.com/reverse-a-linked-list/#respond</comments>
		
		<dc:creator><![CDATA[David Inga]]></dc:creator>
		<pubDate>Tue, 17 Dec 2019 19:18:59 +0000</pubDate>
				<category><![CDATA[Algorithms]]></category>
		<category><![CDATA[Swift]]></category>
		<guid isPermaLink="false">https://ingax.com/?p=6764</guid>

					<description><![CDATA[Resources https://www.geeksforgeeks.org/reverse-a-linked-list/]]></description>
										<content:encoded><![CDATA[
<pre class="wp-block-prismatic-blocks"><code class="language-swift">public class ListNode {
  public var val: Int
  public var next: ListNode?
  public init(_ val: Int) {
    self.val = val
    self.next = nil
  }
}

func reverseList(_ head: ListNode?) -> ListNode? {
  var curr = head
  var prev: ListNode?
  var next: ListNode?
  
  while curr != nil {
    next = curr?.next
    curr?.next = prev
    prev = curr
    curr = next
  }
  
  return prev
}</code></pre>



<h3>Resources</h3>



<ul><li><a href="https://www.geeksforgeeks.org/reverse-a-linked-list/">https://www.geeksforgeeks.org/reverse-a-linked-list/</a></li></ul>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://ingax.com/reverse-a-linked-list/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Return the nth Fibonacci Number (Iterative)</title>
		<link>https://ingax.com/return-the-nth-fibonacci-number-iterative/</link>
					<comments>https://ingax.com/return-the-nth-fibonacci-number-iterative/#respond</comments>
		
		<dc:creator><![CDATA[David Inga]]></dc:creator>
		<pubDate>Tue, 17 Dec 2019 00:06:43 +0000</pubDate>
				<category><![CDATA[Algorithms]]></category>
		<category><![CDATA[Swift]]></category>
		<guid isPermaLink="false">https://ingax.com/?p=6750</guid>

					<description><![CDATA[Aside from using an equation to calculate the nth Fibonacci number, the following iterative method has the best time and space complexity. Time complexity is...]]></description>
										<content:encoded><![CDATA[
<p>Aside from using an <a href="http://www.maths.surrey.ac.uk/hosted-sites/R.Knott/Fibonacci/fibFormula.html#section1" target="_blank" rel="noreferrer noopener" aria-label="equation to calculate the nth Fibonacci number (opens in a new tab)">equation to calculate the nth Fibonacci number</a>, the following iterative method has the best time and space complexity.</p>



<p>Time complexity is \(O(n)\) and space complexity is \(O(1)\). This method saves on space, since we only need to store the previous two Fibonacci numbers.</p>



<pre class="wp-block-prismatic-blocks"><code class="language-swift">func fib(_ n: Int) -> Int? {
  if n < 1 { return nil }
  if n < 3 { return 1 }
  
  var i = 1
  var ii = 1
  var an = 0
  
  for _ in 3...n {
    an = i + ii
    ii = i
    i = an
  }
  
  return an
}</code></pre>
]]></content:encoded>
					
					<wfw:commentRss>https://ingax.com/return-the-nth-fibonacci-number-iterative/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Breadth First Search (BFS)</title>
		<link>https://ingax.com/breadth-first-search-bfs/</link>
					<comments>https://ingax.com/breadth-first-search-bfs/#respond</comments>
		
		<dc:creator><![CDATA[David Inga]]></dc:creator>
		<pubDate>Tue, 27 Aug 2019 01:32:33 +0000</pubDate>
				<category><![CDATA[Algorithms]]></category>
		<category><![CDATA[GIP]]></category>
		<category><![CDATA[Swift]]></category>
		<guid isPermaLink="false">https://ingax.com/?p=6674</guid>

					<description><![CDATA[Applications Web Crawling Social Networking Network Broadcast Garbage Collection Model Checking Check Mathematical Conjectures Solving Puzzles and Games References https://www.geeksforgeeks.org/breadth-first-search-or-bfs-for-a-graph/ https://www.raywenderlich.com/710-swift-algorithm-club-swift-breadth-first-search https://en.wikipedia.org/wiki/Breadth-first_search]]></description>
										<content:encoded><![CDATA[
<h3>Applications</h3>



<ul><li>Web Crawling</li><li>Social Networking</li><li>Network Broadcast</li><li>Garbage Collection</li><li>Model Checking</li><li>Check Mathematical Conjectures</li><li>Solving Puzzles and Games</li></ul>



<figure class="wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe title="13. Breadth-First Search (BFS)" width="1080" height="608" src="https://www.youtube.com/embed/s-CYnVz-uh4?feature=oembed" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div><figcaption>Lecture on Graphs and BFS</figcaption></figure>



<h3>References</h3>



<ul><li><a rel="noreferrer noopener" aria-label="https://www.geeksforgeeks.org/breadth-first-search-or-bfs-for-a-graph/ (opens in a new tab)" href="https://www.geeksforgeeks.org/breadth-first-search-or-bfs-for-a-graph/" target="_blank">https://www.geeksforgeeks.org/breadth-first-search-or-bfs-for-a-graph/</a></li><li><a rel="noreferrer noopener" aria-label="https://www.raywenderlich.com/710-swift-algorithm-club-swift-breadth-first-search (opens in a new tab)" href="https://www.raywenderlich.com/710-swift-algorithm-club-swift-breadth-first-search" target="_blank">https://www.raywenderlich.com/710-swift-algorithm-club-swift-breadth-first-search</a></li><li><a rel="noreferrer noopener" aria-label="https://en.wikipedia.org/wiki/Breadth-first_search (opens in a new tab)" href="https://en.wikipedia.org/wiki/Breadth-first_search" target="_blank">https://en.wikipedia.org/wiki/Breadth-first_search</a></li></ul>
]]></content:encoded>
					
					<wfw:commentRss>https://ingax.com/breadth-first-search-bfs/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Depth First Search (DFS)</title>
		<link>https://ingax.com/depth-first-search-dfs/</link>
					<comments>https://ingax.com/depth-first-search-dfs/#respond</comments>
		
		<dc:creator><![CDATA[David Inga]]></dc:creator>
		<pubDate>Tue, 27 Aug 2019 01:28:42 +0000</pubDate>
				<category><![CDATA[Algorithms]]></category>
		<category><![CDATA[GIP]]></category>
		<category><![CDATA[Swift]]></category>
		<guid isPermaLink="false">https://ingax.com/?p=6671</guid>

					<description><![CDATA[References https://www.geeksforgeeks.org/depth-first-search-or-dfs-for-a-graph/ https://www.raywenderlich.com/661-swift-algorithm-club-swift-depth-first-search https://en.wikipedia.org/wiki/Depth-first_search]]></description>
										<content:encoded><![CDATA[<p><script src="https://gist.github.com/davidinga/2fb7ffb1903b9164d07e06e6fd0ac425.js"></script></p>


<h3>References</h3>



<ul><li><a rel="noreferrer noopener" aria-label="https://www.geeksforgeeks.org/depth-first-search-or-dfs-for-a-graph/ (opens in a new tab)" href="https://www.geeksforgeeks.org/depth-first-search-or-dfs-for-a-graph/" target="_blank">https://www.geeksforgeeks.org/depth-first-search-or-dfs-for-a-graph/</a></li><li><a rel="noreferrer noopener" aria-label="https://www.raywenderlich.com/661-swift-algorithm-club-swift-depth-first-search (opens in a new tab)" href="https://www.raywenderlich.com/661-swift-algorithm-club-swift-depth-first-search" target="_blank">https://www.raywenderlich.com/661-swift-algorithm-club-swift-depth-first-search</a></li><li><a href="https://en.wikipedia.org/wiki/Depth-first_search" target="_blank" rel="noreferrer noopener" aria-label="https://en.wikipedia.org/wiki/Depth-first_search (opens in a new tab)">https://en.wikipedia.org/wiki/Depth-first_search</a></li></ul>
]]></content:encoded>
					
					<wfw:commentRss>https://ingax.com/depth-first-search-dfs/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 18/127 objects using disk
Page Caching using disk: enhanced 
Database Caching using disk

Served from: ingax.com @ 2026-06-09 12:56:37 by W3 Total Cache
-->