<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>yuni.log</title>
        <link>https://velog.io/</link>
        <description>..</description>
        <lastBuildDate>Thu, 12 May 2022 09:32:05 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <image>
            <title>yuni.log</title>
            <url>https://images.velog.io/images/yeonhee-7935/profile/645ef996-a52b-46f3-8044-3a8ea4d7bd0f/social.png</url>
            <link>https://velog.io/</link>
        </image>
        <copyright>Copyright (C) 2019. yuni.log. All rights reserved.</copyright>
        <atom:link href="https://v2.velog.io/rss/yeonhee-7935" rel="self" type="application/rss+xml"/>
        <item>
            <title><![CDATA[[Python] Generator 함수]]></title>
            <link>https://velog.io/@yeonhee-7935/Python-Generator</link>
            <guid>https://velog.io/@yeonhee-7935/Python-Generator</guid>
            <pubDate>Thu, 12 May 2022 09:32:05 GMT</pubDate>
            <description><![CDATA[<h3 id="❓-generator-함수">❓ Generator 함수</h3>
<ul>
<li>iterator를 생성해주는 함수</li>
<li>yield 키워드를 사용</li>
<li>next(제너레이터함수]) : </li>
<li>예시<pre><code class="language-python">def generator():
  yield 1 
  yield 2
  yield 3
</code></pre>
</li>
</ul>
<p>for g in generator():
    print(g)</p>
<p>```</p>
]]></description>
        </item>
        <item>
            <title><![CDATA[[Spring] Spring security + JWT로 회원가입,로그인 구현하기]]></title>
            <link>https://velog.io/@yeonhee-7935/Spring-Spring-security-JWT%EB%A1%9C-%ED%9A%8C%EC%9B%90%EA%B0%80%EC%9E%85%EB%A1%9C%EA%B7%B8%EC%9D%B8-%EA%B5%AC%ED%98%84%ED%95%98%EA%B8%B0</link>
            <guid>https://velog.io/@yeonhee-7935/Spring-Spring-security-JWT%EB%A1%9C-%ED%9A%8C%EC%9B%90%EA%B0%80%EC%9E%85%EB%A1%9C%EA%B7%B8%EC%9D%B8-%EA%B5%AC%ED%98%84%ED%95%98%EA%B8%B0</guid>
            <pubDate>Mon, 25 Apr 2022 05:55:16 GMT</pubDate>
            <description><![CDATA[<h2 id="jwt">JWT</h2>
<h3 id="🔑-hasrole-vs-hasauthority">🔑 hasRole() vs hasAuthority()</h3>
<hr>
<ul>
<li><p>antMathchers(&quot;URL패턴&quot;).hasRole(role:String)</p>
<ul>
<li>자동으로 ROLE_ 접두어를 붙인 이름으로 사용자의 권한을 검색한다.</li>
<li>따라서 권한 이름을 &quot;ROLE_ADMIN&quot;과 같이 저장해야 한다.</li>
</ul>
</li>
<li><p>hasAuthority(role:String)</p>
<ul>
<li>파라미터 그대로의 이름으로 사용자의 권한을 검색한다.</li>
</ul>
</li>
</ul>
]]></description>
        </item>
        <item>
            <title><![CDATA[[Algorithm] 3진법 뒤집기]]></title>
            <link>https://velog.io/@yeonhee-7935/Algorithm-3%EC%A7%84%EB%B2%95-%EB%92%A4%EC%A7%91%EA%B8%B0</link>
            <guid>https://velog.io/@yeonhee-7935/Algorithm-3%EC%A7%84%EB%B2%95-%EB%92%A4%EC%A7%91%EA%B8%B0</guid>
            <pubDate>Sat, 23 Apr 2022 03:35:31 GMT</pubDate>
            <description><![CDATA[<h3 id="🔑진법-변환">🔑진법 변환</h3>
<ul>
<li>n진수 -&gt; 10진수<pre><code class="language-python"># int(string, base)
print(int(&#39;101&#39;,2))
print(int(&#39;202&#39;,3))
</code></pre>
</li>
</ul>
<pre><code>&gt; 5
&gt; 20

*  10진수 -&gt; 2,6,8 진수(str)

```python

# bin(10진수) : 10=&gt;2
print(bin(13))
# oct(10진수) : 10=&gt;8
print(oct(13))
# hex(10진수) : 10=&gt;16
print(hex(13))
</code></pre><blockquote>
<p>0b1101
  0o15
  0xd</p>
</blockquote>
]]></description>
        </item>
        <item>
            <title><![CDATA[[Algorithm] 프로그래머스 | 숫자 문자열과 영단어]]></title>
            <link>https://velog.io/@yeonhee-7935/Algorithm-%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%98%EB%A8%B8%EC%8A%A4-%EC%88%AB%EC%9E%90-%EB%AC%B8%EC%9E%90%EC%97%B4%EA%B3%BC-%EC%98%81%EB%8B%A8%EC%96%B4</link>
            <guid>https://velog.io/@yeonhee-7935/Algorithm-%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%98%EB%A8%B8%EC%8A%A4-%EC%88%AB%EC%9E%90-%EB%AC%B8%EC%9E%90%EC%97%B4%EA%B3%BC-%EC%98%81%EB%8B%A8%EC%96%B4</guid>
            <pubDate>Wed, 13 Apr 2022 12:25:40 GMT</pubDate>
            <description><![CDATA[<h3 id="문제-설명">문제 설명</h3>
<hr>
<ul>
<li>영단어와 숫자로 구성된 문자열을 모두 숫자로 바꾸는 문제</li>
<li>ex) &quot;1foureight5seven&quot; -&gt; 14857<h3 id="🎇-나의-solution">🎇 나의 solution</h3>
</li>
</ul>
<hr>
<pre><code class="language-python">numStr=[&#39;zero&#39;, &#39;one&#39;,&#39;two&#39;,&#39;three&#39;,&#39;four&#39;,&#39;five&#39;,
        &#39;six&#39;,&#39;seven&#39;,&#39;eight&#39;,&#39;nine&#39;]

def str2numStr(s):
    result=0
    for i in range(len(numStr)):
        if s == numStr[i]:
            result=i
            break
    return str(result)


def is_str_digit(str):
    if str in numStr:
        return True
    else:
        return False


def solution(str):
    answer = []
    temp = []
    for i  in range(len(str)):
        if str[i].isdigit():
            if i&gt;0 and temp:
                target = &#39;&#39;.join(temp)
                answer.append(str2numStr(target))
                temp=[]
            answer.append(str[i])

        else :
            target = &#39;&#39;.join(temp)
            if is_str_digit(target):
                temp = []
                temp.append(str[i])
                answer.append(str2numStr(target))
            else:
                temp.append(str[i])

    if temp :
        target = str2numStr(&#39;&#39;.join(temp))
        answer.append(target)
    return int(&#39;&#39;.join(answer))</code></pre>
<ul>
<li><p>문자 하나하나가 숫자를 나타내는지 확인해서 맞으면 숫자로 변환함</p>
</li>
<li><p>문자와 숫자 쌍을 나타낸 딕셔너리를 기준으로 문자열을 치환하는 것이 핵심인데, 핵심을 놓친 것 같다..</p>
<pre><code class="language-python">🔑 모범 답안
def solution(str):
  answer =&#39;&#39;
 dic = {&quot;zero&quot;:0, &quot;one&quot;:1, &quot;two&quot;:2, &quot;three&quot;:3, &quot;four&quot;:4,
           &quot;five&quot;:5, &quot;six&quot;:6, &quot;seven&quot;:7, &quot;eight&quot;:8, &quot;nine&quot;:9}
 for key, value in dic:
     answer = answer.replace(key,value)
 return answer</code></pre>
<h3 id="🔑-strreplaceold_word-new_word-count">🔑 str.replace(old_word, new_word, count)</h3>
</li>
</ul>
<hr>
<ul>
<li>문자열 내에 old_word와 일치하는 문자열를 new_word로 바꾼다.</li>
<li>앞에서부터 count 만큼 (default 일치하는 단어 전부)</li>
<li>단, 원본 문자열은 그대로, 새로운 문자열을 반환</li>
</ul>
<h3 id="🔑-str-object-is-not-callable">🔑 &#39;str&#39; object is not callable</h3>
<hr>
<ul>
<li>str이라는 변수를 정의한 후 str() 함수를 사용하려고 한 경우에 발생하는 에러</li>
<li>예시<pre><code class="language-python"></code></pre>
</li>
</ul>
<p>def xxx(str): # 매개변수도 str
    temp = str(1) # string 형변환 함수도 str
    ... 
```</p>
]]></description>
        </item>
        <item>
            <title><![CDATA[[Algorithm] 신규 아이디 추천 | 프로그래머스]]></title>
            <link>https://velog.io/@yeonhee-7935/Algorithm-%EC%8B%A0%EA%B7%9C-%EC%95%84%EC%9D%B4%EB%94%94-%EC%B6%94%EC%B2%9C-%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%98%EB%A8%B8%EC%8A%A4</link>
            <guid>https://velog.io/@yeonhee-7935/Algorithm-%EC%8B%A0%EA%B7%9C-%EC%95%84%EC%9D%B4%EB%94%94-%EC%B6%94%EC%B2%9C-%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%98%EB%A8%B8%EC%8A%A4</guid>
            <pubDate>Tue, 05 Apr 2022 03:59:19 GMT</pubDate>
            <description><![CDATA[<h3 id="문제-설명">문제 설명</h3>
<hr>
<p>주어진 문자열을 규칙에 맞게 변환하시오</p>
<ol>
<li>대문자 -&gt; 소문자</li>
<li>소문자, 숫자, &#39;_&#39;, &#39;.&#39;, &#39;-&#39; 제외한 문자는 제거</li>
<li>..-&gt;.</li>
<li>처음, 끝에 위치한 .는 제거</li>
<li>빈문자열 = &#39;a&#39;</li>
<li>최대 길이 15자<ul>
<li>16자 이상인 경우 첫 15문자 제외한 나머지 문자를 제거</li>
<li>제거 후 끝에 위치한 . 제거</li>
</ul>
</li>
<li>길이 2이하인 경우, 마지막 문자를 길이 3이 될 때까지 덧붙이기</li>
</ol>
<h3 id="🎇-나의-solution">🎇 나의 solution</h3>
<hr>
<pre><code class="language-python">def solution(new_id):
    answer = &#39;&#39;
    # 1. 대문자 -&gt; 소문자
    new_id = new_id.lower()
    # 2. 소문자, 숫자, _, ., - 제외한 문자 제거
    for char in new_id : 
        if char.isalnum() or char in &#39;_.-&#39;:
            answer += char
    # 3. .. -&gt; .
    while &#39;..&#39; in answer : # 🔑&#39;..&#39;이 존재하지 않을 때까지 제거  
        answer = answer.replace(&#39;..&#39;,&#39;.&#39;)
    # 4. 처음, 끝에 위치한 . 제거
    answer= answer.strip(&#39;.&#39;)
    # 5. 빈문자열 = &#39;a&#39;
    answer = &#39;a&#39; if answer == &#39;&#39; else answer
    # 6. 최대 길이 15자, 끝에 위치한 . 제거
    if len(answer) &gt; 15:
        answer = answer[:15]
        answer = answer.rstrip(&#39;.&#39;)
    # 7. 길이 2 이하인 경우 3이 될때까지 맨 마지막 글자 추가
    answer += answer[-1]*(3-len(answer))

    return answer</code></pre>
<h3 id="🔑-문자열에서-특정-문자를-제거하는-방법">🔑 문자열에서 특정 문자를 제거하는 방법</h3>
<hr>
<ol>
<li>replace(대상 문자열, 바뀔 문자열) # 원본 문자열이 바뀌는 것 x <pre><code class="language-python">text = &#39;aaa&#39;
text = text.replace(&#39;a&#39;,&#39;&#39;) 
print(text) # &#39;aaa&#39; -&gt; &#39;&#39;</code></pre>
</li>
<li>strip(대상 문자열) # 처음, 끝에서 일치하는 문자열 제거</li>
<li>해당 문자를 제외한 나머지 문자들을 차례로 새로운 변수에 저장 🔑<pre><code class="language-python"># .과 &amp;을 제외한 특수문자들을 지워야할 때
text = &#39;=ab.,d&amp;=&#39;
answer =&#39;&#39;
for char in text :
 if char.isalnum() or word in &#39;.&amp;&#39;:
     answer += char
print(answer) # =&#39;ab.,d&amp;=&#39; -&gt; &#39;ab.d&amp;&#39;</code></pre>
</li>
</ol>
<h3 id="🔑-문자열-관련-함수">🔑 문자열 관련 함수</h3>
<hr>
<ul>
<li>문자열.strip() 
: 처음, 끝에서 매개변수로 주어진 문자열과 일치하는 문자열 제거 </li>
<li>문자.isalnum()
: 해당 문자가 숫자 혹은 알파벳인 경우 True 반환</li>
<li>문자열.lower()
: 소문자로 치환</li>
</ul>
]]></description>
        </item>
        <item>
            <title><![CDATA[[React] React 문법 정리]]></title>
            <link>https://velog.io/@yeonhee-7935/React-React-%EB%AC%B8%EB%B2%95-%EC%A0%95%EB%A6%AC</link>
            <guid>https://velog.io/@yeonhee-7935/React-React-%EB%AC%B8%EB%B2%95-%EC%A0%95%EB%A6%AC</guid>
            <pubDate>Wed, 16 Mar 2022 05:10:21 GMT</pubDate>
            <description><![CDATA[<h3 id="외부-컴포넌트에서-특정-컴포넌트가-상위에-오도록하는-방법">외부 컴포넌트에서 특정 컴포넌트가 상위에 오도록하는 방법(?)</h3>
<pre><code class="language-javascript">const App = ()=&gt;{
    return (
        &lt;Hello&gt;
              &lt;div&gt;Hello&lt;/div&gt;
          &lt;/Hello&gt;
    )
}

const Hello = ({children})=&gt;{
    return (
          &lt;div&gt;
              {children}
          &lt;/div&gt;
    )
}

</code></pre>
<h3 id="비구조화-할당">비구조화 할당</h3>
<h3 id="함수형-업데이트">함수형 업데이트</h3>
<ul>
<li>useState의 setter함수에 함수를 인자로 주는 것</li>
<li>컴포넌트 최적회에 사용</li>
</ul>
<h3 id="input이-여러-개일-때">input이 여러 개일 때</h3>
<ul>
<li>각 input에 useState를 정의하면 비효율적!</li>
<li>비구조화 할당을 이용해 하나의 변수로 취급(?)<pre><code class="language-javascript">const [inputs, setInputs] = useState({
  firstName : &#39;&#39;,
    lastName  : &#39;&#39;,
})
</code></pre>
</li>
</ul>
<p>/* React에서 객체를 수정할 때,
객체를 그대로 수정하면 안됨.
새로운 객체를 할당하고 
*/
const onReset = ()=&gt;{
    setInputs({
        firstName : &#39;&#39;,
          lastName  : &#39;&#39;,
    })
}</p>
<p>/*
{value, name} == e.target
value : 값
name : input 태그의 name
*/
const onChange = ({value, name})=&gt;{ 
      setInputs({
        ...inputs,
          [name] : value,
    })
}</p>
<p>```</p>
<h3 id="useref">useRef</h3>
<ul>
<li>특정 DOM을 사용해야 할 때 쓰는 hook</li>
<li>컴포넌트 내에서 사용하는 변수를 정의할 때
(단 ref변수 수정 시에는 reload되지 않음)</li>
<li>클래스형 컴포넌트에서는 <strong>React.createRef</strong>를 사용한다.</li>
<li>태그에 ref 속성 정의</li>
<li>ref 변수에 든 값을 조회할 때는 <strong>ref변수.current</strong></li>
</ul>
<h3 id="배열map원소--새로운-컴포넌트">배열.map(원소 =&gt; 새로운 컴포넌트)</h3>
<ul>
<li>map으로 배열을 렌더링할 때 key값이 필요한 이유</li>
<li>key값이 존재하지 않으면 원소 업데이트 비효율적으로 동작함
(덮어쓰기 방식)</li>
</ul>
]]></description>
        </item>
        <item>
            <title><![CDATA[[Java] builder-pattern]]></title>
            <link>https://velog.io/@yeonhee-7935/Java-build-pattern</link>
            <guid>https://velog.io/@yeonhee-7935/Java-build-pattern</guid>
            <pubDate>Sat, 12 Mar 2022 06:00:48 GMT</pubDate>
            <description><![CDATA[<h3 id="객체-생성-패턴-종류">객체 생성 패턴 종류</h3>
<hr>
<ol>
<li>생성자, 수정자 패턴</li>
<li>정적 메소드 패턴</li>
<li>빌더 패턴(lombok 이용)</li>
</ol>
<br>

<h3 id="builder-pattern">builder pattern</h3>
<ul>
<li><p>기존 )</p>
<ul>
<li>필요한 매개변수 종류별로 생성자 만들어야 했음</li>
<li>생성자 사용 시 파라미터 순서 지켜야 함</li>
<li>setter로 인해 객체 불변성이 깨진다 -&gt; 변경 가능성 존재</li>
</ul>
</li>
<li><p>빌더패턴 이용 시)</p>
<ul>
<li>불필요한 <strong>생성자 제거</strong>할 수 있음</li>
<li><strong>데이터의 입력 순서 지킬 필요 없음</strong></li>
<li><strong>롬복(lombok)</strong>을 이용하면 생성자클래스를 따로 정의하지 않아도 됨</li>
<li><strong>가독성</strong>이 높아짐</li>
</ul>
</li>
<li><p>예시</p>
<pre><code class="language-java">// lombok을 이용하지 않는 경우
</code></pre>
</li>
</ul>
<p>public class User{
    private Long id;
    private String name;
    private String address;</p>
<pre><code>getter/setter/생성자 정의</code></pre><p>}</p>
<p>public class UserBuilder{</p>
<pre><code>private Long id;
private String name;
private String address;

UserBuilder setId(Long id){
    this.id=id;
    return this;
}
UserBuilder setId(String name){
    this.name=name;
    return this;
}
UserBuilder setAddress(Address address){
    this.address=address;
    return this;
}
User build(){
    return new User(id,name,address);
}</code></pre><p>}</p>
<p>public static void main(String[] args){
    UserBuilder userBuilder = new UserBuilder();
    User userInfo = userBuilder.build()
                                .setId(1)
                                .setName(&quot;name1&quot;)
                                .setAddress(&quot;address1&quot;)
}</p>
<pre><code>
```java
// lombok을 이용하는 경우
import lombok.Builder;
import lombok.Data;

@Data
@Builder
public class User{
    private Long id;
    private String name;
    private String address;
}

public static void main(String[] args){
    User user = User.builder()
                    .id(1)
                    .name(&quot;name1&quot;)
                    .address(&quot;address1&quot;)
}</code></pre>]]></description>
        </item>
        <item>
            <title><![CDATA[[Algorithm] 정렬 알고리즘]]></title>
            <link>https://velog.io/@yeonhee-7935/%EC%95%8C%EA%B3%A0%EB%A6%AC%EC%A6%98-%EC%A0%95%EB%A0%AC-%EC%95%8C%EA%B3%A0%EB%A6%AC%EC%A6%98</link>
            <guid>https://velog.io/@yeonhee-7935/%EC%95%8C%EA%B3%A0%EB%A6%AC%EC%A6%98-%EC%A0%95%EB%A0%AC-%EC%95%8C%EA%B3%A0%EB%A6%AC%EC%A6%98</guid>
            <pubDate>Wed, 02 Mar 2022 15:27:58 GMT</pubDate>
            <description><![CDATA[<h3 id="❗-stable-vs-not-stable">❗ Stable vs Not Stable</h3>
<ul>
<li>Stable 정렬 알고리즘 : 중복된 값에 대해 순서대로 정렬하는 알고리즘</li>
<li>Not Stable 정렬 알고리즘 (stable의 반대)</li>
</ul>
<br>

<h3 id="1-버블-정렬">1. 버블 정렬</h3>
<ul>
<li>배열에서 이웃한 두 원소를 비교한다.</li>
<li>두 원소 중 더 큰 값이 뒤에 오도록 한다.</li>
<li>맨 뒤쪽부터 정렬된다.</li>
<li>stable 정렬 : 앞 원소가 큰 경우에만 swap을 진행하기 때문이다.</li>
<li><strong>O(N^2)</strong><pre><code class="language-python">def swap(arr, i, j):
  temp = arr[i]
  arr[i] = arr[j]
  arr[j] = temp

</code></pre>
</li>
</ul>
<p>def bubble_sort(list) :
    for i in range(list(len)):
        for j in range(len(list)-i-1):
            if list[j] &gt; list[j+1]: 
                swap(list,j,j+1) #뒤에 오는 원소가 더 크도록 위치 교환</p>
<pre><code>---
### 2. 선택정렬
- 구현 방법
  1. 정렬대상 배열에서의 최소값을 결과 배열에 옮기는 과정을 반복한다.
      -&gt; 추가의 메모리(배열)가 필요하다.
  2. 정렬되지 않은 부분에서 최솟값을 찾고,
정렬되지 않은 부분의 맨 앞 원소와 위치를 바꾼다.(1 개선)
- 맨 앞쪽부터 정렬된다.
- stable : 앞쪽부터 최소 원소를 찾고, 앞쪽부터 정렬되기 때문이다.
- __O(n^2)__
```python
# 개선된 선택정렬
def select_sort(list) :
    for i in range(len(list)):
        min_idx = i
        for j in range(i+1,len(list)):
            if list[j] &lt; list[min_idx]:
                min_idx = j
        swap(list,i,min_idx) # 버블정렬에서 사용된 swap 사용
</code></pre><hr>
<h3 id="3-삽입정렬">3. 삽입정렬</h3>
<ul>
<li>정렬되지 않은 부분의 첫번째 원소를 정렬된 부분의 적절한 위치에 삽입한다.</li>
<li>정렬된 부분의 원소가 더 큰 경우 뒤로 한 칸씩 밀어내, 정렬대상 원소의 자리를 마련한다.(정렬대상 원소보다 작은 원소를 만날 때까지 반복)</li>
<li>stable : 정렬된 부분의 원소가 같은 경우 밀어내기를 진행하지 않기 때문이다.</li>
<li><strong>O(N^2)</strong><pre><code class="language-python">def insert_sort(list):
  for i in range(1,len(list)):
      target = list[i] # 삽입할 원소
      for j in range(i-1,-1,-1):
          if list[j] &gt; target :
              list[j+1]=list[j]
          else :
              list[j+1] = target</code></pre>
</li>
</ul>
<hr>
<h3 id="4-힙정렬">4. 힙정렬</h3>
<ul>
<li>힙 자료구조를 이용한다.</li>
<li>정렬 수행 순서 (오름차순 기준, 1번 인덱스가 최소값)
1) 최소힙 구성
2) 최소값을 배열의 맨 마지막에 놓는다.
3) 마지막 노드를 루트(인덱스 1)에 두고 1,2 수행(heap[:-i]에 대해)</li>
<li>not stable : 형제 노드가 동일한 경우 오른쪽 노드와 부모 노드를 교환하기 때문(아래 구현의 경우) </li>
</ul>
<pre><code class="language-python">def heapify(heap, index, heap_size):
    largest = index
    left_child_index = index*2
    right_child_index = index*2+1

    if (left_child_index &lt; heap_size) and (heap[largest] &gt; heap[left_child_index]) : #왼쪽 자식 노드가 존재하고, 부모 노드보다 작은 경우
        largest = left_child_index
     if (right_child_index &lt; heap_size) and (heap[largest] &gt; heap[right_child_index]) : #오른쪽 자식 노드가 존재하고, 부모 노드보다 작은 경우
        largest = right_child_index

      if index != largest : 
          heap[largest],heap[index] = heap[index],heap[largest] # 자식노드와 부모 노드를 교환한다.
          heapify(heap, largest, heap_size) # 자식노드를 루트노드로 하는 힙에 대해서 heapify를 수행한다.

