<?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: phoebehala</title>
    <description>The latest articles on DEV Community by phoebehala (@phyuhala).</description>
    <link>https://dev.to/phyuhala</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%2F812220%2F0740472f-6786-4cb9-ac6a-19b925e1785c.png</url>
      <title>DEV Community: phoebehala</title>
      <link>https://dev.to/phyuhala</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/phyuhala"/>
    <language>en</language>
    <item>
      <title>To collaborate on GitHub by fork</title>
      <dc:creator>phoebehala</dc:creator>
      <pubDate>Wed, 20 Apr 2022 06:56:17 +0000</pubDate>
      <link>https://dev.to/phyuhala/to-collaborate-on-github-by-fork-33h1</link>
      <guid>https://dev.to/phyuhala/to-collaborate-on-github-by-fork-33h1</guid>
      <description>&lt;h2&gt;
  
  
  How we worked on the group project:
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Came up with ideas&lt;/li&gt;
&lt;li&gt;Talked about the structure and library we could use&lt;/li&gt;
&lt;li&gt;Set our goal: Leaning how to collaborate with Git by fork&lt;/li&gt;
&lt;li&gt;Learned and Practiced the workflow of GitHub fork&lt;/li&gt;
&lt;li&gt;Set a timeline and Used "Trello" to trace the progress&lt;/li&gt;
&lt;li&gt;Assigned tasks to each one&lt;/li&gt;
&lt;li&gt;Had several meeting to make sure everyone worked well and were on the same page&lt;/li&gt;
&lt;li&gt;Wrapped up&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Noted down the workflow of GitHub fork:
&lt;/h2&gt;

