<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Aashish Panchal</title>
    <description>The latest articles on DEV Community by Aashish Panchal (@aashish578).</description>
    <link>https://dev.to/aashish578</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F490481%2Fbc19a735-2669-4094-aec7-bd1fe27dc728.jpg</url>
      <title>DEV Community: Aashish Panchal</title>
      <link>https://dev.to/aashish578</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/aashish578"/>
    <language>en</language>
    <item>
      <title>print 3 using C#</title>
      <dc:creator>Aashish Panchal</dc:creator>
      <pubDate>Thu, 24 Dec 2020 13:32:54 +0000</pubDate>
      <link>https://dev.to/aashish578/print-3-using-c-270</link>
      <guid>https://dev.to/aashish578/print-3-using-c-270</guid>
      <description>&lt;p&gt;class Program&lt;br&gt;
    {&lt;br&gt;
        static void Main(string[] args)&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    { // 1
        for (int i = 1; i &amp;lt;= 3; i++)
            for (int j = 1; j &amp;lt;= 20; j++)
            {
                Console.Write("*");
                if (j == 20)
                    Console.Write("\n");
            }


        // 2
        for (int i = 1; i &amp;lt;= 3; i++)
        {
            for (int k = 1; k &amp;lt;= 13; k++) Console.Write(" ");

            for (int j = 1; j &amp;lt;= 7; j++)
            {
                Console.Write("*");
                if (j == 7)
                    Console.Write("\n");
            }
        }
        // 3
        for (int i = 1; i &amp;lt;= 3; i++)
            for (int j = 1; j &amp;lt;= 20; j++)
            {
                Console.Write("*");
                if (j == 20)
                    Console.Write("\n");
            }

        // 4
        for (int i = 1; i &amp;lt;= 3; i++)
        {
            for (int k = 1; k &amp;lt;= 13; k++) Console.Write(" ");

            for (int j = 1; j &amp;lt;= 7; j++)
            {
                Console.Write("*");
                if (j == 7)
                    Console.Write("\n");
            }
        }

        // 3
        for (int i = 1; i &amp;lt;= 3; i++)
            for (int j = 1; j &amp;lt;= 20; j++)
            {
                Console.Write("*");
                if (j == 20)
                    Console.Write("\n");
            }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Output:-&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;********************
********************
********************
             *******
             *******
             *******
********************
********************
********************
             *******
             *******
             *******
********************
********************
********************
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
    </item>
    <item>
      <title>print 2 using C#</title>
      <dc:creator>Aashish Panchal</dc:creator>
      <pubDate>Thu, 24 Dec 2020 13:31:05 +0000</pubDate>
      <link>https://dev.to/aashish578/print-2-using-c-59hh</link>
      <guid>https://dev.to/aashish578/print-2-using-c-59hh</guid>
      <description>&lt;p&gt;class Program&lt;br&gt;
    {&lt;br&gt;
        static void Main(string[] args)&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    { 
        // 1
        for (int i = 1; i &amp;lt;= 3; i++)
            for (int j = 1; j &amp;lt;= 20; j++)
            {
                Console.Write("*");
                if (j == 20)
                    Console.Write("\n");
            }


        // 2
        for (int i = 1; i &amp;lt;= 3; i++)
        {
            for (int k = 1; k &amp;lt;= 13; k++) Console.Write(" ");

            for (int j = 1; j &amp;lt;= 7; j++)
            {
                Console.Write("*");
                if (j == 7)
                    Console.Write("\n");
            }
        }
        // 3
        for (int i = 1; i &amp;lt;= 3; i++)
            for (int j = 1; j &amp;lt;= 20; j++)
            {
                Console.Write("*");
                if (j == 20)
                    Console.Write("\n");
            }

        // 4
        for (int i = 1; i &amp;lt;= 3; i++)
        {
            //for (int k = 1; k &amp;lt;= 13; k++) Console.Write(" ");

            for (int j = 1; j &amp;lt;= 7; j++)
            {
                Console.Write("*");
                if (j == 7)
                    Console.Write("\n");
            }
        }

        // 5
        for (int i = 1; i &amp;lt;= 3; i++)
            for (int j = 1; j &amp;lt;= 20; j++)
            {
                Console.Write("*");
                if (j == 20)
                    Console.Write("\n");
            }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Output:-&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;********************
********************
********************
             *******
             *******
             *******
********************
********************
********************
*******
*******
*******
********************
********************
********************
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
    </item>
    <item>
      <title>Print 1 using C#</title>
      <dc:creator>Aashish Panchal</dc:creator>
      <pubDate>Thu, 24 Dec 2020 13:26:57 +0000</pubDate>
      <link>https://dev.to/aashish578/print-1-using-c-5g7n</link>
      <guid>https://dev.to/aashish578/print-1-using-c-5g7n</guid>
      <description>&lt;p&gt;class Program&lt;br&gt;
    {&lt;br&gt;
        static void Main(string[] args)&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    {// 1
        for (int i = 1; i &amp;lt;= 3; i++)
            for (int j = 1; j &amp;lt;= 20; j++)
            {
                Console.Write("*");
                if (j == 20)
                    Console.Write("\n");
            }


        // 2
        for (int i = 1; i &amp;lt;= 3; i++)
        {
            for (int k = 1; k &amp;lt;= 13; k++) Console.Write(" ");

            for (int j = 1; j &amp;lt;= 7; j++)
            {
                Console.Write("*");
                if (j == 7)
                    Console.Write("\n");
            }
        }
        // 3
        for (int i = 1; i &amp;lt;= 7; i++)
        {
            for (int k = 1; k &amp;lt;= 13; k++) Console.Write(" ");

            for (int j = 1; j &amp;lt;= 7; j++)
            {
                Console.Write("*");
                if (j == 7)
                    Console.Write("\n");
            }
        }

        // 5
        for (int i = 1; i &amp;lt;= 3; i++)
            for (int j = 1; j &amp;lt;= 33; j++)
            {
                Console.Write("*");
                if (j == 33)
                    Console.Write("\n");
            }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Output:-&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;********************
********************
********************
             *******
             *******
             *******
             *******
             *******
             *******
             *******
             *******
             *******
             *******
*********************************
*********************************
*********************************
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
    </item>
    <item>
      <title>Dijkstra Binary Heap PQ</title>
      <dc:creator>Aashish Panchal</dc:creator>
      <pubDate>Fri, 30 Oct 2020 13:53:46 +0000</pubDate>
      <link>https://dev.to/aashish578/dijkstra-binary-heap-pq-5gk0</link>
      <guid>https://dev.to/aashish578/dijkstra-binary-heap-pq-5gk0</guid>
      <description>&lt;p&gt;Last program of Java Script&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    class weightedGraph {
        constructor() {
            this.adjacencyList = {};
        }
        addVertex(vertex) {
            if(!this.adjacencyList[vertex]) this.adjacencyList[vertex] = [];
            console.log(` -&amp;gt;   ${vertex}`)
        }

        addEdge(vertex1,vertex2, weight) {
            this.adjacencyList[vertex1].push({node: vertex2, weight});
            this.adjacencyList[vertex2].push({node :vertex1, weight});
            console.log(` -&amp;gt;   graph.addEdge ("${vertex1}", "${vertex2}", ${weight})`)
        }

        Dijkstra(start, finish) {
            const nodes = new PriorityQueue();
            const distances = {};
            const previous = {};
            let path = [] // to return at end
            let smallest

            // build up initial state
            for(let vertex in this.adjacencyList) {
                if(vertex === start) {
                    distances[vertex] = 0;
                    nodes.enqueue(vertex, 0);
                } else {
                    distances[vertex] = Infinity;
                    nodes.enqueue(vertex, Infinity);
                }
                previous[vertex] = null;
            }

            // As Long as there is Something to visit
            while(nodes.values.length) {
                smallest = nodes.dequeue().val;
                if(smallest === finish) {
                    // WE ARE DONE 
                    // BUILD UP PATH TO RETURN AT END 
                    while(previous[smallest]) {
                        path.push(smallest);
                        smallest = previous[smallest];
                    }
                    break;
                }
                if(smallest || distances[smallest] !== Infinity) {
                    for(let neighbor in this.adjacencyList[smallest]) {
                        // find neighboring node
                        let nextNode = this.adjacencyList[smallest][neighbor]; 
                        // Calculate new distances to neighboring node
                        let candidate = distances[smallest] + nextNode.weight;
                        let nextNeighbor = nextNode.node
                        if(candidate &amp;lt; distances[nextNeighbor]) {
                            // Upadating new smallest distance to neighbor 
                            distances[nextNeighbor] = candidate; 
                            // Upadating previous - How we got to neighbor
                            previous[nextNeighbor] = smallest;
                            // enqueue in priority queue with new priority
                            nodes.enqueue(nextNeighbor, candidate);
                        }
                    }
                }
             }
             console.log(path.concat(smallest).reverse());
        }
    }

    class priorityQueue {
        constructor() {
            this.values = []
        }
        enqueue(val, priority) {
            let newNode = new Node(val, priority)
            this.values.push(newNode);
            this.bubbleUp();
        }

        bubbleUp() {
            let idx = this.values.length - 1;
            const element = this.values[idx];
            while(idx &amp;gt; 0) {
                let parentIdx = Math.floor((idx - 1)/2);
                let parent = this.values[parentIdx];
                if(element.priority &amp;lt;= parent.priority) break;
                this.values[parentIdx] = element;
                this.values[idx] = parent;
                idx = parentIdx;
            }
        }

        dequeue () {
          const min = this.values[0];
          const end = this.values.pop();
              if(this.values.length &amp;gt; 0) {
              this.values[0] = end;
              this.sinkDown()
          }
          return min;
        }
        sinkDown() {
            let idx = 0;
            const length = this.values.length;
            const element = this.values[0];
            while(true) {
                let leftChildIdx = 2 * idx + 1;
                let rightChildIdx = 2 * idx + 2;
                let leftChild,rightChild;
                let swap = null;
                if(leftChildIdx &amp;lt; length) {
                    leftChild = this.values[leftChildIdx];
                    if(leftChild.priority &amp;lt; element.priority) {
                        swap = leftChildIdx; 
                    }
                }
                if(rightChildIdx &amp;lt; length) {
                    rightChild = this.values[rightChildIdx];
                    if(
                        (swap === null &amp;amp;&amp;amp; rightChild.priority &amp;lt; element.priority) 
                                               ||
                        (swap !== null &amp;amp;&amp;amp; rightChild.priority &amp;lt; leftChild.priority)
                     ) {
                        swap = rightChildIdx;
                    } 
                }

                if(swap === null) break;
                this.values[idx] = this.values[swap]
                this.values[swap] = element;
            }
        }
    }

    class Node {
        constructor(val, priority) {
            this.val = val;
            this.priority = priority;
        }
    }

    var graph = new weightedGraph();
    console.log("&amp;lt;---value---&amp;gt;")
    graph.addVertex("A")
    graph.addVertex("B")
    graph.addVertex("C")
    graph.addVertex("D")
    graph.addVertex("E")
    graph.addVertex("F")
    console.log("&amp;lt;---AddEdg value---&amp;gt;") 
    graph.addEdge("A", "B", 4);
    graph.addEdge("A", "C", 2);
    graph.addEdge("B", "E", 3);
    graph.addEdge("C", "D", 2);
    graph.addEdge("C", "F", 4);
    graph.addEdge("D", "E", 3);
    graph.addEdge("D", "F", 1);
    graph.addEdge("E", "F", 1);
    console.log("&amp;lt;---Dijkstra's value---&amp;gt;")
    graph.Dijkstra("A", "E");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>hacktoberfest</category>
    </item>
    <item>
      <title>Dijkstra First Version</title>
      <dc:creator>Aashish Panchal</dc:creator>
      <pubDate>Fri, 30 Oct 2020 12:11:21 +0000</pubDate>
      <link>https://dev.to/aashish578/dijkstra-first-version-27lm</link>
      <guid>https://dev.to/aashish578/dijkstra-first-version-27lm</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class PriorityQueue {
  constructor(){
    this.values = [];
  }
  enqueue(val, priority) {
    this.values.push({val, priority});
    this.sort();
    return values
  };
  dequeue() {
    return this.values.shift();
  };
  sort() {
    this.values.sort((a, b) =&amp;gt; a.priority - b.priority);
  };
}

class weightedGraph {
    constructor() {
        this.adjacencyList = {};
    }
    addVertex(vertex) {
        if(!this.adjacencyList[vertex]) this.adjacencyList[vertex] = [];
        console.log(` -&amp;gt;   ${vertex}`)
    }

    addEdge(vertex1,vertex2, weight) {
        this.adjacencyList[vertex1].push({node: vertex2, weight});
        this.adjacencyList[vertex2].push({node :vertex1, weight});
        console.log(` -&amp;gt;   graph.addEdge ("${vertex1}", "${vertex2}", ${weight})`)
    }

    Dijkstra(start, finish) {
        const nodes = new PriorityQueue();
        const distances = {};
        const previous = {};
        let path = [] // to return at end
        let smallest

        // build up initial state
        for(let vertex in this.adjacencyList) {
            if(vertex === start) {
                distances[vertex] = 0;
                nodes.enqueue(vertex, 0);
            } else {
                distances[vertex] = Infinity;
                nodes.enqueue(vertex, Infinity);
            }
            previous[vertex] = null;
        }

        // As Long as there is Something to visit
        while(nodes.values.length) {
            smallest = nodes.dequeue().val;
            if(smallest === finish) {
                // WE ARE DONE 
                // BUILD UP PATH TO RETURN AT END 
                while(previous[smallest]) {
                    path.push(smallest);
                    smallest = previous[smallest];
                }
                break;
            }
            if(smallest || distances[smallest] !== Infinity) {
                for(let neighbor in this.adjacencyList[smallest]) {
                    // find neighboring node
                    let nextNode = this.adjacencyList[smallest][neighbor]; 
                    // Calculate new distances to neighboring node
                    let candidate = distances[smallest] + nextNode.weight;
                    let nextNeighbor = nextNode.node
                    if(candidate &amp;lt; distances[nextNeighbor]) {
                        // Upadating new smallest distance to neighbor 
                        distances[nextNeighbor] = candidate; 
                        // Upadating previous - How we got to neighbor
                        previous[nextNeighbor] = smallest;
                        // enqueue in priority queue with new priority
                        nodes.enqueue(nextNeighbor, candidate);
                    }
                }
            }
         }
         console.log(path.concat(smallest).reverse());
    }
}

var graph = new weightedGraph(); 
console.log("&amp;lt;---value---&amp;gt;")
graph.addVertex("A")
graph.addVertex("B")
graph.addVertex("C")
graph.addVertex("D")
graph.addVertex("E")
graph.addVertex("F")
console.log("&amp;lt;---AddEdg value---&amp;gt;") 
graph.addEdge("A", "B", 4);
graph.addEdge("A", "C", 2);
graph.addEdge("B", "E", 3);
graph.addEdge("C", "D", 2);
graph.addEdge("C", "F", 4);
graph.addEdge("D", "E", 3);
graph.addEdge("D", "F", 1);
graph.addEdge("E", "F", 1);
console.log("&amp;lt;---Dijkstra's value---&amp;gt;")
graph.Dijkstra("A", "E");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>hacktoberfest</category>
    </item>
    <item>
      <title>Graph Traversal</title>
      <dc:creator>Aashish Panchal</dc:creator>
      <pubDate>Thu, 29 Oct 2020 13:30:42 +0000</pubDate>
      <link>https://dev.to/aashish578/graph-traversal-4id9</link>
      <guid>https://dev.to/aashish578/graph-traversal-4id9</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Graph {
    constructor() {
        this.adjacencyList = {};
    }
    addVertex(vertex) {
        if(!this.adjacencyList[vertex]) {
          this.adjacencyList[vertex] = [];  
        }
        return g;
    }

    addEdge(v1,v2) {
        this.adjacencyList[v1].push(v2);
        this.adjacencyList[v2].push(v1);
        return g;
    } 

    removeEdge(vertex1,vertex2) {
        this.adjacencyList[vertex1] = this.adjacencyList[vertex1].filter(
            v =&amp;gt; v !== vertex2
        );
        this.adjacencyList[vertex2] = this.adjacencyList[vertex2].filter(
            v =&amp;gt; v !== vertex1
        );
        return g;
    } 

    removeVertex(vertex) {
        while (this.adjacencyList[vertex].length) {
            const adjacencyVertex = this.adjacencyList[vertex].pop()
            this.removeEdge(vertex, adjacencyVertex);
        }
        delete this.adjacencyList[vertex]
        return g;
    }

    depthFirstRecursive(start) {
        const result = [];
        const visited = {};
        const adjacencyList = this.adjacencyList;

        (function dfs(vertex) {
            if(!vertex) return null;
            visited[vertex] = true;
            result.push(vertex);
            adjacencyList[vertex].forEach(neighbor =&amp;gt; {
                if(!visited[neighbor]) {
                    return dfs(neighbor)
                }
            });
        })(start);
        return result;
    }

    depthFirstIterative(start) {
        const stack = [start];
        const result = [];
        const visited = {};
        let currentVertex;

        visited[start] = true;
        while(stack.length) {
            console.log(stack);
            currentVertex = stack.pop();
            result.push(currentVertex);

            this.adjacencyList[currentVertex].forEach(neighbor =&amp;gt; {
                if(!visited[neighbor]) {
                    visited[neighbor] = true;
                    stack.push(neighbor)
                }
            });
        }
        return result;
    }
    breadthFirst(start) {
        const queue = [start];
        const result = [];
        const visited = {};
        let currentVertex;

        while(queue.length) {
             currentVertex = queue.shift()
             result.push(currentVertex);

             this.adjacencyList[currentVertex].forEach(neighbor =&amp;gt; {
                if(!visited[neighbor]) {
                    visited[neighbor] = true;
                    queue.push(neighbor)
                }
             });
        }
        return result;
    }
}

let g =new Graph();
g.addVertex("A")
g.addVertex("B")
g.addVertex("C")
g.addVertex("D")
g.addVertex("E")
g.addVertex("F")

g.addEdge("A","B")
g.addEdge("A","C")
g.addEdge("B","D")
g.addEdge("C","E")
g.addEdge("D","E")
g.addEdge("D","F")
g.addEdge("E","F")


/*
             A
           /   \
          B     C
          |     | 
          D --- E
           \   /
             F
*/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>hacktoberfest</category>
    </item>
    <item>
      <title>Graph</title>
      <dc:creator>Aashish Panchal</dc:creator>
      <pubDate>Thu, 29 Oct 2020 10:34:21 +0000</pubDate>
      <link>https://dev.to/aashish578/graph-46am</link>
      <guid>https://dev.to/aashish578/graph-46am</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Graph {
    constructor() {
        this.adjacencyList = {};
    }

 // Add Value in Graph
    addVertex(vertex) {
        if(!this.adjacencyList[vertex]) {
          this.adjacencyList[vertex] = [];  
        } 
        console.log(` -&amp;gt; ${vertex} -&amp;gt; Added successfully `)
        return g;
    }
 // Add Edge-Array in Graph   
 // EXAMPLE.. -&amp;gt; g.addEdge("Rajkot", "Ahmedabad")
    addEdge(v1,v2) {
        this.adjacencyList[v1].push(v2);
        this.adjacencyList[v2].push(v1);
        console.log(` -&amp;gt; ${v1} or ${v2} -&amp;gt; Edge-Array Added successfully `)
        return g;
    }

 // Remove Value in Graph
    removeEdge(vertex1,vertex2) {
        this.adjacencyList[vertex1] = this.adjacencyList[vertex1].filter(
            v =&amp;gt; v !== vertex2
        );
        this.adjacencyList[vertex2] = this.adjacencyList[vertex2].filter(
            v =&amp;gt; v !== vertex1
        );

        console.log(`-&amp;gt; ${vertex1} or ${vertex2} -&amp;gt; Edge-Array Deleted successfully`)
        return g;
    }

 // Remove a Vertex in Graph
    removeVertex(vertex) {
        while (this.adjacencyList[vertex].length) {
            const adjacencyVertex = this.adjacencyList[vertex].pop()
            this.removeEdge(vertex, adjacencyVertex);
        }
        delete this.adjacencyList[vertex]
        console.log(`-&amp;gt; ${vertex} -&amp;gt; Deleted successfully `)
        return g;
    }
}

let g =new Graph();
g.addVertex("Rajkot");  
g.addVertex("Ahmedabad");
g.addVertex("Morbi");
g.addEdge("Morbi", "Ahmedabad")
g.addEdge("Rajkot", "Morbi")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>hacktoberfest</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Hash Tables</title>
      <dc:creator>Aashish Panchal</dc:creator>
      <pubDate>Tue, 27 Oct 2020 10:18:30 +0000</pubDate>
      <link>https://dev.to/aashish578/hash-tables-36</link>
      <guid>https://dev.to/aashish578/hash-tables-36</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class HashTable {
  constructor(size=53){
    this.keyMap = new Array(size);
  }

  _hash(key) {
    let total = 0;
    let WEIRD_PRIME = 31;
    for (let i = 0; i &amp;lt; Math.min(key.length, 100); i++) {
      let char = key[i];
      let value = char.charCodeAt(0) - 96
      total = (total * WEIRD_PRIME + value) % this.keyMap.length;
    }
    return total;
  }

  // Add a Value
  set(key, value) {
    let index = this._hash(key);
    if(!this.keyMap[index]) {
      this.keyMap[index] = [];
    }
    this.keyMap[index].push([key, value]);
    console.log(` ${key} or ${value} -&amp;gt;&amp;gt; is added successfully 👍👍`)
    return ht;
  }

  // Find a value 
  get(key) {
    let index = this._hash(key);
    if(this.keyMap[index]) {
      for(let i = 0; i &amp;lt; this.keyMap[index].length; i++) {
        if(this.keyMap[index][i][0] === key) {
          return this.keyMap[index][i][1]
        }
      }
    }
    return undefined;
  }

  // Show all Keys
  keys() {
    let keysArr = [];
    for(let i = 0; i &amp;lt;this.keyMap.length; i++) {
      if(this.keyMap[i]) {
        for( let j = 0; j &amp;lt; this.keyMap[i].length; j++) {
          if(!keysArr.includes(this.keyMap[i][j][0])) { 
            keysArr.push(this.keyMap[i][j][0])
          }
        }
      }
    }
    console.log(` Your Keys is -&amp;gt; ${keysArr}`);
    return keysArr;
  }

  // Show all Value
  value() {
    let valuesArr = [];
    for(let i = 0; i &amp;lt;this.keyMap.length; i++) {
      if(this.keyMap[i]) {
        for( let j = 0; j &amp;lt; this.keyMap[i].length; j++) {
          if(!valuesArr.includes(this.keyMap[i][j][1])) { 
            valuesArr.push(this.keyMap[i][j][1])
          }
        }
      }
    }
    console.log(` Your Value is -&amp;gt; ${valuesArr}`)
    return valuesArr;
  }
}

let ht = new HashTable(17);
ht.set("java script ", "java")
ht.set("html ", "css")
ht.set("c ", "c++")
ht.value();
ht.keys();



//  ht.keys().forEach(function(key) {
//    console.log(` -&amp;gt; your Key is -&amp;gt; ${ht.get(key)}`);
//  })

//       👆👆 👆 👆 👆 👆 👆 👆 👆

//           👉  OUTPUT 👈

//            -&amp;gt; your Key is -&amp;gt; java
//            -&amp;gt; your Key is -&amp;gt; css 
//            -&amp;gt; your Key is -&amp;gt; c++
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>javascript</category>
      <category>hacktoberfest</category>
    </item>
    <item>
      <title>Priority Queue</title>
      <dc:creator>Aashish Panchal</dc:creator>
      <pubDate>Mon, 26 Oct 2020 09:57:58 +0000</pubDate>
      <link>https://dev.to/aashish578/priority-queue-1b91</link>
      <guid>https://dev.to/aashish578/priority-queue-1b91</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class priorityQueue {
    constructor() {
        this.values = []
    }
    enqueue(val, priority) {
        let newNode = new Node(val, priority)
        this.values.push(newNode);
        this.bubbleUp();
    }

    bubbleUp() {
        let idx = this.values.length - 1;
        const element = this.values[idx];
        while(idx &amp;gt; 0) {
            let parentIdx = Math.floor((idx - 1)/2);
            let parent = this.values[parentIdx];
            if(element.priority &amp;lt;= parent.priority) break;
            this.values[parentIdx] = element;
            this.values[idx] = parent;
            idx = parentIdx;
        }
    }

    dequeue () {
      const min = this.values[0];
      const end = this.values.pop();
          if(this.values.length &amp;gt; 0) {
          this.values[0] = end;
          this.sinkDown()
      }
      return min;
    }
    sinkDown() {
        let idx = 0;
        const length = this.values.length;
        const element = this.values[0];
        while(true) {
            let leftChildIdx = 2 * idx + 1;
            let rightChildIdx = 2 * idx + 2;
            let leftChild,rightChild;
            let swap = null;
            if(leftChildIdx &amp;lt; length) {
                leftChild = this.values[leftChildIdx];
                if(leftChild.priority &amp;lt; element.priority) {
                    swap = leftChildIdx; 
                }
            }
            if(rightChildIdx &amp;lt; length) {
                rightChild = this.values[rightChildIdx];
                if(
                    (swap === null &amp;amp;&amp;amp; rightChild.priority &amp;lt; element.priority) 
                                           ||
                    (swap !== null &amp;amp;&amp;amp; rightChild.priority &amp;lt; leftChild.priority)
                 ) {
                    swap = rightChildIdx;
                } 
            }

            if(swap === null) break;
            this.values[idx] = this.values[swap]
            this.values[swap] = element;
        }
    }
}

class Node {
    constructor(val, priority) {
        this.val = val;
        this.priority = priority;
    }
}

let ER = new priorityQueue();
ER.enqueue('common cold', 5)
ER.enqueue('gunshot woind', 1)
ER.enqueue('high Fever', 4)
ER.enqueue('broken arm', 2)
ER.enqueue('glass in foot', 3)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>hacktoberfest</category>
      <category>javascript</category>
    </item>
    <item>
      <title>BFS and DFS in Binary Search Tree</title>
      <dc:creator>Aashish Panchal</dc:creator>
      <pubDate>Thu, 22 Oct 2020 11:36:38 +0000</pubDate>
      <link>https://dev.to/aashish578/bfs-and-dfs-in-binary-search-tree-59lc</link>
      <guid>https://dev.to/aashish578/bfs-and-dfs-in-binary-search-tree-59lc</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/* 

                    Example For Binary Search Tree

                              __10__
                            /        \  
                           5         13
                          / \       / \
                         2   7     11 16 
                        / \   \         \
                       1  3   9         18

*/

class Node {
    constructor(value){
        this.length = 0;
        this.value = value;
        this.left = null;
        this.right = null;

    }
}
class BinarySearchTree {
    constructor(){
        this.root = null;
    }


    // Insert a New value in tree 
    insert(value) {
        var newNode = new Node(value);
        if(this.root === null) {
            this.root = newNode;
            return this;
        } else {
            var current = this.root;
            while(true) {
                if(value &amp;lt; current.value) {
                    if(current.left === null) {
                        current.left = newNode;
                        console.log(` -&amp;gt;   ${current.value}  left value -&amp;gt; ${value} added `)
                        return this;    
                    } else {
                        current = current.left;
                    }
                } else if(value &amp;gt; current.value) {
                    if (current.right === null) {
                        current.right = newNode;
                        console.log(` -&amp;gt;   ${current.value}  right value -&amp;gt; ${value} added `)
                        return this;
                    } else {
                        current = current.right;
                    }
                } 
                if(current.value == value) {
                    console.log(` -&amp;gt;  ${value} is  Duplicate value Please Enter Unique Value `)
                    return;
                }
            }
        }
    }

 // find The Value in tree
    find(value) {
           if(this.root === null) return false;
           var current = this.root,
               found = false;
           while(current &amp;amp;&amp;amp; !found) {
               if(value &amp;lt; current.value) {
                   current = current.left;
               } else if (value &amp;gt; current.value) {
                   current = current.right;
               } else {
                   console.log(` -&amp;gt;   Founded Successfully -&amp;gt; ${value}`);
                   return current;
               }
           }
           if(!found) console.log(` -&amp;gt;   Not Founded -&amp;gt; ${value}`);
           return current;
    }

 // Same as no find
    contains(value) {
       if(this.root === null) return false;
       var current = this.root,
           found = false;
       while(current &amp;amp;&amp;amp; !found) {
           if(value &amp;lt; current.value) {
               current = current.left;
           } else if (value &amp;gt; current.value) {
               current = current.right;
           } else {
               console.log(` -&amp;gt;   Founded Successfully -&amp;gt; ${value}`);
               return current;
           }
       }
       if(!found) console.log(` -&amp;gt;   Not Founded -&amp;gt; ${value}`);
       return current;
   }


    /* 

                        Example For BREADTH FIRST SEARCH List

                  first -&amp;gt;        __10__
                                /        \  
                 second -&amp;gt;     6         15
                              / \         \
                 third -&amp;gt;    3   8        20

    */
   BFS() {
       var node = this.root,
           data = [],
          queue = [];
       queue.push(node);

       while(queue.length) {
          node = queue.shift()
          data.push(node.value);
          if(node.left) queue.push(node.left);
          if(node.right) queue.push(node.right);
       }
       console.log(` -&amp;gt;   BFS -&amp;gt; BREADTH FIRST SEARCH List is -&amp;gt; ${data}`);
       return data;
   }


    /* 

                        Example For DEPTH FIRST SEARCH List in PreOrder

                 Third -&amp;gt;         __10__
                                /        \  
                 Second -&amp;gt;     6         15
                              / \         \
                First -&amp;gt;     3   8        20

    */
   DSFPreOrder(){
       var data = [];
       function traverse(node) {
           data.push(node.value);
          if(node.left) traverse(node.left);
          if(node.right) traverse(node.right);
       }
       traverse(this.root);
       console.log(` -&amp;gt;   DSF -&amp;gt; Pre Order List is -&amp;gt; ${data}`)
       return data
   }

    /* 

                        Example For DEPTH FIRST SEARCH List in PostOrder

                      sixth -&amp;gt;    __10__
                                /        \  
                     Third -&amp;gt;  6         15 &amp;lt;- Fiveth
                              / \         \
                    First -&amp;gt; 3   8 &amp;lt;-     20 &amp;lt;- Fourth
                                    |
                            Second _|

    */
    DSFPostOrder() {
        var data = [];
        function traverse(node) {
          if(node.left) traverse(node.left);
          if(node.right) traverse(node.right);
          data.push(node.value);
        }
        traverse(this.root);
       console.log(` -&amp;gt;   DSF -&amp;gt; Post Order List is -&amp;gt; ${data}`)
        return data;
    }

    DSFinOrder() {
        var data = [];
        function traverse(node) {
          node.left &amp;amp;&amp;amp; traverse(node.left);
          data.push(node.value);
          node.right &amp;amp;&amp;amp; traverse(node.right);
        }
        traverse(this.root);
       console.log(` -&amp;gt;   DSF -&amp;gt; In Order List is -&amp;gt; ${data}`)
        return data;
    }
}

var tree = new BinarySearchTree();
tree.insert(10)
tree.insert(6)
tree.insert(15)
tree.insert(3)
tree.insert(8)
tree.insert(20)
console.log(" ");
tree.BFS()
tree.DSFPreOrder()
tree.DSFPostOrder()
tree.DSFinOrder()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>hacktoberfest</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Tree Traversal</title>
      <dc:creator>Aashish Panchal</dc:creator>
      <pubDate>Wed, 21 Oct 2020 09:45:26 +0000</pubDate>
      <link>https://dev.to/aashish578/tree-traversal-4naf</link>
      <guid>https://dev.to/aashish578/tree-traversal-4naf</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Node {
    constructor(value){
        this.value = value;
        this.left = null;
        this.right = null;
    }
}