def heap_sort(list):
    n = len(list)
    # 1. 최소힙 구성
    # 자식 노드를 갖는 마지막 노드부터 상향으로 heapify 진행한다.
    # 마지막 노드부터 수행하지 않아도 된다.
    for i in range(n//2-1,-1.-1):
        heapify(list, i, n) 


    for i in range(n-1,0,-1):    
        list[i], list[1] = list[1], list[i] # 2. 루트 노드와 마지막 노드의 값을 교환한다.
        heapify(list, 0, i) # 3. 나머지 배열에 대해 heapify 수행
</code></pre>
<h4 id="❓-힙">❓ 힙</h4>
<ul>
<li>완전 이진트리의 일종으로, 우선순위 큐를 위해 만들어진 자료구조</li>
<li>최댓값 or 최솟값을 빠르게 찾아내기 위한 자료구조</li>
<li>일종의 <strong>반정렬</strong>(느슨한 정렬 상태)를 유지한다.<ul>
<li>부모 노드는 자식 노드보다 우선순위가 높다.</li>
<li>형제 노드 간 우선순위는 정렬되어있지 않다.</li>
</ul>
</li>
<li>부모노드와 자식 노드의관계<ul>
<li>왼쪽 자식 노드의 인덱스   = (부모 노드의 인덱스)*2 </li>
<li>오른쪽 자식 노드의 인덱스 =  (부모 노드의 인덱스)*2+1</li>
</ul>
</li>
<li>힙의 삽입, 삭제<ul>
<li>삽입
  1) 완전 이진트리의 끝에 새로운 노드를 삽입한다.
