<?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: Samanvi Thota</title>
    <description>The latest articles on DEV Community by Samanvi Thota (@221910304050).</description>
    <link>https://dev.to/221910304050</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%2F626703%2F808c071a-a3ce-4e19-9b09-8e4762ca67be.png</url>
      <title>DEV Community: Samanvi Thota</title>
      <link>https://dev.to/221910304050</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/221910304050"/>
    <language>en</language>
    <item>
      <title>Creating of LinkedList</title>
      <dc:creator>Samanvi Thota</dc:creator>
      <pubDate>Sun, 17 Oct 2021 13:37:28 +0000</pubDate>
      <link>https://dev.to/221910304050/creating-of-linkedlist-54cg</link>
      <guid>https://dev.to/221910304050/creating-of-linkedlist-54cg</guid>
      <description>&lt;p&gt;The LinkedList class of the Java collections framework provides the functionality of the linked list data structure (doubly linkedlist).&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Each element in a linked list is known as a node. It consists of 3 fields:&lt;/em&gt;&lt;br&gt;
&lt;strong&gt;Prev -&lt;/strong&gt; stores an address of the previous element in the list. It is null for the first element&lt;br&gt;
&lt;strong&gt;Next -&lt;/strong&gt; stores an address of the next element in the list. It is null for the last element&lt;br&gt;
&lt;strong&gt;Data -&lt;/strong&gt; stores the actual data&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Syntax for creating a LinkedList:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;LinkedList&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Type&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;linkedList&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;LinkedList&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;gt;();&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Here, Type indicates the type of a linked list. For example,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="c1"&gt;// create Integer type linked list&lt;/span&gt;

&lt;span class="nc"&gt;LinkedList&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Integer&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;linkedList&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;LinkedList&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;gt;();&lt;/span&gt;

&lt;span class="c1"&gt;// create String type linked list&lt;/span&gt;

&lt;span class="nc"&gt;LinkedList&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;linkedList&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;LinkedList&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;gt;();&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Example Program to create LinkedList:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;java.util.LinkedList&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Main&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="o"&gt;){&lt;/span&gt;

    &lt;span class="c1"&gt;// create linkedlist&lt;/span&gt;
    &lt;span class="nc"&gt;LinkedList&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;animals&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;LinkedList&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;gt;();&lt;/span&gt;

    &lt;span class="c1"&gt;// Add elements to LinkedList&lt;/span&gt;
    &lt;span class="n"&gt;animals&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;add&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Dog"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;animals&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;add&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Cat"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;animals&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;add&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Parrot"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"LinkedList: "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;animals&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;OUTPUT:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;LinkedList: [Dog, Cat, Parrot]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>java</category>
      <category>linkedlist</category>
    </item>
    <item>
      <title>Performance Measurement</title>
      <dc:creator>Samanvi Thota</dc:creator>
      <pubDate>Thu, 06 May 2021 17:52:56 +0000</pubDate>
      <link>https://dev.to/221910304050/performance-measurement-4e53</link>
      <guid>https://dev.to/221910304050/performance-measurement-4e53</guid>
      <description>&lt;p&gt;&lt;strong&gt;Performance Measurement:&lt;/strong&gt; It is based on space and time requirements of a particular algorithm. These quantities depend on the compiler and options used, and the system on which the algorithm runs. The space and time needed for compilation are important during program testing. To obtain the run time of a program, we need a clocking procedure. We assume the existence of a program GetTime() that returns the current time in milliseconds.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Suppose if we want to measure the worst-case performance of the sequential search algorithm&lt;br&gt;
we need to follow these:&lt;br&gt;
1.decide on the values of n for which the times are to be obtained &lt;br&gt;
2.determine for each of the above values of the data that exhibit the worst-case behavior.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Algorithm:&lt;/strong&gt;&lt;br&gt;
SeqSearch(a,x,n)&lt;br&gt;
//search for x in a[1:n]. a[0] is used as additional space.&lt;br&gt;
{&lt;br&gt;
   i:=n; a[0] :=x;&lt;br&gt;
   while (a[i]=!x) do i := i-1;&lt;br&gt;
   return i;&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=I-vw0aIZ4FI"&gt;click here, for more detailed explanation with example&lt;/a&gt;&lt;/p&gt;

</description>
      <category>coding</category>
    </item>
  </channel>
</rss>