class BinarySearchTree {
    constructor(){
        this.root = null;
    }
    insert(value){
        var newNode = new Node(value);
        if(this.root === null){
            this.root = newNode;
            return this;
        }
        var current = this.root;
        while(true){
            if(value === current.value) return undefined;
            if(value &amp;lt; current.value){
                if(current.left === null){
                    current.left = newNode;
                    return this;
                }
                current = current.left;
            } else {
                if(current.right === null){
                    current.right = newNode;
                    return this;
                } 
                current = current.right;
            }
        }
    }
    find(value){
        if(this.root === null) return false;
        var current = this.root,
            found = false;
        while(current &amp;amp;&amp;amp; !found){
            if(value &amp;lt; current.value){
                current = current.left;
            } else if(value &amp;gt; current.value){
                current = current.right;
            } else {
                found = true;
            }
        }
        if(!found) return undefined;
        return current;
    }
    contains(value){
        if(this.root === null) return false;
        var current = this.root,
            found = false;
        while(current &amp;amp;&amp;amp; !found){
            if(value &amp;lt; current.value){
                current = current.left;
            } else if(value &amp;gt; current.value){
                current = current.right;
            } else {
                return true;
            }
        }
        return false;
    }
    BFS(){
        var node = this.root,
            data = [],
            queue = [];
        queue.push(node);

        while(queue.length){
        node = queue.shift();
        data.push(node.value);
        if(node.left) queue.push(node.left);
        if(node.right) queue.push(node.right);
        }
        return data;
    }
    DFSPreOrder(){
        var data = [];
        function traverse(node){
            data.push(node.value);
            if(node.left) traverse(node.left);
            if(node.right) traverse(node.right);
        }
        traverse(this.root);
        return data;
    }
    DFSPostOrder(){
        var data = [];
        function traverse(node){
            if(node.left) traverse(node.left);
            if(node.right) traverse(node.right);
            data.push(node.value);
        }
        traverse(this.root);
        return data;
    }
    DFSInOrder(){
        var data = [];
        function traverse(node){
            if(node.left) traverse(node.left);
            data.push(node.value);
            if(node.right) traverse(node.right);
        }
        traverse(this.root);
        return data;
    }
}