2) 부모 노드와 비교해 우선순위가 높으면 부모 노드와 교환한다.
3) 2의 과정을 루트노드에 도달하거나 더 높은 우선순위 노드를 만날 때까지 반복한다.</li>
<li>삭제(루트노드 삭제)
1) 루트 노드를 삭제한다.
2) 마지막 노드를 루트 노드 위치로 옮긴다.
3) 우선순위가 높은 자식 노드와 비교하여 해당 노드가 우선순위가 낮으면 자식 노드와 교환한다.
4) 자식 노드가 없거나(리프 노드 도달) 우선순위가 높은 자식 노드를 발견하지 못할 때까지 3의 과정을 반복한다.</li>
</ul>
</li>
<li>참고 <a href="https://gmlwjd9405.github.io/2018/05/10/data-structure-heap.html">https://gmlwjd9405.github.io/2018/05/10/data-structure-heap.html</a></li>
</ul>
<h3 id="5-병합정렬">5. 병합정렬</h3>
<ul>
<li><p><strong>devide - conqure</strong>(분할 정복), <strong>재귀</strong></p>
</li>
<li><p>원소가 1개가 남을 때까지 분할하고, 분할된 두 배열을 합친다.</p>
</li>
<li><p>not stable : 아래 구현의 경우 그러하다</p>
</li>
<li><p><strong>O(NlogN)</strong></p>
<pre><code class="language-python">def merge_two_array(list, left, mid, right):
  temp_list=[]

  current_index = left
  left_index = left
  right_index = mid +1

  while (left_index &lt;= mid) and (right_index &lt;= right) :
      if list[left_index] &lt; list[right_index] :
          temp_list[current_index] = list[left_index]
          left_index += 1
      else :

      &quot;&quot;&quot;
      not stable인 이유 :
      두 배열의 비교 대상이 동일한 원소인 경우,
      뒤쪽 배열에 위치한 원소를 먼저 옮기기 때문이다.
      &quot;&quot;&quot;
          temp_list[current_index] = list[right_index]
          right_index += 1
      current_index += 1

  #왼쪽 원소 완전히 옮기기
  while (left_index &lt;= mid) : 
      temp_list[current_index] = list[left_index]
      left += 1
      current_index += 1

  #오른쪽 원소 완전히 옮기기    
  while (mid+1 &lt;= righ) : 
      temp_list[current_index] = list[right]
      right += 1
      current_index += 1

  #결과 배열로 원소 옮기기
  for i in range(len(list)):
      list[i] = temp_list[i]