&lt;p&gt;Step 1. Fork the repo&lt;br&gt;
Step 2. Clone the forked Repository&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd folderName
git clone https://github.com/Your-GitHub-Username/github-practice
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;step 3. Create my feature branch&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git checkout -b myOwnBranchName
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;step 3.1 Work on my part and push to my remote repository&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git add . 
git commit -m “......”
git push origin myOwnBranchName(feature)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 4.1 Check if the develop branch has ever changed&lt;br&gt;
(Do it every time I resume my work)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git fetch upstream 
git checkout main
git merge upstream/develop
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fazjgfaya7smbei2wus1a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fazjgfaya7smbei2wus1a.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 4.2. Push to my own remote repository&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git push origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 5 Merge synchronized main to my local feature branch which I am currently working on&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git switch(or checkout) yourOwnBranchName(feature)
git merge main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;if merge conflict happens, go step6. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Step 6. Manage the conflict &lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa048oj77xx0ja72janwx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa048oj77xx0ja72janwx.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;step 6.1. Send a pull request&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3779mud21a12u0q02v0y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3779mud21a12u0q02v0y.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;step 7. Push to my own remote repository after merge&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git push origin myOwnBranchName(feature)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Stacks and Queues</title>
      <dc:creator>phoebehala</dc:creator>
      <pubDate>Wed, 23 Feb 2022 07:26:05 +0000</pubDate>
      <link>https://dev.to/phyuhala/stacks-and-queues-ik3</link>
      <guid>https://dev.to/phyuhala/stacks-and-queues-ik3</guid>
      <description>&lt;h2&gt;
  
  
  Stack
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;LIFO = "last in first out"&lt;/strong&gt;&lt;br&gt;
Examine the item most recently added.&lt;br&gt;
&lt;code&gt;push()&lt;/code&gt;&lt;br&gt;
&lt;code&gt;pop()&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  implementation -How it works in linked-list
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;inner class
private class Node
{
 String item;
 Node next;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/* === pop() === */
String item = first.item;
first = first.next;   //delete first node
return item;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/* === push() === */
Node oldfirst = first;
first = new Node();
first.item = "not";
first.next = oldfirst;

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Queue
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;FIFO = "first in first out"&lt;/strong&gt;&lt;br&gt;
Examine the item least recently added.&lt;br&gt;
&lt;code&gt;enqueue()&lt;/code&gt;&lt;br&gt;
&lt;code&gt;dequeue()&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  implementation -How it works in linked-list
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;inner class
private class Node
{
 String item;
 Node next;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/* === dequeue() === */
String item = first.item;
first = first.next;   //delete first node
return item;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/* === enqueue() === */
Node oldlast = last;
//create a new node for the end
last = new Node();
last.item = "not";
//link the new node to the end of the list
oldlast.next = last;

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

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>UNION-FIND</title>
      <dc:creator>phoebehala</dc:creator>
      <pubDate>Wed, 09 Feb 2022 16:31:17 +0000</pubDate>
      <link>https://dev.to/phyuhala/quick-find-njf</link>
      <guid>https://dev.to/phyuhala/quick-find-njf</guid>
      <description>&lt;h2&gt;
  
  
  Dynamic connectivity
&lt;/h2&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;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;&lt;u&gt;Connected components&lt;/u&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Maximal set of objects that are mutually
connected.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;connected(x,y)&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Find/connected query: is there a path connecting the two objects?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;union(x,y)&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Union command: connect two objects.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Quick-find
&lt;/h2&gt;

&lt;p&gt;is too slow for big problem&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;initialize: N&lt;/li&gt;
&lt;li&gt;union:  N&lt;/li&gt;
&lt;li&gt;find: 1&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;&lt;u&gt;find:&lt;/u&gt;&lt;/em&gt; Check if p and q have the same id.&lt;br&gt;
Number of array accesses (for read or write):            &lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;u&gt;Union:&lt;/u&gt;&lt;/em&gt; To merge components containing p and q, change all entries whose id equals id[p] to id[q].&lt;br&gt;
It takes &lt;strong&gt;N^2&lt;/strong&gt; array accesses to process a sequence of N union commands on N objects.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The maximum number of #id[] array entries that can change (from one value to a different value) during one call to union when using the quick-find data structure on n elements is &lt;strong&gt;n&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Quick-Union
&lt;/h2&gt;

&lt;p&gt;is also slow&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;initialize: N&lt;/li&gt;
&lt;li&gt;union:  N (includes cost of finding roots)&lt;/li&gt;
&lt;li&gt;find: &lt;strong&gt;N&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;&lt;u&gt;find:&lt;/u&gt;&lt;/em&gt; Check if p and q have the same &lt;strong&gt;root&lt;/strong&gt;&lt;br&gt;
Number of array accesses (for read or write):            &lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;u&gt;Union:&lt;/u&gt;&lt;/em&gt; To merge components containing p and q,&lt;br&gt;
set the id of p's &lt;strong&gt;root&lt;/strong&gt; to the id of q's &lt;strong&gt;root&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Weighted quick-union: (Improvement 1)
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;&lt;u&gt;find:&lt;/u&gt;_Check if p and q have the same &lt;strong&gt;root&lt;/strong&gt; (Identical to quick-union)&lt;br&gt;
_&lt;u&gt;Union:&lt;/u&gt;&lt;/em&gt; Modify quick-union to:&lt;br&gt;
・&lt;strong&gt;Link root of smaller tree to root of larger tree.&lt;/strong&gt;&lt;br&gt;
・Update the sz[] array.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;KEY POINT:&lt;br&gt;
Increases by 1 when tree T1 containing x is merged into another tree T2.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The size of the tree containing x at least doubles since | T 2 | ≥ | T 1 |.&lt;/li&gt;
&lt;li&gt;Size of tree containing x can double at most lg N times.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;initialize: N&lt;/li&gt;
&lt;li&gt;union:  N (includes cost of finding roots)&lt;/li&gt;
&lt;li&gt;find: &lt;strong&gt;lgN&lt;/strong&gt; (lg = base-2 logarithm)&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
  </channel>
</rss>
