<?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: preyas prathap</title>
    <description>The latest articles on DEV Community by preyas prathap (@preyasprathap).</description>
    <link>https://dev.to/preyasprathap</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%2F115257%2F2fc84701-2a27-439b-a9e9-6d971c0085bd.jpg</url>
      <title>DEV Community: preyas prathap</title>
      <link>https://dev.to/preyasprathap</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/preyasprathap"/>
    <language>en</language>
    <item>
      <title>Write a Python program to implement breadth-first search.</title>
      <dc:creator>preyas prathap</dc:creator>
      <pubDate>Tue, 29 Apr 2025 07:17:21 +0000</pubDate>
      <link>https://dev.to/preyasprathap/write-a-python-program-to-implement-breadth-first-search-c1e</link>
      <guid>https://dev.to/preyasprathap/write-a-python-program-to-implement-breadth-first-search-c1e</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from collections import deque

class Graph:
    def __init__(self):
        self.adjacency_list = {}

    def add_edge(self, u, v):
        # Add an edge from u to v (assuming a directed graph)
        if u not in self.adjacency_list:
            self.adjacency_list[u] = []
        self.adjacency_list[u].append(v)

    def bfs(self, start_vertex):
        visited = set()
        queue = deque()

        visited.add(start_vertex)
        queue.append(start_vertex)

        while queue:
            current_vertex = queue.popleft()
            print(current_vertex, end=' ')

            for neighbor in self.adjacency_list.get(current_vertex, []):
                if neighbor not in visited:
                    visited.add(neighbor)
                    queue.append(neighbor)

# Example usage
if __name__ == "__main__":
    g = Graph()
    g.add_edge(1, 2)
    g.add_edge(1, 3)
    g.add_edge(2, 4)
    g.add_edge(2, 5)
    g.add_edge(3, 6)
    g.add_edge(5, 6)

    print("Breadth First Traversal starting from vertex 1:")
    g.bfs(1)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>python</category>
      <category>programming</category>
      <category>tutorial</category>
      <category>learning</category>
    </item>
    <item>
      <title>Define Integrity in the context of Network Security</title>
      <dc:creator>preyas prathap</dc:creator>
      <pubDate>Thu, 15 Jun 2023 20:01:39 +0000</pubDate>
      <link>https://dev.to/preyasprathap/define-integrity-in-the-context-of-network-security-46h6</link>
      <guid>https://dev.to/preyasprathap/define-integrity-in-the-context-of-network-security-46h6</guid>
      <description>&lt;p&gt;In the context of network security, integrity refers to the assurance that data remains unchanged and uncorrupted during transit or storage. It ensures that the information sent or received has not been tampered with, altered, or modified in any unauthorized manner.&lt;/p&gt;

&lt;p&gt;Maintaining data integrity is crucial in network security to ensure the accuracy, reliability, and trustworthiness of information. Data integrity protects against various threats, such as unauthorized modifications, data corruption, or malicious alterations that could lead to data loss, unauthorized access, or false information.&lt;/p&gt;

&lt;p&gt;To ensure data integrity, cryptographic techniques are commonly employed. These techniques involve the use of algorithms and mechanisms that generate digital signatures or message digests, which are unique representations of the data. By comparing the generated signatures or digests at the receiving end with the original ones, one can verify the integrity of the data.&lt;/p&gt;

&lt;p&gt;Some commonly used methods to ensure data integrity include:&lt;/p&gt;

&lt;p&gt;Hash Functions: Hash functions generate a fixed-size unique hash value (digest) based on the input data. Even a small change in the input data will produce a different hash value. By comparing the hash values of the transmitted data and the original data, integrity can be verified.&lt;/p&gt;

&lt;p&gt;Message Authentication Codes (MAC): MACs use symmetric cryptographic algorithms to generate a unique tag or code that verifies the integrity and authenticity of the data. This tag is generated using a shared secret key that is known only to the sender and receiver.&lt;/p&gt;

&lt;p&gt;Digital Signatures: Digital signatures use asymmetric cryptographic algorithms to provide integrity and authenticity. The sender uses their private key to sign the data, and the receiver can use the sender's public key to verify the signature. If the signature is valid, it ensures the integrity and authenticity of the data.&lt;/p&gt;

&lt;p&gt;By implementing these integrity mechanisms, network security can be strengthened, ensuring that data remains intact, trustworthy, and unaltered throughout its transmission and storage.&lt;/p&gt;

</description>
      <category>network</category>
      <category>interview</category>
      <category>tutorial</category>
      <category>chatgpt</category>
    </item>
    <item>
      <title>Create Phone Number using JS , Codewars Solution</title>
      <dc:creator>preyas prathap</dc:creator>
      <pubDate>Fri, 01 Oct 2021 19:22:58 +0000</pubDate>
      <link>https://dev.to/preyasprathap/create-phone-number-using-js-codewars-solution-1a</link>
      <guid>https://dev.to/preyasprathap/create-phone-number-using-js-codewars-solution-1a</guid>
      <description>&lt;p&gt;Recently I've been trying out some questions for improving my JS Skills. So I thought I will document some of that here.&lt;/p&gt;

&lt;p&gt;Codewars Link : &lt;a href="https://www.codewars.com/kata/525f50e3b73515a6db000b83"&gt;https://www.codewars.com/kata/525f50e3b73515a6db000b83&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Write a function that accepts an array of 10 integers (between 0 and 9), that returns a string of those numbers in the form of a phone number.&lt;/p&gt;

&lt;h2&gt;
  
  
  Example
&lt;/h2&gt;



&lt;p&gt;&lt;code&gt;createPhoneNumber([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]) // =&amp;gt; returns "(123) 456-7890"&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  My Solution
&lt;/h2&gt;



&lt;p&gt;&lt;code&gt;function createPhoneNumber(numbers){&lt;br&gt;
      return numbers.join('').replace(/(...)(...)(.*)/,'($1) $2-$3');&lt;br&gt;
}&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;em&gt;The Regex Part&lt;/em&gt;
&lt;/h2&gt;

&lt;p&gt;/ / - tells that it's a regex&lt;br&gt;
(...) - substring that contains 3 numbers&lt;br&gt;
(.*) - extra numbers&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>regex</category>
      <category>arrays</category>
    </item>
  </channel>
</rss>