</code></pre>
</li>
</ul>
<p>def merge_sort(list, left, right):
    if left &lt; right :
        # 정렬 대상 분할하기
        mid = (left+right)//2
        merge_sort(list,left,mid)
        merge_sort(list,mid+1,right)</p>
<pre><code>    # 정렬 대상 합치면서 정렬하기
    merge_two_array(list,left,mid,right)</code></pre><pre><code>
### 6. 퀵정렬
* __devide - conqure__(분할 정복), __재귀__
* 피벗(임의 위치의 기준값)을 기준으로 보다 작은 부분과 보다 큰 부분을 나눈다.
* 위 과정을 재귀적으로 수행해 정렬한다.
* 피벗의 값 or 정렬여부에 따라 시간복잡도가 달라진다.
* 프로그래밍 언어에서 기본으로 제공하는 정렬 함수의 경우 퀵정렬을 사용하는 경우가 많다.
* not stable : &#39;low &lt; high&#39;인 경우 먼저 나온 원소(low)가 high와 교환되어 뒤쪽으로 갈 수 있기 때문. 
* __O(NlogN)__ : 최악의 경우 N^2가 될 수도 있음
```python
&quot;&quot;&quot; 
 윤성우의 열혈 자료구조 ver 
- 분할하는 부분과 정렬하는 부분을 두 함수로 구분
&quot;&quot;&quot;
def partition(list,left,right):
    low  = left+1
    high = right

    while low &lt;= high :
        while (low &lt;= right) and (list[low] &lt;= list[left]) :
            low += 1
        while (left &lt;= high) and (list[high] &gt;= list[left]) :
            high -= 1
        if low &lt; high :
            swap(list,low,high)

    swap(list, left, high)
    return high

def quick_sort(list, left, right):
    if left &lt; right :
        pivot = partition(list, left, right)
        quick_sort(list,left, pivot-1)
        quick_sort(list,pivot+1,right)


</code></pre><pre><code class="language-python">&quot;&quot;&quot;
일반적으로 많이 쓰이는 ver
- 하나의 함수 안에서 분할, 정렬을 모두 수행
- 피벗을 기준으로 세 배열로 나눈 후 이를 합치는 방법으로 정렬을 수행
&quot;&quot;&quot;
def quick_sort(list) :
    if len(list) &lt;= 1:
        return list
    pivot = list[0] # 배열의 중간값을 사용해도 됨

    # 각각 피벗보다 크기가 작은, 같은, 큰, 원소를 저장하는 리스트를 의미함
    less_list =[]
    equal_list=[]
    greater_list = [] 

    for i in list : 
        if i &gt; pivot :
            greater_list.append(i)
        elif i == pivot :
            equal_list.append(i)
        else:
            less_list.append(i)

    return quick_sort(less_list) + equal_list + quick_sort(greater_list) 

</code></pre>
<h3 id="7-기수정렬">7. 기수정렬</h3>
<pre><code class="language-python"></code></pre>
<p>(모든 정렬은 오름차순 기준으로 설명함.)</p>
]]></description>
        </item>
        <item>
            <title><![CDATA[[알고리즘] 소수 판별]]></title>
            <link>https://velog.io/@yeonhee-7935/%EC%95%8C%EA%B3%A0%EB%A6%AC%EC%A6%98-%EC%86%8C%EC%88%98-%ED%8C%90%EB%B3%84</link>
            <guid>https://velog.io/@yeonhee-7935/%EC%95%8C%EA%B3%A0%EB%A6%AC%EC%A6%98-%EC%86%8C%EC%88%98-%ED%8C%90%EB%B3%84</guid>
            <pubDate>Sat, 26 Feb 2022 15:51:35 GMT</pubDate>
            <description><![CDATA[<h3 id="에라토스테네스의-체">에라토스테네스의 체</h3>
<hr>
<ul>
<li>특정 수 미만인 소수를 구하는 알고리즘</li>
<li>알고리즘<ul>
<li>크기가 n+1인 배열을 생성한다.</li>
<li>특정 인덱스의 배수에 해당하는 수를 지운다.(자기자신 제외)<ul>
<li>ex) idx : 2 -&gt; 2,4,8,...을 삭제</li>
</ul>
</li>
<li>인덱스를 1씩 증가시키며 2번 과정을 반복한다.(2~n)</li>
<li>남은 수를 출력한다.</li>
</ul>
</li>
</ul>
<h3 id="예제">예제</h3>
<hr>
<ol>
<li>백준 1929</li>
</ol>
<ul>
<li>소수 구하기</li>
<li>[M,N] 범위의 소수를 모두 출력하는 프로그램을 작성하시오<pre><code class="language-python">min, max = map(int, input().split())
</code></pre>
</li>
</ul>
<h1 id="인덱스가-min-max인-부분만-사용">인덱스가 [min, max]인 부분만 사용</h1>
<p>prime_numbers = [0]*(max+1)</p>
<p>prime_numbers[1]=1</p>
<h1 id="해당-인덱스의-값이-0--소수--1--소수x">해당 인덱스의 값이 0 : 소수 / 1 : 소수x</h1>
<p>for i in range(2,max+1) :
  if prime_numbers[i] == 1 :
    continue
  for j in range(i+i, max+1, i) :
    prime_numbers[j] = 1</p>
<p>for i in range(min,max+1):
  if prime_numbers[i] == 0 :
    print(i)</p>
<pre><code>&lt;br&gt;

2. 백준 4948 
* 베르트랑 공준
* 임의의 자연수 n에 대하여 (n,2n] 범위의 소수의 개수를 출력하시오

```python
min = 1
while True :
  min = int (input())
  if min == 0 : break
  max = min * 2

  # 인덱스가 [min, max]인 부분만 사용
  prime_numbers = [0]*(max+1)

  # 0과 1은 소수가 아님
  prime_numbers[0]=1
  prime_numbers[1]=1

  # 해당 인덱스의 값이 0 (소수) / 1 (소수x)
  for i in range(2,max+1) :
    if prime_numbers[i] == 1 :
      continue
    for j in range(i+i, max+1, i) :
      prime_numbers[j] = 1

  count = 0
  for i in range(min+1, max+1) :
    if prime_numbers[i] == 0 :
      count += 1
  &quot;&quot;&quot;
  sum으로 개수를 구할 수도 있음

  count = sum(prime_numbers[min+1 : max+1])

  &quot;&quot;&quot;
  print(count)</code></pre>]]></description>
        </item>
        <item>
            <title><![CDATA[조합 회로]]></title>
            <link>https://velog.io/@yeonhee-7935/%EC%A1%B0%ED%95%A9%ED%9A%8C%EB%A1%9C</link>
            <guid>https://velog.io/@yeonhee-7935/%EC%A1%B0%ED%95%A9%ED%9A%8C%EB%A1%9C</guid>
            <pubDate>Mon, 20 Dec 2021 10:41:59 GMT</pubDate>
            <description><![CDATA[<h2 id="조합-회로">조합 회로</h2>
<hr>
<ul>
<li>현재의 입력값들만 이용하여 출력값을 결정하는 회로</li>
<li>입력 신호들을 받는 즉시 그들을 <strong>조합</strong>하여 최종 출력을 발생시킨다.</li>
<li>부울함수 게이트들만 이용하여 구현(기억소자 X)</li>
</ul>
<p><br><br></p>
<h3 id="조합회로의-분석방법">조합회로의 분석방법</h3>
<ul>
<li><strong>부울함수</strong>를 이용한 분석</li>
<li><strong>진리표</strong>를 이용한 분석</li>
<li><strong>입출력 신호</strong> 파형을 이용한 분석
<br><br></li>
</ul>
<h3 id="조합회로-설계-절차">조합회로 설계 절차</h3>
<p>1) 구현할 기능 표현
2) 입력 및 출력 변수 결정
3) 입출력 관계 분석해 진리표 작성
4) 카르노맵을 이용해 간략화된 부울함수 유도
5) 회로 구성</p>
<p><br><br></p>
<h3 id="조합회로-종류">조합회로 종류</h3>
<p><strong>1. 가산기</strong></p>
<ul>
<li><strong>1) 반가산기(HA)</strong>   : 2bit(a,b)   =&gt; 2bit(Carry, Sum)
<strong>2) 전가산기(FA)</strong>   : 3bit(a,b,c) =&gt; 2bit(Carry, Sum)
<strong>3) 병렬가산기(PA)</strong> : 여러 비트들로 이루어진 2진수들 간의 덧셈을 수행(n개의 FA로 구성됨)</li>
</ul>
<br>