var tree = new BinarySearchTree();
tree.insert(10);
tree.insert(6);
tree.insert(15);
tree.insert(3);
tree.insert(8);
tree.insert(20);
tree.DFSPreOrder();
tree.DFSPostOrder();
tree.DFSInOrder();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>hacktoberfest</category>
    </item>
    <item>
      <title>Binary Search Trees</title>
      <dc:creator>Aashish Panchal</dc:creator>
      <pubDate>Wed, 21 Oct 2020 09:20:32 +0000</pubDate>
      <link>https://dev.to/aashish578/binary-search-trees-47a2</link>
      <guid>https://dev.to/aashish578/binary-search-trees-47a2</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/* 

                    Example For Binary Search Tree
                              __10__
                            /        \  
                           5         13
                          / \       / \
                         2   7     11 16 
                        /\   \         \
                       1 3   9         18

*/

class Node {
    constructor(value){
        this.value = value;
        this.left = null;
        this.right = null;

    }
}
class BinarySearchTree {
    constructor(){
        this.root = null;
    }


    // Insert a New value in tree 
    insert(value) {
        var newNode = new Node(value);
        if(this.root === null) {
            this.root = newNode;
            return this;
        } else {
            var current = this.root;
            while(true) {
                if(value &amp;lt; current.value) {
                    if(current.left === null) {
                        current.left = newNode;
                        console.log(` -&amp;gt;   ${current.value}  left value -&amp;gt; ${value} added `)
                        return this;    
                    } else {
                        current = current.left;
                    }
                } else if(value &amp;gt; current.value) {
                    if (current.right === null) {
                        current.right = newNode;
                        console.log(` -&amp;gt;   ${current.value}  right value -&amp;gt; ${value} added `)
                        return this;
                    } else {
                        current = current.right;
                    }
                } 
                if(current.value == value) {
                    console.log(` -&amp;gt;  ${value} is  Duplicate value Please Enter Unique Value `)
                    return;
                }
            }
        }
    }

 // find The Value in tree
    find(value) {
           if(this.root === null) return false;
           var current = this.root,
               found = false;
           while(current &amp;amp;&amp;amp; !found) {
               if(value &amp;lt; current.value) {
                   current = current.left;
               } else if (value &amp;gt; current.value) {
                   current = current.right;
               } else {
                   console.log(`Founded Successfully -&amp;gt; ${value}`);
                   return current;
               }
           }
           if(!found) console.log(`Not Founded -&amp;gt; ${value}`);
           return current;
    }

 // Same as on find
    contains(value) {
       if(this.root === null) return false;
       var current = this.root,
           found = false;
       while(current &amp;amp;&amp;amp; !found) {
           if(value &amp;lt; current.value) {
               current = current.left;
           } else if (value &amp;gt; current.value) {
               current = current.right;
           } else {
               console.log(`Founded Successfully -&amp;gt; ${value}`);
               return current;
           }
       }
       if(!found) console.log(`Not Founded -&amp;gt; ${value}`);
       return current;
}
}

var tree = new BinarySearchTree();
tree.insert(10)
tree.insert(5)
tree.insert(13)
tree.insert(2)
tree.insert(7)
tree.insert(11)
tree.insert(16)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>hacktoberfest</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