<p><strong>2. 인코더</strong> : </p>
<ul>
<li>2^n bit =&gt; 입력 값에 대응되는 2진 코드</li>
<li>__ 우선순위 인코더__ : 우선순위를 판단하는 기능을 가진 인코더
두 개 이상의 입력들이 동시에 1로 세트된 경우, 그 중 우선순위가 높은 입력에 대한 BCD 값을 출력하는 조합회로</li>
</ul>
<br>

<p><strong>3. 디코더(해독기)</strong> : </p>
<ul>
<li>n bit =&gt; 2^n bit
입력값에 따라 2^n 개의 출력들 중 하나를 지정</li>
<li>__ enable 신호가 있는 디코더__<ul>
<li>En=0 ) 활성화 상태 </li>
<li>En=1 ) 비활성화 상태 (어떤 출력도 선택되지 않음)</li>
</ul>
</li>
</ul>
<br>

<p><strong>4. 그레이코드 변환기</strong> : n bit =&gt; n bit</p>
<ul>
<li>2진코드 =&gt; 그레이코드<ul>
<li>그레이코드의 MSB = 2진코드의 MSB</li>
<li>Gn = Bn+1 (XOR) Bn</li>
</ul>
</li>
<li>그레이코드 =&gt; 2진코드<ul>
<li>2진코드의 MSB = 그레이코드의 MSB</li>
<li>Bn = Gn (XOR) Gn+1</li>
</ul>
</li>
</ul>
<br>

<p><strong>5. 비교기</strong>
<strong>1) 단순 비교기</strong> : </p>
<ul>
<li>입력 값들의 동일성 비교</li>
<li>입력의 각 비트에 대해 XNOR =&gt; AND
<strong>2) 크기 비교기</strong> : </li>
<li>입력 값들의 크기 비교</li>
</ul>
<br>

<p><strong>5. 멀티플렉서(MUX)</strong> : </p>
<ul>
<li>여러 입력 신호들 중 하나만 출력 신호로 내보냄(<strong>데이터 선택기</strong>)</li>
<li>입력(n bit) + 선택신호(Log2n bit)</li>
</ul>
<br>

<p><strong>6. 디멀티플렉서(DEMUX)</strong></p>
<ul>
<li>한 개의 입력 신호를 여러 출력 선들 중 하나로 출력(<strong>데이터 분배기</strong>)</li>
</ul>
<br>

<p><strong>7. 가감산기</strong></p>
<ul>
<li>덧셈과 뺄셈을 모두 수행할 수 있는 산술회로</li>
<li>제어신호(M : M=0덧셈 | M=1뺄셈) </li>
</ul>
<br>

<p><strong>8. BCD 가산기</strong></p>
<ul>
<li>BCD코드(0000~1001)로 표현된 10진수들간의 덧셈을 수행</li>
<li>합이 9보다 큰 경우 6을 더해 올림수를 발생시킨다.</li>
<li>올림수가 발생하면 6을 더한다.</li>
</ul>
<br>

<p><strong>9. 패리티 발생기</strong></p>
<ul>
<li><strong>1) 짝수 패리티 발생기</strong> : 모든 데이터 비트들 간에 XOR 연산 수행</li>
<li><strong>2) 홀수 패리티 발생기</strong> : 모든 데이터 비트들 간에 XOR 연산 수행 후 결과값을 반전시킴</li>
</ul>
]]></description>
        </item>
        <item>
            <title><![CDATA[Express & React 연동]]></title>
            <link>https://velog.io/@yeonhee-7935/Express-React-%EC%97%B0%EB%8F%99</link>
            <guid>https://velog.io/@yeonhee-7935/Express-React-%EC%97%B0%EB%8F%99</guid>
            <pubDate>Sat, 25 Sep 2021 13:40:10 GMT</pubDate>
            <description><![CDATA[<h2 id="🙌-프로젝트-구조">🙌 프로젝트 구조</h2>
<hr>
<ul>
<li>project<ul>
<li>client (create-react-app로 생성)<ul>
<li>public<ul>
<li>index.html  <ul>
<li>src</li>
</ul>
</li>
<li>app.js</li>
<li>index.js</li>
</ul>
</li>
<li>package.json</li>
</ul>
</li>
<li>server<ul>
<li>app.js</li>
<li>package.json</li>
</ul>
</li>
<li>package.json</li>
<li>node_modules<br>
<br>


</li>
</ul>
</li>
</ul>
<h3 id="😁-server">😁 server</h3>
<hr>
<ol>
<li>nodemon : 서버의 변경사항 자동 적용<blockquote>
<p>npm install nodemon --save -include=dev</p>
</blockquote>
</li>
<li>concurrently : express 서버와  react를 한 명령어로 실행하도록 도와줌<blockquote>
<p>npm  install concurrently</p>
</blockquote>
</li>
<li>express <blockquote>
<p>npm install express</p>
</blockquote>
</li>
<li>package.json ~ script.dev 추가<blockquote>
<p>&quot;server&quot;: &quot;node ./app.js&quot;,
&quot;client&quot;: &quot;cd ../client &amp;&amp; npm start&quot;,
&quot;dev&quot;: &quot;concurrently &quot;npm run server&quot; &quot;npm run client&quot;&quot;</p>
</blockquote>
</li>
</ol>
<br>
<br>

<h3 id="😀-client">😀 client</h3>
<hr>
<ol>
<li>package.json에 proxy 속성 추가<blockquote>
<p>&quot;proxy&quot;: &quot;<a href="http://localhost:%5Bexpress%EC%97%90%EC%84%9C">http://localhost:[express에서</a> 사용하는 포트 번호]&quot;</p>
</blockquote>
</li>
</ol>
]]></description>
        </item>
        <item>
            <title><![CDATA[Mac 세팅]]></title>
            <link>https://velog.io/@yeonhee-7935/Mac-%EC%84%B8%ED%8C%85</link>
            <guid>https://velog.io/@yeonhee-7935/Mac-%EC%84%B8%ED%8C%85</guid>
            <pubDate>Mon, 30 Aug 2021 06:49:26 GMT</pubDate>
            <description><![CDATA[<p><br>1. CLT(Command Line Tool) 다운로드</p>
<blockquote>
<p>xcode-select --install</p>
</blockquote>
<p><br>2. Homebrew 설치 : macOS의 패키지 관리자</p>
<blockquote>
<p>$ /bin/bash -c &quot;$(curl -fsSL <a href="https://raw.githubusercontent.com/Homebrew/install/master/install.sh)&quot;">https://raw.githubusercontent.com/Homebrew/install/master/install.sh)&quot;</a></p>
</blockquote>
<p><br>3. brew cask 설치</p>
<blockquote>
<p>brew install cask</p>
</blockquote>
<p><br>4. nodejs 설치</p>
<blockquote>
<p>brew install node</p>
</blockquote>
<p><br>5. vscode 설치</p>
<blockquote>
<p>1) brew cask install visual-studio-code
2) brew install --cask visual-studio-code</p>
</blockquote>
<p>※ 설치한 app의 디렉토리 확인하는 법 ※</p>
<blockquote>
<p>brew info app_name</p>
</blockquote>
<p><br> 6. oh-my-zsh 설치 (터미널 꾸미는 도구)</p>
<blockquote>
<p>sh -c &quot;$(curl -fsSL <a href="https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)&quot;">https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)&quot;</a></p>
</blockquote>
]]></description>
        </item>
        <item>
            <title><![CDATA[2. express]]></title>
            <link>https://velog.io/@yeonhee-7935/2.express</link>
            <guid>https://velog.io/@yeonhee-7935/2.express</guid>
            <pubDate>Wed, 25 Aug 2021 09:42:49 GMT</pubDate>
            <description><![CDATA[<h2 id="express-기본-구조">express 기본 구조</h2>
<pre><code class="language-javascript">const express =require(&quot;express&quot;);
const app = express();

//정적 파일 라우팅-&gt; /public에 정적파일을 위치시키면 자동 라우팅
app.use(express.static(&#39;public&#39;);

app.get(&#39;/&#39;,(req,res)=&gt;{
  //실행할 문장
});

//웹서버 시작 : 해당 포트를 열고 대기
app.listen(3000,()=&gt;{
    //실행할 문장
});
</code></pre>
]]></description>
        </item>
        <item>
            <title><![CDATA[[자료구조] 정렬]]></title>
            <link>https://velog.io/@yeonhee-7935/%EC%9E%90%EB%A3%8C%EA%B5%AC%EC%A1%B0-%EC%A0%95%EB%A0%AC</link>
            <guid>https://velog.io/@yeonhee-7935/%EC%9E%90%EB%A3%8C%EA%B5%AC%EC%A1%B0-%EC%A0%95%EB%A0%AC</guid>
            <pubDate>Mon, 23 Aug 2021 08:25:53 GMT</pubDate>
            <description><![CDATA[<h2 id="정렬의-분류">정렬의 분류</h2>
<hr>
<ol>
<li><strong>안정성</strong>에 따른 분류
1) <strong>Stable sort</strong> 
-정렬 순서가 동일한 원소에 대해 초기 순서를 유지하는 정렬      <ul>
<li><a href="#bubble">bubble</a></li>
<li><a href="#insertion">insertion</a></li>
<li><a href="#merge">merge</a></li>
<li><a href="#radix">radix</a></li>
<li><a href="#counting">counting</a>
2) <strong>Unstable sort</strong></li>
<li><a href="#selection">selection</a></li>
<li><a href="#quick">quick</a></li>
<li><a href="#heap">heap</a></li>
<li><a href="#shell">shell</a></br></li>
</ul>
</li>
<li><strong>비교 여부</strong>에 따른 분류
1) 비교 정렬 
2) 비비교 정렬 
-ex) counting, radix sort</li>
</ol>
</br>
</br>

<h2 id="정렬의-종류">정렬의 종류</h2>
<hr>
<h3 id="1--a-namebubblebubblea">1.  <a name="bubble">bubble</a></h3>
<p>: 이웃한 두 원소 중 큰 것을 뒤로 보내 정렬하는 방법</p>
<pre><code class="language-java">void bubbleSort(int [] arr){
    for (int i = 1 ; i &lt; arr.length ; i++){
            for (int j = 0 ; j &lt; arr.length - i ; j++){
                if(arr[j]&gt;arr[j+1])
                        swap(arr, j, j+1);
            }        
        }
}</code></pre>
<ul>
<li>O(n^2)</br>
### 2. <a name="selection">selection</a>
: 정렬되지 않은 원소 중 최솟값을 찾아 정렬된 부분 뒤에 위치시켜 정렬하는 방법
```java
void selectionSort(int [] arr) {
  for ( int i=0 ; i < arr.length ; i++){
          int min = arr[i];
          int minIdx;
          for ( int j = i+1 ; j < arr.length ; j++){
              if(arr[j] < min){
                      min = arr[j];
                      minIdx = j;
                  }
          }
      swap( arr, i, minIdx);
  }
}
```</li>
<li>O(n^2)</br>
### 3. <a name="insertion">insertion</a>
: 정렬된 부분에서 정렬되지 않은 첫 번째 원소가 들어갈 위치를 찾아 삽입하는 정렬 방법
```java
void insertionSort(int [] arr){
  for( int i = 1 ; i < arr.length ; i ++){
          int insertedData = arr[i];
          for(int j = i-1 ; j >= 0 ; j--){
              if(arr[j] > insertedData){
                      arr[j+1] = arr[j];
                  } else {
                          break;
                      }
          }
              arr[i] = insertedData;
      }
}
```</li>
<li>O(n^2)</br><h3 id="4-a-namequickquicka">4. <a name="quick">quick</a></h3>
: 피벗을 중심으로 좌측은 피벗보다 작은 원소, 우측은 피벗보다 큰 원소로 분류함으로써 정렬하는 방법<pre><code class="language-java">void quickSort(int [] arr, int left, int right){
  if(left &gt;= right ) return;
  int pivot = left;
  int i = left + 1 ;
  int j = right ;
  do { 
      while(i &lt; right &amp;&amp; arr[i] &lt; arr[pivot]) i++;
      while(j &gt; left &amp;&amp; arr[j] &gt; arr[pivot]) j--;
      if(i &lt; j)
          swap(arr, i, j);
  }while(i&lt;j);
  swap(arr, j, pivot);
  quickSort(arr, left, j-1);
  quickSort(arr, j+1, right);
}</code></pre>
</li>
<li>O(nlogn)</br><h3 id="5-a-nameheapheapa">5. <a name="heap">heap</a></h3>
: 힙 자료구조를 이용한 정렬 방법( all insertion -&gt; all delete )<pre><code class="language-java"></code></pre>
</li>
<li>O(nLogn)</br><h3 id="6-a-namemergemergea">6. <a name="merge">merge</a></h3>
: <pre><code class="language-java"></code></pre>
</li>
<li>O(nLogn)</br><h3 id="7-a-nameradixradixa">7. <a name="radix">radix</a></h3>
: 기수를 기준으로 정렬하는 방법<pre><code class="language-java"></code></pre>
</li>
<li>O(n)</br><h3 id="8-a-namecountingcountinga">8. <a name="counting">counting</a></h3>
: 크기를 기준으로 계수하여 정렬하는 방법<pre><code class="language-java"></code></pre>
</li>
<li>O(n)</br><h3 id="7-a-nameshellshella">7. <a name="shell">shell</a></h3>
: <pre><code class="language-java"></code></pre>
</li>
<li>O(n)</br></li>
</ul>
]]></description>
        </item>
        <item>
            <title><![CDATA[[ReactJS] 1. React Router]]></title>
            <link>https://velog.io/@yeonhee-7935/ReactJS-1.-React-Router</link>
            <guid>https://velog.io/@yeonhee-7935/ReactJS-1.-React-Router</guid>
            <pubDate>Fri, 20 Aug 2021 10:49:35 GMT</pubDate>
            <description><![CDATA[<h1 id="router-">Router ?</h1>
<hr>
<p>사용자가 원하는 컴포넌트를 url에 맞게 화면에 출력할 수 있도록 돕는 기능</p>
<p>###</p>
<ol>
<li>react-router-dom 다운로드<blockquote>
<p>npx install react-router-dom</p>
</blockquote>
</li>
<li>BrowseRouter,Route 임포트 </li>
</ol>
<ul>
<li>컴포넌트별 url 지정</li>
<li>1) 컴포넌트 사용처에서 해당 컴포넌트를 <Route>로 감싼다.
2) 최상위 컴포넌트를 <BrowseRouter>로 감싼다.</li>
</ul>
<hr>
<pre><code class="language-javascript">import {ReactRouter,Router} from react-router-dom
...
      function Home(){
          return(
             &lt;div&gt;
              &lt;h3&gt;Home&lt;/h3&gt;
              Home
              &lt;/div&gt;
          );
      }
      function Topics(){
          return(
             &lt;div&gt;
              &lt;h3&gt;Topics&lt;/h3&gt;
              Topics
              &lt;/div&gt;
          );
      }
      function Contact(){
          return(
             &lt;div&gt;
              &lt;h3&gt;Contact&lt;/h3&gt;
              Contact
              &lt;/div&gt;
          );
      }
    function App () {
          return (
              &lt;div&gt;
              &lt;h1&gt;React Router DOM Application&lt;/h1&gt;
              &lt;ul&gt;
                &lt;li&gt;&lt;Link to=&quot;/&quot;&gt;Home&lt;/Link&gt;&lt;/li&gt;
                &lt;li&gt;&lt;Link to=&quot;/&quot;&gt;Topics&lt;/Link&gt;&lt;/li&gt;
                &lt;li&gt;&lt;Link to=&quot;/&quot;&gt;Contact&lt;/Link&gt;&lt;/li&gt;
              &lt;/ul&gt;
              &lt;Route exact url=&quot;/&quot;&gt;&lt;Home/&gt;&lt;/Route&gt;
              &lt;Route url=&quot;/topics&quot;&gt;&lt;Topics/&gt;&lt;/Route&gt;
              &lt;Route url=&quot;/contact&quot;&gt;&lt;Contact/&gt;&lt;/Route&gt;
              &lt;/div&gt;
          );
      }
  ReactDom.render(&lt;BrowseRouter&gt;&lt;App/&gt;&lt;/BrowseRouter&gt;,document.getElementById(&#39;root&#39;));
</code></pre>
<p>※ <code>&lt;Link&gt;</code> 컴포넌트 </p>
<ul>
<li>화면 변경 후 페이지가 리로딩되지 않도록 하는 방법</li>
<li><code>&lt;a href=&quot;path&quot;&gt;</code> 대신 <code>&lt;Link to=&quot;path&quot;&gt;</code>를 사용한다.</li>
<li><code>&lt;Route&gt;</code>와 같이 exact 속성 추가 가능</li>
<li>NavLink를 사용하면 활성화된 NavLink에 자동적으로 active 클래스가 추가된다. (활성화된 link를 직관적으로 알고 조작할 수 있다.)</li>
</ul>
<p>※ 여러 path에 해당하는 컴포넌트를 특정 path에만 걸리도록 하는 방법</p>
<ol>
<li><code>&lt;Route&gt;</code>에 exact 속성 추가(해당 url와 정확히 일치하는 경우에만 화면에 표시)</li>
<li><code>&lt;Route&gt;</code>들을 <code>&lt;Switch&gt;</code> 컴포넌트로 감싸기</li>
</ol>
]]></description>
        </item>
        <item>
            <title><![CDATA[[ReactJS] 0. 소개]]></title>
            <link>https://velog.io/@yeonhee-7935/ReactJS-0-intro</link>
            <guid>https://velog.io/@yeonhee-7935/ReactJS-0-intro</guid>
            <pubDate>Wed, 18 Aug 2021 07:46:34 GMT</pubDate>
            <description><![CDATA[<h1 id="🧐-reactjs">🧐 ReactJS?</h1>
<hr>
<p>페이스북에서 제공한 ui 라이브러리</p>
<ul>
<li>장점<ul>
<li>컴포넌트 단위로 코드를 모듈화</li>
<li>뛰어난 GC, 메모리 관리, 성능</li>
<li>서버 &amp; 클라이언트 렌더링 모두 지원 =&gt; 초기 구동 딜레이 &amp; SEO</li>
<li>ui 재사용성</li>
<li>커뮤니티 활발</li>
</ul>
</li>
<li>단점<ul>
<li>IE8 이하 지원 ❌</li>
</ul>
</li>
</ul>
<h1 id="jsx">JSX</h1>
<hr>
<ul>
<li>JavaScript Extension</li>
<li>마크업 언어(XML, HTML)를 Native JS로 변환해줌 
( by babel- jsxloader )</li>
<li>ES6의 문법은 아님</li>
<li>속성은 camelCase로 표현해야 </li>
</ul>
<h3 id="컴포넌트">컴포넌트</h3>
<hr>
<h3 id="props">Props</h3>
<hr>
<ul>
<li>클래스 컴포넌트 내부의 immutable data =&gt; <strong>{this.props.prop_name}</strong></li>
<li>함수형 컴포넌트에서는 인자로 전달해야 함 =&gt; <strong>{props.prop_name}</strong></li>
<li>default props : children <pre><code class="language-js">//1. functional Component
function Greeting (props){
  return (&lt;div&gt;Hello {props.name}&lt;/div&gt;);
}  
</code></pre>
</li>
</ul>
<p>//2. class Component
class Greeting extends React.Component{
    render () {
        return (<div>Hello {this.props.name}</div>);
    }
}</p>
<p>//컴포넌트 사용하기
class App extends React.Component {
    render () {
        return (<Greeting name="Hello"/>);
    }
}</p>
<p>//기본값 설정(클래스 컴포넌트 선언 후)
Greeting.defaultProps = { key : value };</p>
<p>//Type 검증
Greeting.propTypes ={
    prop_name : PropTypes.자료형 //[.isrequired]
}</p>
<pre><code>
### state 
***
* 컴포넌트의 유동적인 데이터
* 초기값 설정이 필수 (constructor()에서 초기화)
* this.setState()를 이용해 값 변경 가능 -&gt; 렌더링 된 후 직접 접근하여 값을 변경하면 안된다. (전체 업데이트로 인해 성능 저하)
```js
class Counter extends React.Component{
    constructor(props){
        super(props);
        this.state = {
            count : 0
        };
        this.plus=this.plus.bind(this);
        this.minus = this. minus.bind(this);
    }
      render (){
        return (
            &lt;div&gt;
                  &lt;h2&gt;{this.state.count}&lt;/h2&gt;
                  &lt;button onClick={this.plus}&gt;+&lt;/button&gt;
                  &lt;button onClick={this.minus}&gt;-&lt;/button&gt;
              &lt;/div&gt;
        );
    }
    plus () {
        this.setState({
            count : this.state.count + 1
        });
    }
    minus () {
        this.setState({
            count : this.state.count -1
        });
    }

}</code></pre><h4 id="let과-var">let과 var</h4>
<hr>
<ul>
<li>let은 재선언 불가</li>
<li>let의 스코프는 블록 범위 내에서만 가능</li>
</ul>
]]></description>
        </item>
        <item>
            <title><![CDATA[CSR vs SSR]]></title>
            <link>https://velog.io/@yeonhee-7935/CSRSSR</link>
            <guid>https://velog.io/@yeonhee-7935/CSRSSR</guid>
            <pubDate>Mon, 16 Aug 2021 11:07:00 GMT</pubDate>
            <description><![CDATA[<h1 id="csr-client-side-rendering">CSR (Client Side Rendering)</h1>
<ul>
<li>TTI = TTV -&gt; app.js의 경량화</li>
<li>index.html 요청 -&gt; 기타 파일(js, fw) 요청(too Big) -&gt; rendering</li>
<li>△ 첫 loading 시간이 길다</li>
<li>△ 페이지 케싱 비효율적</li>
<li>△ SEO 비효율적 =&gt; PrerenderIO를 이용해 해결 가능</li>
</ul>
<h1 id="ssr-server-side-rendering">SSR (Server Side Rendering)</h1>
<ul>
<li>정적 파일 + 자바스크립트 파일 </li>
<li>TTI &gt; TTV</li>
<li>SEO 효율적</li>
<li>페이지 로딩이 빠름</li>
<li>△ Blinking Issue</li>
<li>△ Server Overhead</li>
<li>△ js 파일이 다운로드 되기 전에는 동적으로 작동하지 않음</li>
</ul>
<h1 id="ssg-static-site-generation">SSG (Static Site Generation)</h1>
<ul>
<li>Gatsby </li>
<li>NextJS</li>
</ul>
<br>
※ SEO : Search Engine Optimization]]></description>
        </item>
        <item>
            <title><![CDATA[브라우저 렌더링]]></title>
            <link>https://velog.io/@yeonhee-7935/%EB%B8%8C%EB%9D%BC%EC%9A%B0%EC%A0%80</link>
            <guid>https://velog.io/@yeonhee-7935/%EB%B8%8C%EB%9D%BC%EC%9A%B0%EC%A0%80</guid>
            <pubDate>Thu, 12 Aug 2021 04:29:01 GMT</pubDate>
            <description><![CDATA[<h3 id="브라우저의-기본-구조">브라우저의 기본 구조</h3>
<hr>
<ul>
<li>사용자 인터페이스</li>
<li>브라우저 엔진 : ui와 렌더링 엔진 사이의 동작을 제어</li>
<li><a href="#rendering_engine" style="color:pink"><strong>렌더링 엔진</strong></a> : 요청한 자원을 파싱하여 표시</br> ( ex: Firefox-Gecko, Chrome-Blink, Safari-Webkit )</li>
<li>통신 : http</li>
<li><a href="#js_engine" style="color:orange"><strong>자바스크립트 엔진</strong></a></li>
<li>ui 백엔드 : </li>
<li>자료 저장소 : 쿠키 등을 저장</li>
</ul>
<p><br><br></p>
<h3 id="a-namerendering_engine-stylecolorpink렌더링-엔진의-동작-과정chrome-기준"><a name="rendering_engine" style="color:pink">렌더링 엔진의 동작 과정(Chrome 기준)</h3>
<p>: Critical Rendering Path</a></p>
<hr>
<ol>
<li>DOM 트리 구축을 위한 HTML 파싱 =&gt; DOM, CSSOM 트리 생성<ul>
<li>어휘 분석<ul>
<li><strong>토큰화</strong> [tokenize]</li>
<li><strong>각 토큰을 노드 객체로 변환</strong></li>
</ul>
</li>
<li>파싱트리 생성 : 구문 규칙에 따라 문서 구조 분석, 파싱 트리 생성<ul>
<li>DOM 트리</li>
<li>CSSOM 트리 : DOM이 화면에 표시되는 방법 표시</li>
</ul>
</li>
</ul>
</li>
<li>렌더 트리 구축<ul>
<li>렌더트리 = DOM 트리 + CSSOM 트리</li>
<li>화면에 표시되어야 할 모든 노드에 대한 정보(컨텐츠, 스타일 등)를 포함한 트리<ul>
<li>DOM의 최상위 노드부터 순회하면서 CSSOM으로부터 관련된 요소를 트리에 포함시킨다.</li>
</ul>
</li>
</ul>
</li>
<li>렌더 트리 배치(Layout)<ul>
<li>뷰포트 내에서 요소들의 정확한 위치와 크기를 계산하는 과정</li>
<li>레이어 구성</li>
</ul>
</li>
<li>렌더 트리 그리기(Paint)
<img src="https://images.velog.io/images/yeonhee-7935/post/e8170ec4-46ae-4874-a288-fd2e2d16467d/helloworld-59361-3.png" alt=""><p style="color:#aaa">[웹킷의 렌더링 과정]</p></li>
</ol>
<br>
<br>

<h4 id="ui-업데이트-과정">UI 업데이트 과정</h4>
<hr>
<p>Javascript &gt;&gt; Style &gt;&gt; Layout &gt;&gt; Paint &gt;&gt; Composite</p>
<p><br><br></p>
<h3 id="a-namejs_engine-stylecolororange자바스크립트-엔진a"><a name="js_engine" style="color:orange">자바스크립트 엔진</a></h3>
<hr>
<blockquote>
<p>자바 스크립트 엔진은 js 코드를 해석하고 실행시켜주는 프로그램 혹은 인터프리터</p>
</blockquote>
<ul>
<li>종류 <ul>
<li>v8 : 구글에서 c++로 개발, 크롬과 nodejs에서 주로 사용</li>
<li>spiderMonkey, Rhino, JavaScriptCore, Chakra, Nashorn, JerryScript 등</br></br></li>
</ul>
</li>
<li>js의 메모리 구조<ul>
<li>Memory Heap : 참조 타입의 데이터가 저장됨</li>
<li>Call Stack : 원시타입, 실행 컨텍스트가 저장됨</br>
<img src="https://images.velog.io/images/yeonhee-7935/post/2e8c1848-7801-4dde-9c1e-9ed5f67edde9/event-queue.png" alt=""></li>
</ul>
</li>
</ul>
<p><br><br><br>
※DOM(Document Object Model)
: HTML을 객체로 표현한 것</p>
<p>※ 렌더트리</p>
<ul>
<li>DOM 트리 + CSSDOM 트리 = 렌더 트리</li>
<li>화면에 표시되지 않을 토큰은 제거하여 트리를 생성함 (ex: display:none)</li>
<li>표시되는 각 요소의 레이아웃을 계산하는 데 사용됨</li>
<li>페인트 프로세스에 대한 입력값으로 사용됨</li>
</ul>
<p>※ <p style="color:red">렉시컬 환경</p></p>
]]></description>
        </item>
        <item>
            <title><![CDATA[가상머신]]></title>
            <link>https://velog.io/@yeonhee-7935/%EA%B0%80%EC%83%81%EB%A8%B8%EC%8B%A0</link>
            <guid>https://velog.io/@yeonhee-7935/%EA%B0%80%EC%83%81%EB%A8%B8%EC%8B%A0</guid>
            <pubDate>Wed, 11 Aug 2021 05:53:41 GMT</pubDate>
            <description><![CDATA[<h1 id="❓-가상머신">❓ 가상머신</h1>
<p>: 컴푸팅 환경을 소프트웨어로 구현한 것으로, os나 응용프로그램을 설치 및 실행할 수 있다.</p>
<ul>
<li>시스템 vm : os를 지원하는 vm</li>
<li>프로세스 vm : 단일 프로그램을 지원하는 vm</li>
</ul>
]]></description>
        </item>
        <item>
            <title><![CDATA[0. 개요]]></title>
            <link>https://velog.io/@yeonhee-7935/0.%EA%B0%9C%EC%9A%94</link>
            <guid>https://velog.io/@yeonhee-7935/0.%EA%B0%9C%EC%9A%94</guid>
            <pubDate>Tue, 10 Aug 2021 14:46:59 GMT</pubDate>
            <description><![CDATA[<h1 id="nodejs">nodejs</h1>
<p>chrome v8 엔진으로 빌드된 자바스크립트 런타임</p>
<ul>
<li>이벤트 기반</li>
<li>논블로킹 i/o</li>
<li>가볍고 효율적</li>
<li>npm(node package manager)
(※ 런타임 : 프로그래밍 언어가 구동되는 환경)
<br><br><h3 id="📕-url의-구조">📕 url의 구조</h3>
{protocol}://{host|domain}:{port}/{path}?{query String}</li>
<li>query string은 <strong>key=value</strong> 의 구조를 갖는다.
<br><br><h3 id="📒-node의-내장-객체-및-모듈">📒 node의 내장 객체 및 모듈</h3>
</li>
</ul>
<ol>
<li>내장 객체</li>
</ol>
<ul>
<li>global : setTimeout(), setInterval(), setImmediate() 등을 포함</li>
<li>__filename : 현재 파일 위치</li>
<li>__dirname : 현재 경로</li>
<li>process : 환경설정 정보, </li>
</ul>
<ol start="2">
<li>모듈 -&gt; <strong>require()</strong>을 통해 사용할 수 있다.</li>
</ol>
<ul>
<li>os</li>
<li>url</li>
<li>fs : 파일시스템 관련 모듈</li>
<li>path</li>
</ul>
]]></description>
        </item>
    </channel>
</rss>