diff --git a/public/404.html b/public/404.html index 73023b1..f54ab28 100644 --- a/public/404.html +++ b/public/404.html @@ -1,18 +1,20 @@ - + - + 404 Page not found - + - - + + - + + +
@@ -267,8 +265,8 @@

좋은 개발자로 한걸음 더

-

Not Found

-

This page does not exist

+

찾을 수 없음

+

페이지를 찾을 수 없습니다.

diff --git a/public/about-hugo/index.html b/public/about-hugo/index.html index b8e3ec4..90698bd 100644 --- a/public/about-hugo/index.html +++ b/public/about-hugo/index.html @@ -1,5 +1,5 @@ - + https://srlee056.github.io/about/ diff --git a/public/about-us/index.html b/public/about-us/index.html index b8e3ec4..90698bd 100644 --- a/public/about-us/index.html +++ b/public/about-us/index.html @@ -1,5 +1,5 @@ - + https://srlee056.github.io/about/ diff --git a/public/about/index.html b/public/about/index.html index df62932..2f8b0a9 100644 --- a/public/about/index.html +++ b/public/about/index.html @@ -1,5 +1,5 @@ - + About @@ -9,10 +9,12 @@ - + + + - -
-
-

غير موجود

-

تعذر العثور على الصفحة المطلوبة.

-
-
- - -
- مبني بستخدام Hugo
- قالب Stack مصمم من Jimmy -
-
- - -
- - - - - - diff --git a/public/ar/categories/index.html b/public/ar/categories/index.html deleted file mode 100644 index 4456b52..0000000 --- a/public/ar/categories/index.html +++ /dev/null @@ -1,324 +0,0 @@ - - - - -Categories - - - - - - - - - - - - - -
- - - - -
-
-

- - قسم - -

- -
-
-

2 صفحات

-

Categories

- -
-
-
- - -
- - - - - -
-
- - -
- مبني بستخدام Hugo
- قالب Stack مصمم من Jimmy -
-
- - -
-
- - - - - diff --git a/public/ar/categories/index.xml b/public/ar/categories/index.xml deleted file mode 100644 index e995b0a..0000000 --- a/public/ar/categories/index.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - Categories on موقع تجريبي - https://srlee056.github.io/ar/categories/ - Recent content in Categories on موقع تجريبي - Hugo -- gohugo.io - ar - Seorim Lee - Sat, 09 Mar 2019 00:00:00 +0000 - تجربة - https://srlee056.github.io/ar/categories/%D8%AA%D8%AC%D8%B1%D8%A8%D8%A9/ - Sat, 09 Mar 2019 00:00:00 +0000 - - https://srlee056.github.io/ar/categories/%D8%AA%D8%AC%D8%B1%D8%A8%D8%A9/ - - - - تجربة مع فراغات - https://srlee056.github.io/ar/categories/%D8%AA%D8%AC%D8%B1%D8%A8%D8%A9-%D9%85%D8%B9-%D9%81%D8%B1%D8%A7%D8%BA%D8%A7%D8%AA/ - Sat, 09 Mar 2019 00:00:00 +0000 - - https://srlee056.github.io/ar/categories/%D8%AA%D8%AC%D8%B1%D8%A8%D8%A9-%D9%85%D8%B9-%D9%81%D8%B1%D8%A7%D8%BA%D8%A7%D8%AA/ - - - - - diff --git a/public/ar/categories/page/1/index.html b/public/ar/categories/page/1/index.html deleted file mode 100644 index 1f0acc6..0000000 --- a/public/ar/categories/page/1/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - https://srlee056.github.io/ar/categories/ - - - - - - diff --git "a/public/ar/categories/\330\252\330\254\330\261\330\250\330\251-\331\205\330\271-\331\201\330\261\330\247\330\272\330\247\330\252/index.html" "b/public/ar/categories/\330\252\330\254\330\261\330\250\330\251-\331\205\330\271-\331\201\330\261\330\247\330\272\330\247\330\252/index.html" deleted file mode 100644 index 4a73902..0000000 --- "a/public/ar/categories/\330\252\330\254\330\261\330\250\330\251-\331\205\330\271-\331\201\330\261\330\247\330\272\330\247\330\252/index.html" +++ /dev/null @@ -1,321 +0,0 @@ - - - - -Category: تجربة مع فراغات - موقع تجريبي - - - - - - - - - - - - - -
- - - - -
-
-

- - Categories - -

- -
-
-

1 صفحه

-

تجربة مع فراغات

- -
-
-
- -
- - - -
-
- - -
- مبني بستخدام Hugo
- قالب Stack مصمم من Jimmy -
-
- - -
-
- - - - - diff --git "a/public/ar/categories/\330\252\330\254\330\261\330\250\330\251-\331\205\330\271-\331\201\330\261\330\247\330\272\330\247\330\252/index.xml" "b/public/ar/categories/\330\252\330\254\330\261\330\250\330\251-\331\205\330\271-\331\201\330\261\330\247\330\272\330\247\330\252/index.xml" deleted file mode 100644 index 7bb5b6d..0000000 --- "a/public/ar/categories/\330\252\330\254\330\261\330\250\330\251-\331\205\330\271-\331\201\330\261\330\247\330\272\330\247\330\252/index.xml" +++ /dev/null @@ -1,34 +0,0 @@ - - - - تجربة مع فراغات on موقع تجريبي - https://srlee056.github.io/ar/categories/%D8%AA%D8%AC%D8%B1%D8%A8%D8%A9-%D9%85%D8%B9-%D9%81%D8%B1%D8%A7%D8%BA%D8%A7%D8%AA/ - Recent content in تجربة مع فراغات on موقع تجريبي - Hugo -- gohugo.io - ar - Seorim Lee - Sat, 09 Mar 2019 00:00:00 +0000 - مثال نص - https://srlee056.github.io/ar/p/%D9%85%D8%AB%D8%A7%D9%84-%D9%86%D8%B5/ - Sat, 09 Mar 2019 00:00:00 +0000 - - https://srlee056.github.io/ar/p/%D9%85%D8%AB%D8%A7%D9%84-%D9%86%D8%B5/ - <img src="https://srlee056.github.io/ar/p/%D9%85%D8%AB%D8%A7%D9%84-%D9%86%D8%B5/matt-le-SJSpo9hQf7s-unsplash.jpg" alt="Featured image of post مثال نص" /><h2 id="فقرة-1">فقرة 1</h2> -<p>هذا النص هو مثال لنص يمكن أن يستبدل في نفس المساحة، لقد تم توليد هذا النص من <a class="link" href="https://colorslab.com/textgator/" target="_blank" rel="noopener" - >مولد النص العربى</a>، حيث يمكنك أن تولد مثل هذا النص أو العديد من النصوص الأخرى إضافة إلى زيادة عدد الحروف التى يولدها التطبيق. -إذا كنت تحتاج إلى عدد أكبر من الفقرات يتيح لك مولد النص العربى زيادة عدد الفقرات كما تريد، النص لن يبدو مقسما ولا يحوي أخطاء لغوية، مولد النص العربى مفيد لمصممي المواقع على وجه الخصوص، حيث يحتاج العميل فى كثير من الأحيان أن يطلع على صورة حقيقية لتصميم الموقع. -ومن هنا وجب على المصمم أن يضع نصوصا مؤقتة على التصميم ليظهر للعميل الشكل كاملاً،دور مولد النص العربى أن يوفر على المصمم عناء البحث عن نص بديل لا علاقة له بالموضوع الذى يتحدث عنه التصميم فيظهر بشكل لا يليق. -هذا النص يمكن أن يتم تركيبه على أي تصميم دون مشكلة فلن يبدو وكأنه نص منسوخ، غير منظم، غير منسق، أو حتى غير مفهوم. لأنه مازال نصاً بديلاً ومؤقتاً.</p> -<h2 id="فقرة-2">فقرة 2</h2> -<p>هذا النص هو مثال لنص يمكن أن يستبدل في نفس المساحة، لقد تم توليد هذا النص من <a class="link" href="https://colorslab.com/textgator/" target="_blank" rel="noopener" - >مولد النص العربى</a>، حيث يمكنك أن تولد مثل هذا النص أو العديد من النصوص الأخرى إضافة إلى زيادة عدد الحروف التى يولدها التطبيق. -إذا كنت تحتاج إلى عدد أكبر من الفقرات يتيح لك مولد النص العربى زيادة عدد الفقرات كما تريد، النص لن يبدو مقسما ولا يحوي أخطاء لغوية، مولد النص العربى مفيد لمصممي المواقع على وجه الخصوص، حيث يحتاج العميل فى كثير من الأحيان أن يطلع على صورة حقيقية لتصميم الموقع. -ومن هنا وجب على المصمم أن يضع نصوصا مؤقتة على التصميم ليظهر للعميل الشكل كاملاً،دور مولد النص العربى أن يوفر على المصمم عناء البحث عن نص بديل لا علاقة له بالموضوع الذى يتحدث عنه التصميم فيظهر بشكل لا يليق. -هذا النص يمكن أن يتم تركيبه على أي تصميم دون مشكلة فلن يبدو وكأنه نص منسوخ، غير منظم، غير منسق، أو حتى غير مفهوم. لأنه مازال نصاً بديلاً ومؤقتاً.</p> -<h2 id="تجربة-rtl">تجربة RTL</h2> -<p>كلمة 1 Text كلمة 2</p> - - - - - diff --git "a/public/ar/categories/\330\252\330\254\330\261\330\250\330\251-\331\205\330\271-\331\201\330\261\330\247\330\272\330\247\330\252/page/1/index.html" "b/public/ar/categories/\330\252\330\254\330\261\330\250\330\251-\331\205\330\271-\331\201\330\261\330\247\330\272\330\247\330\252/page/1/index.html" deleted file mode 100644 index 341bb8c..0000000 --- "a/public/ar/categories/\330\252\330\254\330\261\330\250\330\251-\331\205\330\271-\331\201\330\261\330\247\330\272\330\247\330\252/page/1/index.html" +++ /dev/null @@ -1,10 +0,0 @@ - - - - https://srlee056.github.io/ar/categories/%D8%AA%D8%AC%D8%B1%D8%A8%D8%A9-%D9%85%D8%B9-%D9%81%D8%B1%D8%A7%D8%BA%D8%A7%D8%AA/ - - - - - - diff --git "a/public/ar/categories/\330\252\330\254\330\261\330\250\330\251/index.html" "b/public/ar/categories/\330\252\330\254\330\261\330\250\330\251/index.html" deleted file mode 100644 index e6a66dd..0000000 --- "a/public/ar/categories/\330\252\330\254\330\261\330\250\330\251/index.html" +++ /dev/null @@ -1,321 +0,0 @@ - - - - -Category: تجربة - موقع تجريبي - - - - - - - - - - - - - -
- - - - -
-
-

- - Categories - -

- -
-
-

1 صفحه

-

تجربة

- -
-
-
- -
- - - -
-
- - -
- مبني بستخدام Hugo
- قالب Stack مصمم من Jimmy -
-
- - -
-
- - - - - diff --git "a/public/ar/categories/\330\252\330\254\330\261\330\250\330\251/index.xml" "b/public/ar/categories/\330\252\330\254\330\261\330\250\330\251/index.xml" deleted file mode 100644 index 36b3ede..0000000 --- "a/public/ar/categories/\330\252\330\254\330\261\330\250\330\251/index.xml" +++ /dev/null @@ -1,34 +0,0 @@ - - - - تجربة on موقع تجريبي - https://srlee056.github.io/ar/categories/%D8%AA%D8%AC%D8%B1%D8%A8%D8%A9/ - Recent content in تجربة on موقع تجريبي - Hugo -- gohugo.io - ar - Seorim Lee - Sat, 09 Mar 2019 00:00:00 +0000 - مثال نص - https://srlee056.github.io/ar/p/%D9%85%D8%AB%D8%A7%D9%84-%D9%86%D8%B5/ - Sat, 09 Mar 2019 00:00:00 +0000 - - https://srlee056.github.io/ar/p/%D9%85%D8%AB%D8%A7%D9%84-%D9%86%D8%B5/ - <img src="https://srlee056.github.io/ar/p/%D9%85%D8%AB%D8%A7%D9%84-%D9%86%D8%B5/matt-le-SJSpo9hQf7s-unsplash.jpg" alt="Featured image of post مثال نص" /><h2 id="فقرة-1">فقرة 1</h2> -<p>هذا النص هو مثال لنص يمكن أن يستبدل في نفس المساحة، لقد تم توليد هذا النص من <a class="link" href="https://colorslab.com/textgator/" target="_blank" rel="noopener" - >مولد النص العربى</a>، حيث يمكنك أن تولد مثل هذا النص أو العديد من النصوص الأخرى إضافة إلى زيادة عدد الحروف التى يولدها التطبيق. -إذا كنت تحتاج إلى عدد أكبر من الفقرات يتيح لك مولد النص العربى زيادة عدد الفقرات كما تريد، النص لن يبدو مقسما ولا يحوي أخطاء لغوية، مولد النص العربى مفيد لمصممي المواقع على وجه الخصوص، حيث يحتاج العميل فى كثير من الأحيان أن يطلع على صورة حقيقية لتصميم الموقع. -ومن هنا وجب على المصمم أن يضع نصوصا مؤقتة على التصميم ليظهر للعميل الشكل كاملاً،دور مولد النص العربى أن يوفر على المصمم عناء البحث عن نص بديل لا علاقة له بالموضوع الذى يتحدث عنه التصميم فيظهر بشكل لا يليق. -هذا النص يمكن أن يتم تركيبه على أي تصميم دون مشكلة فلن يبدو وكأنه نص منسوخ، غير منظم، غير منسق، أو حتى غير مفهوم. لأنه مازال نصاً بديلاً ومؤقتاً.</p> -<h2 id="فقرة-2">فقرة 2</h2> -<p>هذا النص هو مثال لنص يمكن أن يستبدل في نفس المساحة، لقد تم توليد هذا النص من <a class="link" href="https://colorslab.com/textgator/" target="_blank" rel="noopener" - >مولد النص العربى</a>، حيث يمكنك أن تولد مثل هذا النص أو العديد من النصوص الأخرى إضافة إلى زيادة عدد الحروف التى يولدها التطبيق. -إذا كنت تحتاج إلى عدد أكبر من الفقرات يتيح لك مولد النص العربى زيادة عدد الفقرات كما تريد، النص لن يبدو مقسما ولا يحوي أخطاء لغوية، مولد النص العربى مفيد لمصممي المواقع على وجه الخصوص، حيث يحتاج العميل فى كثير من الأحيان أن يطلع على صورة حقيقية لتصميم الموقع. -ومن هنا وجب على المصمم أن يضع نصوصا مؤقتة على التصميم ليظهر للعميل الشكل كاملاً،دور مولد النص العربى أن يوفر على المصمم عناء البحث عن نص بديل لا علاقة له بالموضوع الذى يتحدث عنه التصميم فيظهر بشكل لا يليق. -هذا النص يمكن أن يتم تركيبه على أي تصميم دون مشكلة فلن يبدو وكأنه نص منسوخ، غير منظم، غير منسق، أو حتى غير مفهوم. لأنه مازال نصاً بديلاً ومؤقتاً.</p> -<h2 id="تجربة-rtl">تجربة RTL</h2> -<p>كلمة 1 Text كلمة 2</p> - - - - - diff --git "a/public/ar/categories/\330\252\330\254\330\261\330\250\330\251/page/1/index.html" "b/public/ar/categories/\330\252\330\254\330\261\330\250\330\251/page/1/index.html" deleted file mode 100644 index 36e4179..0000000 --- "a/public/ar/categories/\330\252\330\254\330\261\330\250\330\251/page/1/index.html" +++ /dev/null @@ -1,10 +0,0 @@ - - - - https://srlee056.github.io/ar/categories/%D8%AA%D8%AC%D8%B1%D8%A8%D8%A9/ - - - - - - diff --git a/public/ar/index.html b/public/ar/index.html deleted file mode 100644 index 40ad14b..0000000 --- a/public/ar/index.html +++ /dev/null @@ -1,396 +0,0 @@ - - - - - -موقع تجريبي - - - - - - - - - - - - - -
- - - - -
- - - - - -
- - -
-
-
- - Featured image of post مثال نص - - -
- - -
- - - - -
-

- مثال نص -

- - -

- هذا النص هو مثال لنص يمكن أن يستبدل في نفس المساحة -

- -
- - - - - -
- -
- - - - - - - - - - -
- - - -
- - - - - - - - - -
- -
- - - -
- - - - - - - - - - - -
- - English - -
-
- -
- -
-
- -
-
- - -
- مبني بستخدام Hugo
- قالب Stack مصمم من Jimmy -
-
- -
-
- - - - - diff --git a/public/ar/index.xml b/public/ar/index.xml deleted file mode 100644 index 0e10ae5..0000000 --- a/public/ar/index.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - موقع تجريبي - https://srlee056.github.io/ar/ - Recent content on موقع تجريبي - Hugo -- gohugo.io - ar - Seorim Lee - Sat, 09 Mar 2019 00:00:00 +0000 - مثال نص - https://srlee056.github.io/ar/p/%D9%85%D8%AB%D8%A7%D9%84-%D9%86%D8%B5/ - Sat, 09 Mar 2019 00:00:00 +0000 - - https://srlee056.github.io/ar/p/%D9%85%D8%AB%D8%A7%D9%84-%D9%86%D8%B5/ - <img src="https://srlee056.github.io/ar/p/%D9%85%D8%AB%D8%A7%D9%84-%D9%86%D8%B5/matt-le-SJSpo9hQf7s-unsplash.jpg" alt="Featured image of post مثال نص" /><h2 id="فقرة-1">فقرة 1</h2> -<p>هذا النص هو مثال لنص يمكن أن يستبدل في نفس المساحة، لقد تم توليد هذا النص من <a class="link" href="https://colorslab.com/textgator/" target="_blank" rel="noopener" - >مولد النص العربى</a>، حيث يمكنك أن تولد مثل هذا النص أو العديد من النصوص الأخرى إضافة إلى زيادة عدد الحروف التى يولدها التطبيق. -إذا كنت تحتاج إلى عدد أكبر من الفقرات يتيح لك مولد النص العربى زيادة عدد الفقرات كما تريد، النص لن يبدو مقسما ولا يحوي أخطاء لغوية، مولد النص العربى مفيد لمصممي المواقع على وجه الخصوص، حيث يحتاج العميل فى كثير من الأحيان أن يطلع على صورة حقيقية لتصميم الموقع. -ومن هنا وجب على المصمم أن يضع نصوصا مؤقتة على التصميم ليظهر للعميل الشكل كاملاً،دور مولد النص العربى أن يوفر على المصمم عناء البحث عن نص بديل لا علاقة له بالموضوع الذى يتحدث عنه التصميم فيظهر بشكل لا يليق. -هذا النص يمكن أن يتم تركيبه على أي تصميم دون مشكلة فلن يبدو وكأنه نص منسوخ، غير منظم، غير منسق، أو حتى غير مفهوم. لأنه مازال نصاً بديلاً ومؤقتاً.</p> -<h2 id="فقرة-2">فقرة 2</h2> -<p>هذا النص هو مثال لنص يمكن أن يستبدل في نفس المساحة، لقد تم توليد هذا النص من <a class="link" href="https://colorslab.com/textgator/" target="_blank" rel="noopener" - >مولد النص العربى</a>، حيث يمكنك أن تولد مثل هذا النص أو العديد من النصوص الأخرى إضافة إلى زيادة عدد الحروف التى يولدها التطبيق. -إذا كنت تحتاج إلى عدد أكبر من الفقرات يتيح لك مولد النص العربى زيادة عدد الفقرات كما تريد، النص لن يبدو مقسما ولا يحوي أخطاء لغوية، مولد النص العربى مفيد لمصممي المواقع على وجه الخصوص، حيث يحتاج العميل فى كثير من الأحيان أن يطلع على صورة حقيقية لتصميم الموقع. -ومن هنا وجب على المصمم أن يضع نصوصا مؤقتة على التصميم ليظهر للعميل الشكل كاملاً،دور مولد النص العربى أن يوفر على المصمم عناء البحث عن نص بديل لا علاقة له بالموضوع الذى يتحدث عنه التصميم فيظهر بشكل لا يليق. -هذا النص يمكن أن يتم تركيبه على أي تصميم دون مشكلة فلن يبدو وكأنه نص منسوخ، غير منظم، غير منسق، أو حتى غير مفهوم. لأنه مازال نصاً بديلاً ومؤقتاً.</p> -<h2 id="تجربة-rtl">تجربة RTL</h2> -<p>كلمة 1 Text كلمة 2</p> - - - - - diff --git "a/public/ar/p/\331\205\330\253\330\247\331\204-\331\206\330\265/index.html" "b/public/ar/p/\331\205\330\253\330\247\331\204-\331\206\330\265/index.html" deleted file mode 100644 index 227f2c0..0000000 --- "a/public/ar/p/\331\205\330\253\330\247\331\204-\331\206\330\265/index.html" +++ /dev/null @@ -1,529 +0,0 @@ - - - - -مثال نص - - - - - - - - - - - - - - -
- - - - -
-
-
-
- - Featured image of post مثال نص - - -
- - -
- - - - -
-

- مثال نص -

- - -

- هذا النص هو مثال لنص يمكن أن يستبدل في نفس المساحة -

- -
- - - - - -
- -
- - - - - - - - - - -
- - - -
- - - - - - - - - -
- -
- - - -
- - - - - - - - - - - -
- - English - -
-
- -
- -
- -
- - -

فقرة 1

-

هذا النص هو مثال لنص يمكن أن يستبدل في نفس المساحة، لقد تم توليد هذا النص من مولد النص العربى، حيث يمكنك أن تولد مثل هذا النص أو العديد من النصوص الأخرى إضافة إلى زيادة عدد الحروف التى يولدها التطبيق. -إذا كنت تحتاج إلى عدد أكبر من الفقرات يتيح لك مولد النص العربى زيادة عدد الفقرات كما تريد، النص لن يبدو مقسما ولا يحوي أخطاء لغوية، مولد النص العربى مفيد لمصممي المواقع على وجه الخصوص، حيث يحتاج العميل فى كثير من الأحيان أن يطلع على صورة حقيقية لتصميم الموقع. -ومن هنا وجب على المصمم أن يضع نصوصا مؤقتة على التصميم ليظهر للعميل الشكل كاملاً،دور مولد النص العربى أن يوفر على المصمم عناء البحث عن نص بديل لا علاقة له بالموضوع الذى يتحدث عنه التصميم فيظهر بشكل لا يليق. -هذا النص يمكن أن يتم تركيبه على أي تصميم دون مشكلة فلن يبدو وكأنه نص منسوخ، غير منظم، غير منسق، أو حتى غير مفهوم. لأنه مازال نصاً بديلاً ومؤقتاً.

-

فقرة 2

-

هذا النص هو مثال لنص يمكن أن يستبدل في نفس المساحة، لقد تم توليد هذا النص من مولد النص العربى، حيث يمكنك أن تولد مثل هذا النص أو العديد من النصوص الأخرى إضافة إلى زيادة عدد الحروف التى يولدها التطبيق. -إذا كنت تحتاج إلى عدد أكبر من الفقرات يتيح لك مولد النص العربى زيادة عدد الفقرات كما تريد، النص لن يبدو مقسما ولا يحوي أخطاء لغوية، مولد النص العربى مفيد لمصممي المواقع على وجه الخصوص، حيث يحتاج العميل فى كثير من الأحيان أن يطلع على صورة حقيقية لتصميم الموقع. -ومن هنا وجب على المصمم أن يضع نصوصا مؤقتة على التصميم ليظهر للعميل الشكل كاملاً،دور مولد النص العربى أن يوفر على المصمم عناء البحث عن نص بديل لا علاقة له بالموضوع الذى يتحدث عنه التصميم فيظهر بشكل لا يليق. -هذا النص يمكن أن يتم تركيبه على أي تصميم دون مشكلة فلن يبدو وكأنه نص منسوخ، غير منظم، غير منسق، أو حتى غير مفهوم. لأنه مازال نصاً بديلاً ومؤقتاً.

-

تجربة RTL

-

كلمة 1 Text كلمة 2

- -
- - - - - - -
- - - - - - - - -
-
- - -comments powered by Disqus -
- - - - - - - -
- - -
- مبني بستخدام Hugo
- قالب Stack مصمم من Jimmy -
-
- - - - - -
-
- - - - - diff --git "a/public/ar/p/\331\205\330\253\330\247\331\204-\331\206\330\265/matt-le-SJSpo9hQf7s-unsplash.jpg" "b/public/ar/p/\331\205\330\253\330\247\331\204-\331\206\330\265/matt-le-SJSpo9hQf7s-unsplash.jpg" deleted file mode 100644 index 3b28790..0000000 Binary files "a/public/ar/p/\331\205\330\253\330\247\331\204-\331\206\330\265/matt-le-SJSpo9hQf7s-unsplash.jpg" and /dev/null differ diff --git "a/public/ar/p/\331\205\330\253\330\247\331\204-\331\206\330\265/matt-le-SJSpo9hQf7s-unsplash_hu958d513eeefe5556a31d065479ecc5ac_14205_120x120_fill_q75_box_smart1.jpg" "b/public/ar/p/\331\205\330\253\330\247\331\204-\331\206\330\265/matt-le-SJSpo9hQf7s-unsplash_hu958d513eeefe5556a31d065479ecc5ac_14205_120x120_fill_q75_box_smart1.jpg" deleted file mode 100644 index edfece9..0000000 Binary files "a/public/ar/p/\331\205\330\253\330\247\331\204-\331\206\330\265/matt-le-SJSpo9hQf7s-unsplash_hu958d513eeefe5556a31d065479ecc5ac_14205_120x120_fill_q75_box_smart1.jpg" and /dev/null differ diff --git "a/public/ar/p/\331\205\330\253\330\247\331\204-\331\206\330\265/matt-le-SJSpo9hQf7s-unsplash_hu958d513eeefe5556a31d065479ecc5ac_14205_1600x0_resize_q75_box.jpg" "b/public/ar/p/\331\205\330\253\330\247\331\204-\331\206\330\265/matt-le-SJSpo9hQf7s-unsplash_hu958d513eeefe5556a31d065479ecc5ac_14205_1600x0_resize_q75_box.jpg" deleted file mode 100644 index 9157b65..0000000 Binary files "a/public/ar/p/\331\205\330\253\330\247\331\204-\331\206\330\265/matt-le-SJSpo9hQf7s-unsplash_hu958d513eeefe5556a31d065479ecc5ac_14205_1600x0_resize_q75_box.jpg" and /dev/null differ diff --git "a/public/ar/p/\331\205\330\253\330\247\331\204-\331\206\330\265/matt-le-SJSpo9hQf7s-unsplash_hu958d513eeefe5556a31d065479ecc5ac_14205_800x0_resize_q75_box.jpg" "b/public/ar/p/\331\205\330\253\330\247\331\204-\331\206\330\265/matt-le-SJSpo9hQf7s-unsplash_hu958d513eeefe5556a31d065479ecc5ac_14205_800x0_resize_q75_box.jpg" deleted file mode 100644 index 5ddd357..0000000 Binary files "a/public/ar/p/\331\205\330\253\330\247\331\204-\331\206\330\265/matt-le-SJSpo9hQf7s-unsplash_hu958d513eeefe5556a31d065479ecc5ac_14205_800x0_resize_q75_box.jpg" and /dev/null differ diff --git a/public/ar/page/1/index.html b/public/ar/page/1/index.html deleted file mode 100644 index b292bfd..0000000 --- a/public/ar/page/1/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - https://srlee056.github.io/ar/ - - - - - - diff --git a/public/ar/post/index.html b/public/ar/post/index.html deleted file mode 100644 index 74eb6d3..0000000 --- a/public/ar/post/index.html +++ /dev/null @@ -1,321 +0,0 @@ - - - - -Posts - - - - - - - - - - - - - -
- - - - -
-
-

- - قسم - -

- -
-
-

1 صفحه

-

Posts

- -
-
-
- -
- - - -
-
- - -
- مبني بستخدام Hugo
- قالب Stack مصمم من Jimmy -
-
- - -
-
- - - - - diff --git a/public/ar/post/index.xml b/public/ar/post/index.xml deleted file mode 100644 index d88063f..0000000 --- a/public/ar/post/index.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - Posts on موقع تجريبي - https://srlee056.github.io/ar/post/ - Recent content in Posts on موقع تجريبي - Hugo -- gohugo.io - ar - Seorim Lee - Sat, 09 Mar 2019 00:00:00 +0000 - مثال نص - https://srlee056.github.io/ar/p/%D9%85%D8%AB%D8%A7%D9%84-%D9%86%D8%B5/ - Sat, 09 Mar 2019 00:00:00 +0000 - - https://srlee056.github.io/ar/p/%D9%85%D8%AB%D8%A7%D9%84-%D9%86%D8%B5/ - <img src="https://srlee056.github.io/ar/p/%D9%85%D8%AB%D8%A7%D9%84-%D9%86%D8%B5/matt-le-SJSpo9hQf7s-unsplash.jpg" alt="Featured image of post مثال نص" /><h2 id="فقرة-1">فقرة 1</h2> -<p>هذا النص هو مثال لنص يمكن أن يستبدل في نفس المساحة، لقد تم توليد هذا النص من <a class="link" href="https://colorslab.com/textgator/" target="_blank" rel="noopener" - >مولد النص العربى</a>، حيث يمكنك أن تولد مثل هذا النص أو العديد من النصوص الأخرى إضافة إلى زيادة عدد الحروف التى يولدها التطبيق. -إذا كنت تحتاج إلى عدد أكبر من الفقرات يتيح لك مولد النص العربى زيادة عدد الفقرات كما تريد، النص لن يبدو مقسما ولا يحوي أخطاء لغوية، مولد النص العربى مفيد لمصممي المواقع على وجه الخصوص، حيث يحتاج العميل فى كثير من الأحيان أن يطلع على صورة حقيقية لتصميم الموقع. -ومن هنا وجب على المصمم أن يضع نصوصا مؤقتة على التصميم ليظهر للعميل الشكل كاملاً،دور مولد النص العربى أن يوفر على المصمم عناء البحث عن نص بديل لا علاقة له بالموضوع الذى يتحدث عنه التصميم فيظهر بشكل لا يليق. -هذا النص يمكن أن يتم تركيبه على أي تصميم دون مشكلة فلن يبدو وكأنه نص منسوخ، غير منظم، غير منسق، أو حتى غير مفهوم. لأنه مازال نصاً بديلاً ومؤقتاً.</p> -<h2 id="فقرة-2">فقرة 2</h2> -<p>هذا النص هو مثال لنص يمكن أن يستبدل في نفس المساحة، لقد تم توليد هذا النص من <a class="link" href="https://colorslab.com/textgator/" target="_blank" rel="noopener" - >مولد النص العربى</a>، حيث يمكنك أن تولد مثل هذا النص أو العديد من النصوص الأخرى إضافة إلى زيادة عدد الحروف التى يولدها التطبيق. -إذا كنت تحتاج إلى عدد أكبر من الفقرات يتيح لك مولد النص العربى زيادة عدد الفقرات كما تريد، النص لن يبدو مقسما ولا يحوي أخطاء لغوية، مولد النص العربى مفيد لمصممي المواقع على وجه الخصوص، حيث يحتاج العميل فى كثير من الأحيان أن يطلع على صورة حقيقية لتصميم الموقع. -ومن هنا وجب على المصمم أن يضع نصوصا مؤقتة على التصميم ليظهر للعميل الشكل كاملاً،دور مولد النص العربى أن يوفر على المصمم عناء البحث عن نص بديل لا علاقة له بالموضوع الذى يتحدث عنه التصميم فيظهر بشكل لا يليق. -هذا النص يمكن أن يتم تركيبه على أي تصميم دون مشكلة فلن يبدو وكأنه نص منسوخ، غير منظم، غير منسق، أو حتى غير مفهوم. لأنه مازال نصاً بديلاً ومؤقتاً.</p> -<h2 id="تجربة-rtl">تجربة RTL</h2> -<p>كلمة 1 Text كلمة 2</p> - - - - - diff --git a/public/ar/post/page/1/index.html b/public/ar/post/page/1/index.html deleted file mode 100644 index 6a11f9e..0000000 --- a/public/ar/post/page/1/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - https://srlee056.github.io/ar/post/ - - - - - - diff --git a/public/ar/sitemap.xml b/public/ar/sitemap.xml deleted file mode 100644 index a975636..0000000 --- a/public/ar/sitemap.xml +++ /dev/null @@ -1,120 +0,0 @@ - - - - https://srlee056.github.io/ar/categories/ - 2019-03-09T00:00:00+00:00 - - - - - - https://srlee056.github.io/ar/post/ - 2019-03-09T00:00:00+00:00 - - - - - https://srlee056.github.io/ar/tags/ - 2019-03-09T00:00:00+00:00 - - - - - - https://srlee056.github.io/ar/categories/%D8%AA%D8%AC%D8%B1%D8%A8%D8%A9/ - 2019-03-09T00:00:00+00:00 - - https://srlee056.github.io/ar/categories/%D8%AA%D8%AC%D8%B1%D8%A8%D8%A9-%D9%85%D8%B9-%D9%81%D8%B1%D8%A7%D8%BA%D8%A7%D8%AA/ - 2019-03-09T00:00:00+00:00 - - https://srlee056.github.io/ar/tags/%D9%85%D8%A7%D8%B1%D9%83%D8%AF%D8%A7%D9%88%D9%86/ - 2019-03-09T00:00:00+00:00 - - https://srlee056.github.io/ar/p/%D9%85%D8%AB%D8%A7%D9%84-%D9%86%D8%B5/ - 2019-03-09T00:00:00+00:00 - - - - https://srlee056.github.io/ar/ - 2019-03-09T00:00:00+00:00 - - - - - - https://srlee056.github.io/ar/tags/%D9%86%D8%B5/ - 2019-03-09T00:00:00+00:00 - - https://srlee056.github.io/ar/tags/%D9%88%D8%B3%D9%85-%D9%85%D8%B9-%D9%81%D8%B1%D8%A7%D8%BA%D8%A7%D8%AA/ - 2019-03-09T00:00:00+00:00 - - diff --git a/public/ar/tags/index.html b/public/ar/tags/index.html deleted file mode 100644 index a42b55f..0000000 --- a/public/ar/tags/index.html +++ /dev/null @@ -1,335 +0,0 @@ - - - - -Tags - - - - - - - - - - - - - -
- - - - -
-
-

- - قسم - -

- -
-
-

3 صفحات

-

Tags

- -
-
-
- - -
- - - - - - - -
-
- - -
- مبني بستخدام Hugo
- قالب Stack مصمم من Jimmy -
-
- - -
-
- - - - - diff --git a/public/ar/tags/index.xml b/public/ar/tags/index.xml deleted file mode 100644 index f25bed3..0000000 --- a/public/ar/tags/index.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - Tags on موقع تجريبي - https://srlee056.github.io/ar/tags/ - Recent content in Tags on موقع تجريبي - Hugo -- gohugo.io - ar - Seorim Lee - Sat, 09 Mar 2019 00:00:00 +0000 - ماركداون - https://srlee056.github.io/ar/tags/%D9%85%D8%A7%D8%B1%D9%83%D8%AF%D8%A7%D9%88%D9%86/ - Sat, 09 Mar 2019 00:00:00 +0000 - - https://srlee056.github.io/ar/tags/%D9%85%D8%A7%D8%B1%D9%83%D8%AF%D8%A7%D9%88%D9%86/ - - - - نص - https://srlee056.github.io/ar/tags/%D9%86%D8%B5/ - Sat, 09 Mar 2019 00:00:00 +0000 - - https://srlee056.github.io/ar/tags/%D9%86%D8%B5/ - - - - وسم مع فراغات - https://srlee056.github.io/ar/tags/%D9%88%D8%B3%D9%85-%D9%85%D8%B9-%D9%81%D8%B1%D8%A7%D8%BA%D8%A7%D8%AA/ - Sat, 09 Mar 2019 00:00:00 +0000 - - https://srlee056.github.io/ar/tags/%D9%88%D8%B3%D9%85-%D9%85%D8%B9-%D9%81%D8%B1%D8%A7%D8%BA%D8%A7%D8%AA/ - - - - - diff --git a/public/ar/tags/page/1/index.html b/public/ar/tags/page/1/index.html deleted file mode 100644 index 47ecde5..0000000 --- a/public/ar/tags/page/1/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - https://srlee056.github.io/ar/tags/ - - - - - - diff --git "a/public/ar/tags/\331\205\330\247\330\261\331\203\330\257\330\247\331\210\331\206/index.html" "b/public/ar/tags/\331\205\330\247\330\261\331\203\330\257\330\247\331\210\331\206/index.html" deleted file mode 100644 index 1ad39a5..0000000 --- "a/public/ar/tags/\331\205\330\247\330\261\331\203\330\257\330\247\331\210\331\206/index.html" +++ /dev/null @@ -1,321 +0,0 @@ - - - - -Tag: ماركداون - موقع تجريبي - - - - - - - - - - - - - -
- - - - -
-
-

- - Tags - -

- -
-
-

1 صفحه

-

ماركداون

- -
-
-
- -
- - - -
-
- - -
- مبني بستخدام Hugo
- قالب Stack مصمم من Jimmy -
-
- - -
-
- - - - - diff --git "a/public/ar/tags/\331\205\330\247\330\261\331\203\330\257\330\247\331\210\331\206/index.xml" "b/public/ar/tags/\331\205\330\247\330\261\331\203\330\257\330\247\331\210\331\206/index.xml" deleted file mode 100644 index c37878b..0000000 --- "a/public/ar/tags/\331\205\330\247\330\261\331\203\330\257\330\247\331\210\331\206/index.xml" +++ /dev/null @@ -1,34 +0,0 @@ - - - - ماركداون on موقع تجريبي - https://srlee056.github.io/ar/tags/%D9%85%D8%A7%D8%B1%D9%83%D8%AF%D8%A7%D9%88%D9%86/ - Recent content in ماركداون on موقع تجريبي - Hugo -- gohugo.io - ar - Seorim Lee - Sat, 09 Mar 2019 00:00:00 +0000 - مثال نص - https://srlee056.github.io/ar/p/%D9%85%D8%AB%D8%A7%D9%84-%D9%86%D8%B5/ - Sat, 09 Mar 2019 00:00:00 +0000 - - https://srlee056.github.io/ar/p/%D9%85%D8%AB%D8%A7%D9%84-%D9%86%D8%B5/ - <img src="https://srlee056.github.io/ar/p/%D9%85%D8%AB%D8%A7%D9%84-%D9%86%D8%B5/matt-le-SJSpo9hQf7s-unsplash.jpg" alt="Featured image of post مثال نص" /><h2 id="فقرة-1">فقرة 1</h2> -<p>هذا النص هو مثال لنص يمكن أن يستبدل في نفس المساحة، لقد تم توليد هذا النص من <a class="link" href="https://colorslab.com/textgator/" target="_blank" rel="noopener" - >مولد النص العربى</a>، حيث يمكنك أن تولد مثل هذا النص أو العديد من النصوص الأخرى إضافة إلى زيادة عدد الحروف التى يولدها التطبيق. -إذا كنت تحتاج إلى عدد أكبر من الفقرات يتيح لك مولد النص العربى زيادة عدد الفقرات كما تريد، النص لن يبدو مقسما ولا يحوي أخطاء لغوية، مولد النص العربى مفيد لمصممي المواقع على وجه الخصوص، حيث يحتاج العميل فى كثير من الأحيان أن يطلع على صورة حقيقية لتصميم الموقع. -ومن هنا وجب على المصمم أن يضع نصوصا مؤقتة على التصميم ليظهر للعميل الشكل كاملاً،دور مولد النص العربى أن يوفر على المصمم عناء البحث عن نص بديل لا علاقة له بالموضوع الذى يتحدث عنه التصميم فيظهر بشكل لا يليق. -هذا النص يمكن أن يتم تركيبه على أي تصميم دون مشكلة فلن يبدو وكأنه نص منسوخ، غير منظم، غير منسق، أو حتى غير مفهوم. لأنه مازال نصاً بديلاً ومؤقتاً.</p> -<h2 id="فقرة-2">فقرة 2</h2> -<p>هذا النص هو مثال لنص يمكن أن يستبدل في نفس المساحة، لقد تم توليد هذا النص من <a class="link" href="https://colorslab.com/textgator/" target="_blank" rel="noopener" - >مولد النص العربى</a>، حيث يمكنك أن تولد مثل هذا النص أو العديد من النصوص الأخرى إضافة إلى زيادة عدد الحروف التى يولدها التطبيق. -إذا كنت تحتاج إلى عدد أكبر من الفقرات يتيح لك مولد النص العربى زيادة عدد الفقرات كما تريد، النص لن يبدو مقسما ولا يحوي أخطاء لغوية، مولد النص العربى مفيد لمصممي المواقع على وجه الخصوص، حيث يحتاج العميل فى كثير من الأحيان أن يطلع على صورة حقيقية لتصميم الموقع. -ومن هنا وجب على المصمم أن يضع نصوصا مؤقتة على التصميم ليظهر للعميل الشكل كاملاً،دور مولد النص العربى أن يوفر على المصمم عناء البحث عن نص بديل لا علاقة له بالموضوع الذى يتحدث عنه التصميم فيظهر بشكل لا يليق. -هذا النص يمكن أن يتم تركيبه على أي تصميم دون مشكلة فلن يبدو وكأنه نص منسوخ، غير منظم، غير منسق، أو حتى غير مفهوم. لأنه مازال نصاً بديلاً ومؤقتاً.</p> -<h2 id="تجربة-rtl">تجربة RTL</h2> -<p>كلمة 1 Text كلمة 2</p> - - - - - diff --git "a/public/ar/tags/\331\205\330\247\330\261\331\203\330\257\330\247\331\210\331\206/page/1/index.html" "b/public/ar/tags/\331\205\330\247\330\261\331\203\330\257\330\247\331\210\331\206/page/1/index.html" deleted file mode 100644 index 835bccf..0000000 --- "a/public/ar/tags/\331\205\330\247\330\261\331\203\330\257\330\247\331\210\331\206/page/1/index.html" +++ /dev/null @@ -1,10 +0,0 @@ - - - - https://srlee056.github.io/ar/tags/%D9%85%D8%A7%D8%B1%D9%83%D8%AF%D8%A7%D9%88%D9%86/ - - - - - - diff --git "a/public/ar/tags/\331\206\330\265/index.html" "b/public/ar/tags/\331\206\330\265/index.html" deleted file mode 100644 index a333ae2..0000000 --- "a/public/ar/tags/\331\206\330\265/index.html" +++ /dev/null @@ -1,321 +0,0 @@ - - - - -Tag: نص - موقع تجريبي - - - - - - - - - - - - - -
- - - - -
-
-

- - Tags - -

- -
-
-

1 صفحه

-

نص

- -
-
-
- -
- - - -
-
- - -
- مبني بستخدام Hugo
- قالب Stack مصمم من Jimmy -
-
- - -
-
- - - - - diff --git "a/public/ar/tags/\331\206\330\265/index.xml" "b/public/ar/tags/\331\206\330\265/index.xml" deleted file mode 100644 index 820d880..0000000 --- "a/public/ar/tags/\331\206\330\265/index.xml" +++ /dev/null @@ -1,34 +0,0 @@ - - - - نص on موقع تجريبي - https://srlee056.github.io/ar/tags/%D9%86%D8%B5/ - Recent content in نص on موقع تجريبي - Hugo -- gohugo.io - ar - Seorim Lee - Sat, 09 Mar 2019 00:00:00 +0000 - مثال نص - https://srlee056.github.io/ar/p/%D9%85%D8%AB%D8%A7%D9%84-%D9%86%D8%B5/ - Sat, 09 Mar 2019 00:00:00 +0000 - - https://srlee056.github.io/ar/p/%D9%85%D8%AB%D8%A7%D9%84-%D9%86%D8%B5/ - <img src="https://srlee056.github.io/ar/p/%D9%85%D8%AB%D8%A7%D9%84-%D9%86%D8%B5/matt-le-SJSpo9hQf7s-unsplash.jpg" alt="Featured image of post مثال نص" /><h2 id="فقرة-1">فقرة 1</h2> -<p>هذا النص هو مثال لنص يمكن أن يستبدل في نفس المساحة، لقد تم توليد هذا النص من <a class="link" href="https://colorslab.com/textgator/" target="_blank" rel="noopener" - >مولد النص العربى</a>، حيث يمكنك أن تولد مثل هذا النص أو العديد من النصوص الأخرى إضافة إلى زيادة عدد الحروف التى يولدها التطبيق. -إذا كنت تحتاج إلى عدد أكبر من الفقرات يتيح لك مولد النص العربى زيادة عدد الفقرات كما تريد، النص لن يبدو مقسما ولا يحوي أخطاء لغوية، مولد النص العربى مفيد لمصممي المواقع على وجه الخصوص، حيث يحتاج العميل فى كثير من الأحيان أن يطلع على صورة حقيقية لتصميم الموقع. -ومن هنا وجب على المصمم أن يضع نصوصا مؤقتة على التصميم ليظهر للعميل الشكل كاملاً،دور مولد النص العربى أن يوفر على المصمم عناء البحث عن نص بديل لا علاقة له بالموضوع الذى يتحدث عنه التصميم فيظهر بشكل لا يليق. -هذا النص يمكن أن يتم تركيبه على أي تصميم دون مشكلة فلن يبدو وكأنه نص منسوخ، غير منظم، غير منسق، أو حتى غير مفهوم. لأنه مازال نصاً بديلاً ومؤقتاً.</p> -<h2 id="فقرة-2">فقرة 2</h2> -<p>هذا النص هو مثال لنص يمكن أن يستبدل في نفس المساحة، لقد تم توليد هذا النص من <a class="link" href="https://colorslab.com/textgator/" target="_blank" rel="noopener" - >مولد النص العربى</a>، حيث يمكنك أن تولد مثل هذا النص أو العديد من النصوص الأخرى إضافة إلى زيادة عدد الحروف التى يولدها التطبيق. -إذا كنت تحتاج إلى عدد أكبر من الفقرات يتيح لك مولد النص العربى زيادة عدد الفقرات كما تريد، النص لن يبدو مقسما ولا يحوي أخطاء لغوية، مولد النص العربى مفيد لمصممي المواقع على وجه الخصوص، حيث يحتاج العميل فى كثير من الأحيان أن يطلع على صورة حقيقية لتصميم الموقع. -ومن هنا وجب على المصمم أن يضع نصوصا مؤقتة على التصميم ليظهر للعميل الشكل كاملاً،دور مولد النص العربى أن يوفر على المصمم عناء البحث عن نص بديل لا علاقة له بالموضوع الذى يتحدث عنه التصميم فيظهر بشكل لا يليق. -هذا النص يمكن أن يتم تركيبه على أي تصميم دون مشكلة فلن يبدو وكأنه نص منسوخ، غير منظم، غير منسق، أو حتى غير مفهوم. لأنه مازال نصاً بديلاً ومؤقتاً.</p> -<h2 id="تجربة-rtl">تجربة RTL</h2> -<p>كلمة 1 Text كلمة 2</p> - - - - - diff --git "a/public/ar/tags/\331\206\330\265/page/1/index.html" "b/public/ar/tags/\331\206\330\265/page/1/index.html" deleted file mode 100644 index 3bd4982..0000000 --- "a/public/ar/tags/\331\206\330\265/page/1/index.html" +++ /dev/null @@ -1,10 +0,0 @@ - - - - https://srlee056.github.io/ar/tags/%D9%86%D8%B5/ - - - - - - diff --git "a/public/ar/tags/\331\210\330\263\331\205-\331\205\330\271-\331\201\330\261\330\247\330\272\330\247\330\252/index.html" "b/public/ar/tags/\331\210\330\263\331\205-\331\205\330\271-\331\201\330\261\330\247\330\272\330\247\330\252/index.html" deleted file mode 100644 index 966a046..0000000 --- "a/public/ar/tags/\331\210\330\263\331\205-\331\205\330\271-\331\201\330\261\330\247\330\272\330\247\330\252/index.html" +++ /dev/null @@ -1,321 +0,0 @@ - - - - -Tag: وسم مع فراغات - موقع تجريبي - - - - - - - - - - - - - -
- - - - -
-
-

- - Tags - -

- -
-
-

1 صفحه

-

وسم مع فراغات

- -
-
-
- -
- - - -
-
- - -
- مبني بستخدام Hugo
- قالب Stack مصمم من Jimmy -
-
- - -
-
- - - - - diff --git "a/public/ar/tags/\331\210\330\263\331\205-\331\205\330\271-\331\201\330\261\330\247\330\272\330\247\330\252/index.xml" "b/public/ar/tags/\331\210\330\263\331\205-\331\205\330\271-\331\201\330\261\330\247\330\272\330\247\330\252/index.xml" deleted file mode 100644 index 8b9a295..0000000 --- "a/public/ar/tags/\331\210\330\263\331\205-\331\205\330\271-\331\201\330\261\330\247\330\272\330\247\330\252/index.xml" +++ /dev/null @@ -1,34 +0,0 @@ - - - - وسم مع فراغات on موقع تجريبي - https://srlee056.github.io/ar/tags/%D9%88%D8%B3%D9%85-%D9%85%D8%B9-%D9%81%D8%B1%D8%A7%D8%BA%D8%A7%D8%AA/ - Recent content in وسم مع فراغات on موقع تجريبي - Hugo -- gohugo.io - ar - Seorim Lee - Sat, 09 Mar 2019 00:00:00 +0000 - مثال نص - https://srlee056.github.io/ar/p/%D9%85%D8%AB%D8%A7%D9%84-%D9%86%D8%B5/ - Sat, 09 Mar 2019 00:00:00 +0000 - - https://srlee056.github.io/ar/p/%D9%85%D8%AB%D8%A7%D9%84-%D9%86%D8%B5/ - <img src="https://srlee056.github.io/ar/p/%D9%85%D8%AB%D8%A7%D9%84-%D9%86%D8%B5/matt-le-SJSpo9hQf7s-unsplash.jpg" alt="Featured image of post مثال نص" /><h2 id="فقرة-1">فقرة 1</h2> -<p>هذا النص هو مثال لنص يمكن أن يستبدل في نفس المساحة، لقد تم توليد هذا النص من <a class="link" href="https://colorslab.com/textgator/" target="_blank" rel="noopener" - >مولد النص العربى</a>، حيث يمكنك أن تولد مثل هذا النص أو العديد من النصوص الأخرى إضافة إلى زيادة عدد الحروف التى يولدها التطبيق. -إذا كنت تحتاج إلى عدد أكبر من الفقرات يتيح لك مولد النص العربى زيادة عدد الفقرات كما تريد، النص لن يبدو مقسما ولا يحوي أخطاء لغوية، مولد النص العربى مفيد لمصممي المواقع على وجه الخصوص، حيث يحتاج العميل فى كثير من الأحيان أن يطلع على صورة حقيقية لتصميم الموقع. -ومن هنا وجب على المصمم أن يضع نصوصا مؤقتة على التصميم ليظهر للعميل الشكل كاملاً،دور مولد النص العربى أن يوفر على المصمم عناء البحث عن نص بديل لا علاقة له بالموضوع الذى يتحدث عنه التصميم فيظهر بشكل لا يليق. -هذا النص يمكن أن يتم تركيبه على أي تصميم دون مشكلة فلن يبدو وكأنه نص منسوخ، غير منظم، غير منسق، أو حتى غير مفهوم. لأنه مازال نصاً بديلاً ومؤقتاً.</p> -<h2 id="فقرة-2">فقرة 2</h2> -<p>هذا النص هو مثال لنص يمكن أن يستبدل في نفس المساحة، لقد تم توليد هذا النص من <a class="link" href="https://colorslab.com/textgator/" target="_blank" rel="noopener" - >مولد النص العربى</a>، حيث يمكنك أن تولد مثل هذا النص أو العديد من النصوص الأخرى إضافة إلى زيادة عدد الحروف التى يولدها التطبيق. -إذا كنت تحتاج إلى عدد أكبر من الفقرات يتيح لك مولد النص العربى زيادة عدد الفقرات كما تريد، النص لن يبدو مقسما ولا يحوي أخطاء لغوية، مولد النص العربى مفيد لمصممي المواقع على وجه الخصوص، حيث يحتاج العميل فى كثير من الأحيان أن يطلع على صورة حقيقية لتصميم الموقع. -ومن هنا وجب على المصمم أن يضع نصوصا مؤقتة على التصميم ليظهر للعميل الشكل كاملاً،دور مولد النص العربى أن يوفر على المصمم عناء البحث عن نص بديل لا علاقة له بالموضوع الذى يتحدث عنه التصميم فيظهر بشكل لا يليق. -هذا النص يمكن أن يتم تركيبه على أي تصميم دون مشكلة فلن يبدو وكأنه نص منسوخ، غير منظم، غير منسق، أو حتى غير مفهوم. لأنه مازال نصاً بديلاً ومؤقتاً.</p> -<h2 id="تجربة-rtl">تجربة RTL</h2> -<p>كلمة 1 Text كلمة 2</p> - - - - - diff --git "a/public/ar/tags/\331\210\330\263\331\205-\331\205\330\271-\331\201\330\261\330\247\330\272\330\247\330\252/page/1/index.html" "b/public/ar/tags/\331\210\330\263\331\205-\331\205\330\271-\331\201\330\261\330\247\330\272\330\247\330\252/page/1/index.html" deleted file mode 100644 index 1140d44..0000000 --- "a/public/ar/tags/\331\210\330\263\331\205-\331\205\330\271-\331\201\330\261\330\247\330\272\330\247\330\252/page/1/index.html" +++ /dev/null @@ -1,10 +0,0 @@ - - - - https://srlee056.github.io/ar/tags/%D9%88%D8%B3%D9%85-%D9%85%D8%B9-%D9%81%D8%B1%D8%A7%D8%BA%D8%A7%D8%AA/ - - - - - - diff --git a/public/archives/index.html b/public/archives/index.html index 17bbb3b..22953e0 100644 --- a/public/archives/index.html +++ b/public/archives/index.html @@ -1,5 +1,5 @@ - + Archives @@ -9,10 +9,12 @@ - + + +
@@ -273,12 +271,12 @@

Categories

- +
-

syntax

+

DevCourse

@@ -286,12 +284,12 @@

syntax

- +
-

themes

+

Blog

@@ -321,19 +319,6 @@

Test

- -
- - - - -
-

Test with whitespaces

-
-
-
- - @@ -345,89 +330,106 @@

Test with whitespaces

-
-

2019

+
+

2023

+ + + + + + + + @@ -443,8 +445,8 @@

Emoji Support

- Built with Hugo
- Theme Stack designed by Jimmy + Hugo로 만듦
+ JimmyStack 테마 사용 중
diff --git a/public/p/placeholder-text/index.html b/public/blog-1/index.html similarity index 65% rename from public/p/placeholder-text/index.html rename to public/blog-1/index.html index 5dd5620..0553c4d 100644 --- a/public/p/placeholder-text/index.html +++ b/public/blog-1/index.html @@ -1,19 +1,20 @@ - + - -Placeholder Text - - - - - - - - - - - + +Blog 제작기 #1 + + + + + + + + + + + +
@@ -285,12 +282,19 @@

좋은 개발자로 한걸음 더

-

Table of contents

+

목차

@@ -302,31 +306,15 @@

Table of contents

-
@@ -409,30 +360,93 @@

-

Lorem est tota propiore conpellat pectoribus de pectora summo.

-

Redit teque digerit hominumque toris verebor lumina non cervice subde tollit usus habet Arctonque, furores quas nec ferunt. Quoque montibus nunc caluere tempus inhospita parcite confusaque translucet patri vestro qui optatis lumine cognoscere flos nubis! Fronde ipsamque patulos Dryopen deorum.

-
    -
  1. Exierant elisi ambit vivere dedere
  2. -
  3. Duce pollice
  4. -
  5. Eris modo
  6. -
  7. Spargitque ferrea quos palude
  8. -
-

Rursus nulli murmur; hastile inridet ut ab gravi sententia! Nomine potitus silentia flumen, sustinet placuit petis in dilapsa erat sunt. Atria tractus malis.

+

1일차 TIL에서 이어지는 블로그 제작기 입니다. :>

+

(아직 제작중인)블로그를 구경하시려면 클릭하세요!

+

1. 로컬에서 휴고 사이트 만들기

+
+ +
+
1
+2
+3
+4
+5
+6
+
+
hugo new site blog
+cd blog
+git init
+git submodule add https://github.com/CaiJimmy/hugo-theme-stack/ themes/hugo-theme-stack
+echo "theme = 'hugo-theme-stack'" >> hugo.toml
+hugo server
+
+
+

나는 가이드에 적힌 theme과는 다른 hugo-theme-stack을 사용했다. +가이드에는 새 post를 만들고 config 파일인 hugo.toml을 수정하는 부분도 나와있지만, 이후에 둘 다 다른 내용으로 덮어써서 넘어가도 되는 과정이었다.

+

2. theme 커스터마이징하기

+

themes/hugo-theme-stack/exampleSite/config.yaml 파일 내용을 변환하여 제일 상위 폴더의 ./hugo.toml 파일에 붙여넣고,
+(구글에 ‘yaml to toml’로 검색하면 많은 converter를 볼 수 있다.)

+

themes/hugo-theme-stack/exampleSite/contetns/ 안의 파일들을 ./contetns 에 붙여넣었다.

+

이 과정에는 이 블로그 글을 많이 참고했다. 정말 감사합니다👍🏻

+

hugo.toml 파일에 오류가 좀 있는 것 같지만

    -
  1. Comas hunc haec pietate fetum procerum dixit
  2. -
  3. Post torum vates letum Tiresia
  4. -
  5. Flumen querellas
  6. -
  7. Arcanaque montibus omnes
  8. -
  9. Quidem et
  10. +
  11. 내가 아직 hugo configuration 관련해서 잘 모르고
  12. +
  13. 오류가 있는데도 서버가 잘 돌아가고 빌드도 돼서 +나중에 고치기로 했다. (🤔 이게 왜 되지?)
-

Vagus elidunt

-

-

The Van de Graaf Canon

-

Mane refeci capiebant unda mulcebat

-

Victa caducifer, malo vulnere contra dicere aurato, ludit regale, voca! Retorsit colit est profanae esse virescere furit nec; iaculi matertera et visa est, viribus. Divesque creatis, tecta novat collumque vulnus est, parvas. Faces illo pepulere tempus adest. Tendit flamma, ab opes virum sustinet, sidus sequendo urbis.

-

Iubar proles corpore raptos vero auctor imperium; sed et huic: manus caeli Lelegas tu lux. Verbis obstitit intus oblectamina fixis linguisque ausus sperare Echionides cornuaque tenent clausit possit. Omnia putatur. Praeteritae refert ausus; ferebant e primus lora nutat, vici quae mea ipse. Et iter nil spectatae vulnus haerentia iuste et exercebat, sui et.

-

Eurytus Hector, materna ipsumque ut Politen, nec, nate, ignari, vernum cohaesit sequitur. Vel mitis temploque vocatus, inque alis, oculos nomen non silvis corpore coniunx ne displicet illa. Crescunt non unus, vidit visa quantum inmiti flumina mortis facto sic: undique a alios vincula sunt iactata abdita! Suspenderat ego fuit tendit: luna, ante urbem Propoetides parte.

+

3. 배포하기

+

(사실 배포가 제일 쉬웠다) +github 사이트에서 <username>.github.io 이름의 레포지토리를 만들고 +로컬에서 변경 내용을 모두 commit한 이후,

+
+ +
+
1
+
+
git remote add origin https://github.com/<username>/<username>.github.io.git
+
+
+

위 커맨드를 입력해 로컬과 원격 레포지토리를 연결한다. +

+
+ +
+
1
+
+
git push -u origin master
+
+
+

그리고 push하면 레포지토리 관련은 끝. (branch 관련 건드린 게 있다면 push하기 전에 master로 옮길것.) ++) 요즘은 master가 아닌 main branch로 바뀌었더라. +

+

빌드와 배포는 git actions기능을 활용했는데, hugo 사이트에 github hosting 가이드라인이 잘 적혀있다.

+

이 링크의 내용을 요약하자면

+
    +
  • 레포지토리 settings/pages에서 source를 GitHub Actions로 변경
  • +
  • 로컬에서 .github/workflows/hugo.yaml 파일 생성 후 내용 붙여넣기 (폴더도 직접 생성해줘야함)
  • +
  • 변경사항을 commit, push한 이후 레포지토리의 Actions 탭에 들어가면 빌드/배포 기능을 하는 Action이 추가됨
  • +
  • Run Workflow 버튼을 누르면 빌드/배포가 자동으로 진행되며 내 github page에 테마가 적용된 사이트가 잘 올라와 있다.
  • +
+

왜인지 모르겠지만 잘 돌아가는 블로그

+

블로그 github repo.

+
+

느낀점

+

전체적으로 해결하지 못한 오류도 많고, 이해하지 못한 구조도 많지만 오늘은 배포에 성공한 것에 의의를 두려고 한다.🥲

+

다음엔?

+
    +
  • hugo로 포스트 올리기
  • +
  • 오류 해결하기 (layout 인식 문제 등)
  • +
  • theme custom 으로 링크 등 UI 추가해보기
  • +
+
@@ -440,11 +454,11 @@

Mane refeci capiebant unda mulcebat @@ -472,29 +486,18 @@

Mane refeci capiebant unda mulcebat + + + + +
+ + + + + +
+ +
+
+ + +
+ Built with Hugo
+ Theme Stack designed by Jimmy +
+
+ +
+ + + + + diff --git a/public/ko/index.xml b/public/en/index.xml similarity index 53% rename from public/ko/index.xml rename to public/en/index.xml index 24cc6c5..77e037d 100644 --- a/public/ko/index.xml +++ b/public/en/index.xml @@ -1,11 +1,11 @@ - 서림록 - https://srlee056.github.io/ko/ - Recent content on 서림록 + Seorim Log + https://srlee056.github.io/en/ + Recent content on Seorim Log Hugo -- gohugo.io - ko - Seorim Lee + en + Seorim Lee diff --git a/public/en/page/1/index.html b/public/en/page/1/index.html new file mode 100644 index 0000000..3b12c7d --- /dev/null +++ b/public/en/page/1/index.html @@ -0,0 +1,10 @@ + + + + https://srlee056.github.io/en/ + + + + + + diff --git a/public/en/sitemap.xml b/public/en/sitemap.xml index cc974f9..4ff4c2d 100644 --- a/public/en/sitemap.xml +++ b/public/en/sitemap.xml @@ -2,198 +2,40 @@ - https://srlee056.github.io/ - 2020-10-09T00:00:00+00:00 - - + https://srlee056.github.io/en/categories/ - - - https://srlee056.github.io/archives/ - 2019-05-28T00:00:00+00:00 - - https://srlee056.github.io/page/ - 2020-10-09T00:00:00+00:00 - - https://srlee056.github.io/categories/ - 2019-03-11T00:00:00+00:00 - - + https://srlee056.github.io/en/ - - - https://srlee056.github.io/tags/css/ - 2019-03-11T00:00:00+00:00 - - https://srlee056.github.io/tags/html/ - 2019-03-11T00:00:00+00:00 - - https://srlee056.github.io/tags/markdown/ - 2019-03-11T00:00:00+00:00 - - https://srlee056.github.io/p/markdown-syntax-guide/ - 2019-03-11T00:00:00+00:00 - - https://srlee056.github.io/post/ - 2019-03-11T00:00:00+00:00 - - - https://srlee056.github.io/categories/syntax/ - 2019-03-11T00:00:00+00:00 - - https://srlee056.github.io/tags/ - 2019-03-11T00:00:00+00:00 - - + https://srlee056.github.io/en/tags/ - - - https://srlee056.github.io/tags/themes/ - 2019-03-11T00:00:00+00:00 - - https://srlee056.github.io/categories/themes/ - 2019-03-11T00:00:00+00:00 - - https://srlee056.github.io/tags/privacy/ - 2019-03-10T00:00:00+00:00 - - https://srlee056.github.io/p/rich-content/ - 2019-03-10T00:00:00+00:00 - - https://srlee056.github.io/tags/shortcodes/ - 2019-03-10T00:00:00+00:00 - - https://srlee056.github.io/p/placeholder-text/ - 2019-03-09T00:00:00+00:00 - - - - https://srlee056.github.io/tags/tag-with-whitespaces/ - 2019-03-09T00:00:00+00:00 - - https://srlee056.github.io/categories/test/ - 2019-03-09T00:00:00+00:00 - - - https://srlee056.github.io/categories/test-with-whitespaces/ - 2019-03-09T00:00:00+00:00 - - https://srlee056.github.io/tags/text/ - 2019-03-09T00:00:00+00:00 - - https://srlee056.github.io/p/math-typesetting/ - 2019-03-08T00:00:00+00:00 - - https://srlee056.github.io/tags/emoji/ - 2019-03-05T00:00:00+00:00 - - https://srlee056.github.io/p/emoji-support/ - 2019-03-05T00:00:00+00:00 - - https://srlee056.github.io/about/ - 2020-10-09T00:00:00+00:00 - - - - https://srlee056.github.io/links/ - - https://srlee056.github.io/search/ diff --git a/public/ko/tags/index.html b/public/en/tags/index.html similarity index 84% rename from public/ko/tags/index.html rename to public/en/tags/index.html index cda74b8..358723c 100644 --- a/public/ko/tags/index.html +++ b/public/en/tags/index.html @@ -1,18 +1,20 @@ - + - + Tags - + - - - + + + - + + +
@@ -192,7 +190,7 @@

좋은 개발자로 한걸음 더

-

카테고리

+

Categories

@@ -213,7 +211,7 @@

카테고리

-

태그

+

Tags

@@ -228,13 +226,13 @@

태그

- 섹션 + Section

-

0 페이지

+

0 pages

Tags

@@ -253,8 +251,8 @@

Tags

- Hugo로 만듦
- JimmyStack 테마 사용 중 + Built with Hugo
+ Theme Stack designed by Jimmy
diff --git a/public/ko/tags/index.xml b/public/en/tags/index.xml similarity index 51% rename from public/ko/tags/index.xml rename to public/en/tags/index.xml index dfc8453..b9e69ac 100644 --- a/public/ko/tags/index.xml +++ b/public/en/tags/index.xml @@ -1,11 +1,11 @@ - Tags on 서림록 - https://srlee056.github.io/ko/tags/ - Recent content in Tags on 서림록 + Tags on Seorim Log + https://srlee056.github.io/en/tags/ + Recent content in Tags on Seorim Log Hugo -- gohugo.io - ko - Seorim Lee + en + Seorim Lee diff --git a/public/en/tags/page/1/index.html b/public/en/tags/page/1/index.html new file mode 100644 index 0000000..a1ce68c --- /dev/null +++ b/public/en/tags/page/1/index.html @@ -0,0 +1,10 @@ + + + + https://srlee056.github.io/en/tags/ + + + + + + diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100755 index 0000000..da1ba16 Binary files /dev/null and b/public/favicon.ico differ diff --git a/public/favicon_io/about.txt b/public/favicon_io/about.txt new file mode 100755 index 0000000..8924230 --- /dev/null +++ b/public/favicon_io/about.txt @@ -0,0 +1,6 @@ +This favicon was generated using the following font: + +- Font Title: Lemon +- Font Author: Copyright 2011 The Lemon Project Authors (https://github.com/etunni/lemon) with Reserved Font Name "Lemon" +- Font Source: http://fonts.gstatic.com/s/lemon/v17/HI_EiYEVKqRMq0jBSZXAQ4-d.ttf +- Font License: SIL Open Font License, 1.1 (http://scripts.sil.org/OFL)) diff --git a/public/favicon_io/android-chrome-192x192.png b/public/favicon_io/android-chrome-192x192.png new file mode 100755 index 0000000..007df42 Binary files /dev/null and b/public/favicon_io/android-chrome-192x192.png differ diff --git a/public/favicon_io/android-chrome-512x512.png b/public/favicon_io/android-chrome-512x512.png new file mode 100755 index 0000000..8f09d83 Binary files /dev/null and b/public/favicon_io/android-chrome-512x512.png differ diff --git a/public/favicon_io/apple-touch-icon.png b/public/favicon_io/apple-touch-icon.png new file mode 100755 index 0000000..b3b5251 Binary files /dev/null and b/public/favicon_io/apple-touch-icon.png differ diff --git a/public/favicon_io/favicon-16x16.png b/public/favicon_io/favicon-16x16.png new file mode 100755 index 0000000..1e4ce6a Binary files /dev/null and b/public/favicon_io/favicon-16x16.png differ diff --git a/public/favicon_io/favicon-32x32.png b/public/favicon_io/favicon-32x32.png new file mode 100755 index 0000000..d203a04 Binary files /dev/null and b/public/favicon_io/favicon-32x32.png differ diff --git a/public/favicon_io/site.webmanifest b/public/favicon_io/site.webmanifest new file mode 100755 index 0000000..45dc8a2 --- /dev/null +++ b/public/favicon_io/site.webmanifest @@ -0,0 +1 @@ +{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"} \ No newline at end of file diff --git a/public/img/avatar_hu8ddc8f6dcd4c226f91e5ab7aaf623fd6_118700_300x0_resize_box_3.png b/public/img/avatar_hu8ddc8f6dcd4c226f91e5ab7aaf623fd6_118700_300x0_resize_box_3.png new file mode 100644 index 0000000..49c45a9 Binary files /dev/null and b/public/img/avatar_hu8ddc8f6dcd4c226f91e5ab7aaf623fd6_118700_300x0_resize_box_3.png differ diff --git a/public/img/avatar_huda2458f72ce188392d75c5d51cd8e24e_373_300x0_resize_box_3.png b/public/img/avatar_huda2458f72ce188392d75c5d51cd8e24e_373_300x0_resize_box_3.png deleted file mode 100644 index bab4bde..0000000 Binary files a/public/img/avatar_huda2458f72ce188392d75c5d51cd8e24e_373_300x0_resize_box_3.png and /dev/null differ diff --git a/public/index.html b/public/index.html index e226ac4..7a138fe 100644 --- a/public/index.html +++ b/public/index.html @@ -1,19 +1,21 @@ - + - -Seorim Log + +서림록 - - + + - - - - + + + + + +
@@ -271,10 +269,10 @@

좋은 개발자로 한걸음 더

- - + + - - -

- - -
- - - - - - - - - - - - 🤩 - -
- - - -
-

서림록

-

좋은 개발자로 한걸음 더

-
-
    - -
  1. - - - - - - - - - - - - -
  2. - -
  3. - - - - - - - - - - - - -
  4. - -
- - - - - -
- - - - - -
- -
-
- - -
- Hugo로 만듦
- JimmyStack 테마 사용 중 -
-
- -
- - - - - + + + https://srlee056.github.io + + + + + diff --git a/public/ko/page/1/index.html b/public/ko/page/1/index.html deleted file mode 100644 index 7a9f09c..0000000 --- a/public/ko/page/1/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - https://srlee056.github.io/ko/ - - - - - - diff --git a/public/ko/sitemap.xml b/public/ko/sitemap.xml index e14789e..15758ac 100644 --- a/public/ko/sitemap.xml +++ b/public/ko/sitemap.xml @@ -2,70 +2,160 @@ - https://srlee056.github.io/ko/categories/ + https://srlee056.github.io/ + 2023-10-25T16:23:38+09:00 - - - https://srlee056.github.io/ko/tags/ + https://srlee056.github.io/tags/beautifulsoup/ + 2023-10-25T16:23:38+09:00 + + https://srlee056.github.io/categories/ + 2023-10-25T16:23:38+09:00 - - - https://srlee056.github.io/ko/ + https://srlee056.github.io/p/day-8/ + 2023-10-25T16:23:38+09:00 + + https://srlee056.github.io/categories/devcourse/ + 2023-10-25T16:23:38+09:00 + + https://srlee056.github.io/tags/html-parser/ + 2023-10-25T16:23:38+09:00 + + https://srlee056.github.io/post/ + 2023-10-25T16:23:38+09:00 + + https://srlee056.github.io/tags/ + 2023-10-25T16:23:38+09:00 - - + + https://srlee056.github.io/tags/til/ + 2023-10-25T16:23:38+09:00 + + https://srlee056.github.io/p/day-7/ + 2023-10-24T00:00:00+00:00 + + https://srlee056.github.io/tags/dom/ + 2023-10-24T00:00:00+00:00 + + https://srlee056.github.io/tags/http/ + 2023-10-24T00:00:00+00:00 + + https://srlee056.github.io/tags/requests/ + 2023-10-24T00:00:00+00:00 + + https://srlee056.github.io/p/day-6/ + 2023-10-23T00:00:00+00:00 + + https://srlee056.github.io/tags/html/ + 2023-10-23T00:00:00+00:00 + + https://srlee056.github.io/tags/algorithms/ + 2023-10-20T00:00:00+00:00 + + https://srlee056.github.io/tags/data-structure/ + 2023-10-20T00:00:00+00:00 + + https://srlee056.github.io/p/day-5/ + 2023-10-20T00:00:00+00:00 + + https://srlee056.github.io/tags/dfsbfs/ + 2023-10-20T00:00:00+00:00 + + https://srlee056.github.io/tags/dp/ + 2023-10-20T00:00:00+00:00 + + https://srlee056.github.io/tags/heap/ + 2023-10-20T00:00:00+00:00 + + https://srlee056.github.io/p/day-4/ + 2023-10-19T00:00:00+00:00 + + https://srlee056.github.io/tags/greedy/ + 2023-10-19T00:00:00+00:00 + + https://srlee056.github.io/tags/hash/ + 2023-10-19T00:00:00+00:00 + + https://srlee056.github.io/tags/sort/ + 2023-10-19T00:00:00+00:00 + + https://srlee056.github.io/p/day-3/ + 2023-10-18T00:00:00+00:00 + + https://srlee056.github.io/tags/queue/ + 2023-10-18T00:00:00+00:00 + + https://srlee056.github.io/tags/tree/ + 2023-10-18T00:00:00+00:00 + + https://srlee056.github.io/p/day-2/ + 2023-10-17T00:00:00+00:00 + + https://srlee056.github.io/tags/linkedlist/ + 2023-10-17T00:00:00+00:00 + + https://srlee056.github.io/tags/stack/ + 2023-10-17T00:00:00+00:00 + + https://srlee056.github.io/tags/blog/ + 2023-10-16T00:00:00+00:00 + + https://srlee056.github.io/categories/blog/ + 2023-10-16T00:00:00+00:00 + + https://srlee056.github.io/blog-1/ + 2023-10-16T00:00:00+00:00 + + https://srlee056.github.io/p/day-1/ + 2023-10-16T00:00:00+00:00 + + https://srlee056.github.io/tags/github-pages/ + 2023-10-16T00:00:00+00:00 + + https://srlee056.github.io/tags/hugo/ + 2023-10-16T00:00:00+00:00 + + https://srlee056.github.io/archives/ + 2019-05-28T00:00:00+00:00 + + https://srlee056.github.io/page/ + 2020-10-09T00:00:00+00:00 + + https://srlee056.github.io/about/ + 2020-10-09T00:00:00+00:00 + + https://srlee056.github.io/links/ + + https://srlee056.github.io/search/ + + https://srlee056.github.io/categories/test/ diff --git a/public/ko/tags/page/1/index.html b/public/ko/tags/page/1/index.html deleted file mode 100644 index 7eba6b7..0000000 --- a/public/ko/tags/page/1/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - https://srlee056.github.io/ko/tags/ - - - - - - diff --git a/public/links/index.html b/public/links/index.html index cee64b7..892f2dc 100644 --- a/public/links/index.html +++ b/public/links/index.html @@ -1,5 +1,5 @@ - + - + + + - + +
-
+
-
- - Featured image of post Emoji Support - - -
-
@@ -299,14 +335,10 @@

좋은 개발자로 한걸음 더

- Emoji Support + Day 1

-

- Guide to emoji usage in Hugo -

-
@@ -325,25 +357,11 @@

- +

-
- - - - - - - - - -
- @@ -355,18 +373,52 @@

-

Emoji can be enabled in a Hugo project in a number of ways.

-

The emojify function can be called directly in templates or Inline Shortcodes.

-

To enable emoji globally, set enableEmoji to true in your site’s configuration and then you can type emoji shorthand codes directly in content files; e.g.

-

🙈 :see_no_evil: 🙉 :hear_no_evil: 🙊 :speak_no_evil:

-
-

The Emoji cheat sheet is a useful reference for emoji shorthand codes.

-
-

N.B. The above steps enable Unicode Standard emoji characters and sequences in Hugo, however the rendering of these glyphs depends on the browser and the platform. To style the emoji you can either use a third party emoji font or a font stack; e.g.

+

1. 자료구조 & 알고리즘 강의 및 코드 리뷰

+

📋 공부 내용

+

선형 배열 - Linear Arrays

+
    +
  • +

    배열(array) : 개념적 구조 / 리스트 : python 데이터형

    +
  • +
  • +

    리스트 methods

    +
      +
    • time complexity O(1) +
        +
      • .append()
      • +
      • .pop()
      • +
      +
    • +
    • time complexity O(n) +
        +
      • .insert()
      • +
      • .del()
      • +
      • .index()
      • +
      • .insert()
      • +
      +
    • +
    +
  • +
  • +

    정렬(sort)

    +
      +
    • sorted() : function, 정렬된 새로운 리스트를 반환하며 기존 리스트에는 변화 없음.
    • +
    • .sort() : method, 기존 리스트가 정렬됨
    • +
    • 숫자가 아닌 문자열 등 데이터형의 정렬 : 사전순이 기본, 문자열의 길이 등 다른 정렬 조건을 사용하고 싶다면 lambda 활용 +
        +
      • +

        문자열을 길이순으로 정렬

        +
        + +
        +
        1
        +
        +
        sorted(L, key = lambda x : len(x))
        +
        +
        +
      • +
      • +

        사전 데이터형(dictionary)에 key = ‘name’인 value의 문자열 순서대로 정렬

        1
        @@ -374,11 +426,106 @@ 

        3

        -
        .emoji {
        -  font-family: Apple Color Emoji, Segoe UI Emoji, NotoColorEmoji, Segoe UI Symbol, Android Emoji, EmojiSymbols;
        -}
        +
        L = [ {'name' : 'John', 'score': 90},
        +      {'name' : 'Paul', 'score': 80} ]
        +sorted(L, key = lambda x : x['name']
        +
        +
      • +
      +
    • +
    +
  • +
  • +

    탐색(search)

    +
      +
    • 선형(linear) 탐색, 순차(sequential) 탐색
    • +
    • 이진(binary) 탐색
    • +
    +
  • +
+

재귀 알고리즘 - recursive algorithms

+
    +
  • 종결 조건(trivial case) 을 명시해야 함
  • +
  • 예시 +
      +
    • +

      1부터 x까지 숫자의 합을 구하는 함수 (sum)

      +
      + +
      +
      1
      +2
      +3
      +
      +
      def recursiveSum(x):
      +    if x < 1 : return x
      +    return recursiveSum(x-1) + x
      +
      +
    • +
    • +

      조합의 수 (nCm)

      +
    • +
    • +

      하노이의 탑

      +
    • +
    • +

      피보나치 순열

      +
    • +
    +
  • +
  • 장점 : 알고리즘을 간단하고 이해하기 쉽게 풀어냄
  • +
  • 단점 : time complexity 부분에서 비효율적인 경우가 많음
  • +
  • 이러한 특성 때문에 tree 자료구조를 이용하는 알고리즘에 활용
  • +
+

Complexity

+
    +
  • Time Complexity
  • +
  • Space Complexity
  • +
  • 다루는 데이터가 커질수록, 더 효율적인 complexity를 가지는 방식이 필요함 (2^n, n! 등의 complexity X)
  • +
+

👀 CHECK

+
(어렵거나 새롭게 알게 된 것 등 다시 확인할 것들)
+
    +
  • 코드로 elapsed time을 확인 -> 디버깅이나 time complexity를 직관적으로 확인하는 등에 활용
  • +
  • list method .pop().remove()의 차이점
  • +
  • big O notation - O of n 으로 읽음
  • +
  • list의 앞과 뒤에 접근하는것은 O(1)의 time complextity를 갖는다.
  • +
+

‼️ 느낀 점

+

아직까지는 전공 과정 복습하는 느낌이고, 쉽다고 느꼈다. 막히는 부분은 없었다. 코드를 작성하면서 조금 더 나은 코드에 대해 생각해보는것 정도.
+공부하는 중이나 이후에 바로 TIL을 적는게 제일 좋다고 생각하는데, 블로그 세팅에 정신이 팔려서 나중에 작성하게 된 건 조금 아쉽다.
+오늘은 코어타임보다 일찍 강의를 들어버려서 시간 분배가 애매했다. 내일은 코어타임 시작할 때 듣기 시작하고, 그 전에는 전날 내용을 복습하거나, 알고리즘 문제를 풀고 code review를 작성하는 시간을 가져야겠다.

+

2. 블로그 세팅 과정

+

https://blog.kakaocdn.net/dn/cKgXTh/btsyuerJaNh/HhtKTmduAbBOsbBmTD8g00/img.png

+

노션이나 옵시디언으로 TIL을 적고 깃에 업로드 한 적은 많지만 블로그에 올리는건 처음이라, 어디에 올리지 고민하다가 일단 티스토리 계정과 블로그를 만들었다.
+그런데 만들다 보니 github repo와 연동되는 page를 세팅하고 싶다..! 라는 욕심이 들기 시작했고,
+jekyll 등을 알아보다가 hugo를 활용한 페이지 세팅을 접하게 되어 장장 3시간을 투자했다.

+

그런데 이 글을 티스토리에 올리는 이유는? 세팅에 실패했기 때문 ㅠㅠ
+TIL 작성하고 나서 다시 도전해서 세팅 과정에 대해서도 글을 써 볼 예정이다.

+

+) 티스토리에서 md로 작성한게 예쁘게 안나와서 벨로그로 옮겼다 😂 훨씬 편한 것 같은데 깃허브랑 연동 전까진 벨로그로 해야겠다 :>

+

(지금까지 참고한 링크들)

+ +
@@ -386,7 +533,17 @@

@@ -414,29 +571,70 @@

+ + @@ -510,8 +792,8 @@

Examples

- Built with Hugo
- Theme Stack designed by Jimmy + Hugo로 만듦
+ JimmyStack 테마 사용 중
diff --git a/public/p/day-4/index.html b/public/p/day-4/index.html new file mode 100644 index 0000000..5cb2d40 --- /dev/null +++ b/public/p/day-4/index.html @@ -0,0 +1,836 @@ + + + + +Day 4 + + + + + + + + + + + + + + + +
+ + + + +
+
+
+ +
+ + + + +
+

+ Day 4 +

+ + +
+ + + + + +
+ +
+ + + + + + + + + + +
+ + + +
+ + + +
+ +
+ +
+ + +

TIL - Hash / Greedy & Sort (문제풀이 위주)

+

📋 공부 내용

+

Hash

+
    +
  • +

    Hash?
    +개념 정리가 필요하다고 느껴서 글을 따로 발행했다.

    + +
  • +
  • +

    완주하지 못한 선수 문제풀이

    +
      +
    • python dictionary 를 활용하여 hasing 구현
    • +
    +
    + +
    +
     1
    + 2
    + 3
    + 4
    + 5
    + 6
    + 7
    + 8
    + 9
    +10
    +11
    +12
    +13
    +
    +
    def solution(participant, completion):
    +    answer = ''
    +    pDict = {}
    +    # 참가자/ 완주자 정보가 주어질 때, 이름을 key로 활용하여 dictionary 형태에 넣고 빼는 방식으로
    +    # (동명이인이 있을 때에도) 어떤 이름을 가진 사람이 완주를 하지 못했는지 확인할 수 있다. 
    +    for p in participant:
    +        pDict[p] = pDict.get(p, 0) + 1 #.get()을 통해 default 값을 세팅하는 한 방법
    +    for p in completion:
    +        pDict[p] -= 1
    +
    +    incompletion = [k for k, v in pDict.items() if v > 0]        
    +    answer = incompletion[0]
    +    return answer
    +
    +
    +
  • +
+

Greedy Algorithm

+
    +
  • +

    탐욕법(greedy algorithm)

    +
      +
    • 알고리즘의 각 단계에서 그 순간의 최적의 선택을 함
    • +
    • 탐욕법으로 최적해를 찾을 수 있는 문제
      += 현재 선택이 마지막 답의 최적성을 해치지 않는 문제
    • +
    +
  • +
  • +

    체육복 문제풀이

    +
      +
    • 비슷해보이는 조건문이라해도 그 순서에 따라 전혀 다른 결과가 나올 수 있음
    • +
    • 작은 번호부터 큰 번호로 순회하기 때문에, 작은 번호가 조건을 만족하는지 먼저 고려함
    • +
    +
  • +
  • +

    큰 수 만들기 문제풀이

    +
      +
    • 매 단계마다 작은 숫자를 지우는 탐욕법을 사용하며, 이 방식은 마지막에 최적성을 충족하게 됨
    • +
    +
    + +
    +
     1
    + 2
    + 3
    + 4
    + 5
    + 6
    + 7
    + 8
    + 9
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +
    +
    def solution(number, k):
    +    collected = []
    +    for i, num in enumerate(number):
    +        # collected에 미리 들어간 원소가 있을 것
    +        # 제일 마지막으로 들어간 원소는 현재 num 값보다 작을 것
    +        # (제거해야 하는 숫자의 개수) k가 0보다 클 것
    +        while len(collected) > 0 and collected[-1] < num and k >0:
    +            collected.pop()
    +            k -=1
    +
    +        if k == 0:
    +            collected += list(number[i:])
    +            break
    +        collected.append(num)
    +
    +    # 제거해야 하는 숫자의 개수가 남아있을 때 
    +    # (코드가 너무 직관적이고 예뻤다. :>)
    +    collected = collected[:-k] if k > 0 else collected
    +
    +    answer = ''.join(collected)
    +
    +    return answer
    +
    +
    +
  • +
+

Sort

+
    +
  • 가장 큰 수 문제풀이 +
      +
    • 자릿수가 다른 숫자들을 문자열처럼 나열하여 더 큰 숫자를 만들 때, 숫자들의 우선순위를 정하는 방법은?
    • +
    +
    + +
    +
    1
    +2
    +3
    +4
    +5
    +
    +
    sortedNumbers = sorted(map(str, numbers), key = lambda x : (x * 4)[:4], reverse = True)
    +
    +# map(str, numbers) : numbers 정수 리스트를 문자열 리스트로 변환
    +# sorted(..., reverse = True) : 주어진 조건으로 정렬하며, 내림차순으로 반환
    +# lambda x : (x*4)[:4] : 네 자리 수까지 주어지므로 4번 반복 후 네번째자리까지 끊음
    +
    +
    +
  • +
+

👀 CHECK

+
(어렵거나 새롭게 알게 된 것 등 다시 확인할 것들)
+
    +
  • +

    Hash

    +
      +
    • 가볍게 정리했지만 더 자세하게 찾아보고 싶음 (활용되는 곳, 특성을 구현하는 법, hashing function, collision 등)
    • +
    +
  • +
  • +

    list comprehension

    +
      +
    • 한 줄에 반복문 할당 배열생성 등이 한번에 일어남
    • +
    • list comprehension 설명 블로그 글
    • +
    • 쓸 줄 아는 방식이지만 용어를 처음 알게 됨 (예전에 배우고 까먹은 게 분명)
    • +
    +
  • +
  • +

    list slicing 에 바로 대입하여 직관적으로 코드 작성 가능

    +
      +
    • EX) list[1:3] = [1, 2]
    • +
    +
  • +
+

❗ 느낀 점

+

어제 더 나은 코드를 위해 어떤점을 고려해야하는지 많은 고민을 했는데, 오늘 강의에서 그 부분을 짚어줘서 좋았다.

+

오늘은 각 알고리즘이나 자료구조에 대한 설명보다는 문제 풀이와 해설을 위주로 강의가 진행되었는데, 그래서 나 스스로 그 개념에 대해 찾아보고 정리하는 시간이 필요했다. greedy나 sort는 이미 잘 알고 있는 부분이지만 hash는 헷갈리는 부분이 있어서 블로그와 document를 읽어보면서 글로 정리하는 시간을 가졌다.

+

깊이가 정해져있지 않다 보니 원하는 만큼 궁금해하고 파헤칠 수 있었지만, 내가 그 내용을 받아들이고 정리할 수 있는가는 별개의 문제임을 깨달았다. hash를 설명하는 블로그 글에 연결된 링크를 타고 여러 글을 읽어가다 보니, 어느새 encoding&decoding, scheduling에 대한 글을 읽고 있었다. 이런 글들을 읽고 어느정도 이해할 수는 있었지만, 글로 정리하거나 그 사이의 관계를 명확하게 아는것은 큰 차이가 있었고, 머리속이 혼란스러웠다. 어떤 주제와 관련된 내용을 잘 찾고 정리하는것도 많은 노력이 필요하다는 걸 새삼 느끼는 순간이었다.

+

오늘처럼 깊이가 없는 공부를 해야하는 순간은 계속 있을것이고(있어왔고), 정해진 주제에 대해 찾아본 내용들을 글로 정리하면서 나만의 기준을 정립해야겠다는 결론을 내렸다.

+

+) 퇴고하기 위해 글을 읽어보는데 두서없고 추상적이라 맘에 들지 않음..(ㅠㅠ) 문장력을 키우고 싶은데 온라인으로도 필사할 수 있는지 찾아봐야겠다.

+ +
+ + + + + + +
+ + + + + + + + + + +
+
+ + +comments powered by Disqus +
+ + + + + + + +
+ + +
+ Hugo로 만듦
+ JimmyStack 테마 사용 중 +
+
+ + + + + +
+
+ + + + + diff --git a/public/p/day-5/index.html b/public/p/day-5/index.html new file mode 100644 index 0000000..1691d3d --- /dev/null +++ b/public/p/day-5/index.html @@ -0,0 +1,949 @@ + + + + +Day 5 + + + + + + + + + + + + + + + +
+ + + + +
+
+
+ +
+ + + + +
+

+ Day 5 +

+ + +
+ + + + + +
+ +
+ + + + + + + + + + +
+ + + +
+ + + +
+ +
+ +
+ + +

TIL - Heap / Dynamic Programming / DFS&BFS (문제풀이 위주)

+

📋 공부 내용

+

Heap

+
+

<더 맵게> 문제 풀이

+
+ +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+
+
import heapq #heap 라이브러리 사용
+
+def solution(scoville, K):
+    answer = 0
+    # heapify, heappop, heappush 활용
+    heapq.heapify(scoville) #min heap 구성
+    while True:
+        s1 = heapq.heappop(scoville)
+        if s1 >= K : #모든 스코빌 지수가 K이상
+            break
+        elif len(scoville) == 0: # K이상으로 만들 수 없는 경우
+            answer = -1
+            break
+        s2 = heapq.heappop(scoville)
+        newS = s1 + s2*2
+        heapq.heappush(scoville,newS)
+        answer += 1
+    return answer
+
+
+

+

Dynamic Programming

+
+

DP(Dynamic Programming)

+
+

알고리즘 진행에 따라 탐색해야 할 범위를 동적으로 결정하여 탐색 범위를 한정

+
+

EX1) 피보나치 수열

+
+ + + + + + + + + + + + + + + + + + + +
Complexity재귀함수DP
TimeO(2^n)O(n)
SpaceO(n)O(n)
+

참고 : Recursion vs Dynamic Programming - Fibonacci

+

EX2) knapsack problem
+weight / value를 가진 여러 물건이 있을 때, weight 제한이 있는 베낭에 value의 합이 가장 높도록 물건을 골라 담는 문제

+
+

<N으로 표현> 문제 풀이

+
+ +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+
+
def solution(N, number):
+    strN = str(N)
+    # 직관적인 코드를 위해 다음과 같이 index : 1~8 사용 설정 (index 0은 사용하지 않음)
+    numberUsed = [{} for _ in range(9)]
+    for i in range(1, 9):
+        numberUsed[i] = {int(strN * (i))}   # N을 i번 나열한 숫자 ex) 555, 7777, ...
+        for j in range(1 , i):
+            for n1 in numberUsed[j]:
+                for n2 in numberUsed[i-j]:
+                    newNumbers = [n1*n2, n1+n2, n1-n2]
+                    if n2 != 0 : newNumbers.append( n1//n2 )
+                    numberUsed[i].update(newNumbers) #set1.update(set2) 사용하여 원소 추가. set 아닌 list를 넘겨줄수도 있다.
+        if number in numberUsed[i]:
+            return i
+    return -1
+
+
+

+

DFS & BFS

+ +
+

한 vertex에서 인접한 모든 vertex를 방문할 때, 인접한 vertex를 기준으로 깊이 우선 탐색을 끝낸 후 다음 vertex로 진행하는 방식
+스택을 이용하여 어느 정점에서 DFS를 진행하고 있는지를 기억

+
+ +
+

한 vertex에서 인접한 모든 vertex를 방문하고, 방문한 인접 vertex를 기준으로 너비 우선 탐색을 진행하는 방식

+
+

3. Graph

+
+

-vertex(=node) & edge(=link)
+-directed / undirected graph

+
+

<여행 경로> 문제 풀이

+

DFS를 응용한 재귀 한 붓 그리기

+
+ +
+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+
+
def solution(tickets):
+    routes = {}
+    for a, b in tickets: #출발지, 도착지
+        routes[a] = routes.get(a, []) 
+        routes[a].append(b)
+    
+    for r in routes:
+        routes[r].sort(reverse=True) 
+        # 역순인 이유? 파이썬의 데이터 삭제 과정을 살펴보면 뒤에서 뽑는게 더 효울적이기 때문    
+    stack = ["ICN"]
+    path = []
+    while 0 < len(stack):
+        top = stack[-1]
+        if top not in routes or len(routes[top]) == 0: # 이 공항에서 떠나는 티켓이 존재하지 않음
+            path.append(stack.pop()) 
+        else :
+            stack.append(routes[top].pop())
+    return path[::-1]
+
+
+

+

추가 문제풀이

+
+문제 링크 모음(많이 김) + +
+프로그래머스 코딩테스트 문제 링크 (코스에 있는 문제여도 프로그래머스 코테 링크로 적음) + +
+

👀 CHECK

+
(어렵거나 새롭게 알게 된 것 등 다시 확인할 것들)
+

PEP 8

+

파이썬이 추구하는 코드 스타일. 들여쓰기, 공백, 변수명 작성 규칙 등이 포함된다.

+ +

Tim sort

+

Insertion sort + Merge sort

+ +

DP 익숙해지기

+
    +
  • knapsack problem 등 문제풀이를 통해 익숙해지기
  • +
+

❗ 느낀 점

+

오늘은 DP(Dynamic Programming)과 DFS&BFS의 개념에 대해 가볍게 배우고, 문제풀이를 위주로 강의가 진행되었다.

+

아는 알고리즘들이고 어제 강의의 문제가 나에겐 어렵지 않았기 때문에, 해설 강의를 듣기 전에 문제를 먼저 풀어 보았다. 문제를 풀다가 막히는 부분이 있으면 강의를 틀고, 해결되면 멈추고 다시 풀어보곤 했다.
+Heap 문제를 제외한 두 문제는 해설 없이 풀었고, Heap 문제도 heapq 라이브러리를 사용해야하는 것을 깨닫고는 금방 풀 수 있었다.

+

이번주 강의를 듣고 문제를 풀면서 느낀점이 몇개 있다.

+
    +
  1. +

    나는 알고리즘 자체는 꽤 잘 알고 활용도 잘 하는 편이지만 라이브러리 사용에 있어서 소극적인 면이 있다. 문제를 풀 때 파이썬 표준 라이브러리조차도 잘 import하지 않고 Dictionary나 Set정도만 사용하는 편이었다. (Heap도 자체적으로 구현하거나 list를 사용하곤 했는데 왜 이런 습관이 들었는지는 잘 모르겠다.)
    +이번 강의를 들으면서 표준 라이브러리에 있는 여러 데이터형을 활용했고 다음에 문제를 풀 때도 적극적으로 활용하면서 더 효과적인 코드를 작성하는데 가까워지려고 한다.

    +
  2. +
  3. +

    나는 CS 용어를 잘 모른다. 아예 모른다는게 아니라, 많이 헷갈리며 정확한 명칭을 찾아보지 않았다는 의미이다. member method, list comprehension 등 용어들은 분명 내가 궁금해서 찾아봤지만 아직도 헷갈리거나 명칭 자체를 몰랐던 것들이다. 강의를 통해 명확해지거나 새롭게 알게 된 용어들이 있어서 좋았고, 이제부터는 모르는 부분에 대해 검색할 때는 아예 용어와 그 정의부터 찾는것부터 시작해야겠다고 다짐했다.

    +
  4. +
+

내일은 강의가 없는 날이다. 하지만 해야 할 일들은 있다. 오늘까지 배운걸 복습하고, 배운 자료구조와 알고리즘을 활용하는 문제들을 lv3정도로 풀어 볼 것이다. 내일도 화이팅!!

+ +
+ + + + + + +
+ + + + + + + + + + +
+
+ + +comments powered by Disqus +
+ + + + + + + +
+ + +
+ Hugo로 만듦
+ JimmyStack 테마 사용 중 +
+
+ + + + + +
+
+ + + + + diff --git a/public/p/day-6/index.html b/public/p/day-6/index.html new file mode 100644 index 0000000..a0dce4f --- /dev/null +++ b/public/p/day-6/index.html @@ -0,0 +1,1709 @@ + + + + +Day 6 + + + + + + + + + + + + + + + +
+ + + + +
+
+
+ +
+ + + + +
+

+ Day 6 +

+ + +
+ + + + + +
+ +
+ + + + + + + + + + +
+ + + +
+ + + +
+ +
+ +
+ + + +

TIL - HTML

+

📋 공부 내용

+

HTML

+
+

Hypertext Markup Language
+웹 브라우저가 이해할 수 있는 “언어”

+
+

CSS

+
+

Cascading Style Sheets
+문서를 예쁘게 “꾸미는” 언어

+
+

JavaScript

+
+

JS = JavaScript
+문서에 “기능"을 만들어주는 언어

+
+
+

HTML - 기본 문법

+

태그

+
    +
  • 컨텐츠를 갖는 태그 / 가지지 않는 태그
  • +
  • 열리는 태그 & 닫히는 태그 / 단일 태그 (셀프 클로징)
  • +
  • <div> contents </div> / <br />
  • +
+

속성과 값

+
    +
  • <div attributes = value>content</div>
  • +
  • <div title = "제목"> ...
  • +
  • title : 전역 속성이라 모든 태그에서 사용 가능
  • +
  • 속성(Attributes)의 종류는 아주 많고 다양함
  • +
+

부모요소 & 자식요소

+
+ +
+
1
+2
+3
+4
+
+
html
+├─ head
+│   └─ title
+└─ body
+
+
+

html (부모) - head, body (자식)

+

부모/자식 구조를 파악하기 좋게, 들여쓰기/내어쓰기 깊이(depth)를 잘 지켜서 작성해야 함
+탭 잘 쓰라는얘기

+

HTML 주석

+
+ +
+
1
+
+
<!-- 주석 내용 -->
+
+
+
+ +
+
1
+2
+3
+
+
<!-- 
+    줄바꿈 가능
+-->
+
+
+
+ +
+
1
+2
+3
+4
+
+
<!--
+    <!-- -->
+-->
+이처럼 주석 안에 주석을 넣으면 바깥의 여는 태그가 안쪽 닫는 태그를 인식해 주석이 풀리게 된다. 고로 주석 안에 주석은 X 
+
+
+

웹 브라우저의 소스보기 등에서 확인 가능하므로 보안이 필요한 정보는 적지 않아야 한다.

+

HEAD

+
+

사용자에게는 보이지 않지만, 문서의 정보가 담기는 영역

+
+

타이틀

+
    +
  • 웹 브라우저 탭이나 창에서 표시되는 문서의 제목
  • +
+

메타 데이터

+
    +
  • 인코딩 정보 +
      +
    • charset(character set) : 문서에서 허용하는 문자의 집합
    • +
    • 영어만 허용하는 규칙(ISO-8859-1)을 사용할 경우, 한글은 제대로 출력이 되지 않음
    • +
    • <meta charset = "ISO-8859-1">
    • +
    • utf-8(전 세계 언어 지원) 을 기본으로 사용
    • +
    +
  • +
  • 문서 설명 +
      +
    • <meta name = "description" content = "이 문서는 실습 문서입니다.">
    • +
    +
  • +
  • 문서 작성자 +
      +
    • <meta name = "author content = "srlee"
    • +
    +
  • +
+

CSS, Javascript

+
+

문서 외형에 영향을 주는 태그들로 구성

+
+
    +
  • +

    style

    +
    + +
    +
    1
    +2
    +3
    +4
    +5
    +6
    +
    +
    <!-- 문서 글자색을 blue로 만드는 코드 -->
    +<style> 
    +    body {
    +        color: blue;
    +    }
    +</style>
    +
    +
    +

    길이가 너무 길어지면 작성 및 수정이 불편 -> <link>

    +
  • +
  • +

    link

    +
    + +
    +
    1
    +2
    +3
    +4
    +
    +
    <!--단일 속성
    +    rel: 링크된 파일의 속성
    +    href: 파일 경로 -->
    +<link rel = "stylesheet" href="style.css" />
    +
    +
    +

    별도로 분리된 CSS파일을 링크

    +
  • +
  • +

    script

    +

    콘텐츠 방식

    +
    + +
    +
    1
    +2
    +3
    +4
    +
    +
    <script>
    +    const hello = 'world';
    +    console.log(hello)
    +</script>
    +
    +
    +

    링크 방식

    +
    + +
    +
    1
    +2
    +
    +
    <!-- 콘텐츠를 가지지 않지만 단일태그는 아니기 때문에 셀프 클로징 X -->
    +<script src = "script.js"></script>
    +
    +
    +
  • +
+

BODY

+
+

사람 눈에 보이는 콘텐츠의 영역

+
+

block - 블록 레벨 요소

+
    +
  • +

    블록처럼 차곡차곡 쌓이며 화면 너비가 꽉 참

    +
  • +
  • +

    블록의 크기와 내/외부에 여백 지정 가능

    +
  • +
  • +

    페이지의 구조적 요소

    +
  • +
  • +

    인라인 요소 포함 가능 / 포함 될 수는 없음

    +
  • +
  • +

    <div>, <article>, <section>, ...

    +
  • +
+

inline - 인라인 레벨 요소

+
    +
  • +

    블록 요소 내에 포함되는 요소 (블록 요소를 포함할 수 없음!)

    +
  • +
  • +

    문장, 단어같은 작은 부분에 사용되며, 한 줄에 나열됨

    +
  • +
  • +

    좌우 여백만 허용

    +
  • +
  • +

    <span>, <a>, <strong>, ...

    +
  • +
+

inline-block

+
    +
  • 인라인 요소의 불편함을 해결하기 위한 요소
  • +
  • 글자처럼 취급되지만 block태그의 성질을 가짐
  • +
  • 크기와 내/외부 여백 지정 가능
  • +
  • CSS로 성질을 바꾼 것이기 때문에 의미상 인라인 레벨 요소
  • +
+

활용 예시

+
+ +
+
1
+2
+3
+4
+
+
<body> 
+    <span>인라인</span> 옆에 글자
+    <div>블록</div>
+</body>
+
+
+
+ +
+
1
+2
+3
+4
+5
+6
+7
+8
+9
+
+
span{
+    padding-left: 100px;
+    padding-top: 100px; /* 적용 X */
+}
+div{
+    padding-top: 50px;
+    padding-bottom: 30px;
+    padding-left: 100px;
+}
+
+
+

span

+

div

+

Layout

+

Layout Tag?

+
    +
  • html5부터 태그를 의미있게 사용하기 위해 Semantic태그를 사용하기 시작
  • +
  • div만 사용하지 않고 적절한 태그를 사용해 웹 문서가 담은 정보와 구조를 의미 있게 전달
  • +
  • semantic한 markup -> 검색 엔진의 순위에 가산점, 로딩속도 빨라짐 등
  • +
+

Tags

+
    +
  • div +
      +
    • 가장 흔하게 사용
    • +
    • 구역을 나누기 위한 태그
    • +
    +
  • +
  • header +
      +
    • 제목, 작성일 등 주요 정보를 담는 태그
    • +
    +
  • +
  • footer +
      +
    • 페이지 바닥줄에 사용, 저작권 정보, 연락처 등 부차적 정보를 담는 태그
    • +
    +
  • +
  • main +
      +
    • 페이지의 가장 큰 부분으로 내용, 즉 주요 콘텐츠를 담는 태그
    • +
    • 한 페이지에 한번만 등장해야 함 (header, footer는 여러번 등장 가능) +-section
    • +
    • 콘텐츠의 구역을 나누는 태그
    • +
    +
  • +
  • article +
      +
    • 구역 안에서 작성된 정보를 전달하는 독립적인 문서의 역할을 하는 태그
    • +
    +
  • +
  • aside +
      +
    • 문서 내용에 부가적인 갖접정보를 전달하는 태그
    • +
    • 예) 쇼핑몰의 ‘오늘 본 상품’, 블로그의 ‘위젯’ 등
    • +
    +
  • +
+

레이아웃 분석 +(배운 내용을 토대로 해본거라 정확하지 않을 수 있습니다) +

+

Contents

+
    +
  1. 제목 태그 h1 ~ h6 +
      +
    • 문서 구획 제목을 나타내는 태그
    • +
    • h1 태그는 페이지 내에 한번만 사용
    • +
    • 구획 순서(h1 ~ h6)는 지켜져야 함
    • +
    +
  2. +
  3. 문단 태그 p +
      +
    • 문단을 담당하는 태그
    • +
    • 제목태그와 함께 사용되기도 하고 단독으로도 사용
    • +
    • 레이아웃태그처럼 사용 X
    • +
    +
  4. +
  5. 서식 태그 b/strong, i/em, u, s/del +
      +
    • b/strong : 굵은 글씨로 변경. strong - 강조 의미 부여
    • +
    • i/em : 기울기 조절, em - 기울임과 내용에 강조 의미 부여
    • +
    • u : 밑줄을 넣고 주석을 가짐. 단순히 밑줄만 긋는 용도로는 사용 X
    • +
    • s/del : 취소선, del - 문서에서 제거된 텍스트를 나타냄 +
      + +
      +
      1
      +2
      +3
      +4
      +
      +
      <p>
      +    안녕하세요.<br>
      +    <del></del> <ins>서림</ins>입니다.
      +</p>
      +
      +
      +

      + 안녕하세요.
      + 서림입니다. +

      +
    • +
    +
  6. +
  7. 링크 이동 a +
      +
    • +

      클릭하면 페이지를 이동할 수 있는 링크 요소

      +
    • +
    • +

      href 속성으로 이동하려는 파일 / URL 작성

      +
    • +
    • +

      target 속성으로 새 창(_blank), 현재창(_self)등 타겟 지정 가능

      +
      + +
      +
      1
      +
      +
      <a href = "https://velog.io/@srlee056" target = "_blank"> 새 창에서 블로그 열기</a>
      +
      +
      +

      새 창에서 블로그 열기

      +
    • +
    +
  8. +
+

멀티미디어

+
    +
  1. img
  2. +
+
    +
  • 이미지를 추가하는 태그
  • +
  • src : 이미지의 경로
  • +
  • alt : 로딩에 문제가 발생했을 때 대체 텍스트
  • +
  • alt 태그에 적힌 메세지가 검색엔진에 키워드로 들어감 +
    + +
    +
    1
    +2
    +
    +
    <img src = "" alt = "잘못된 로고">
    +<img src = "https://cdn.icon-icons.com/icons2/2699/PNG/512/python_logo_icon_168886.png" alt = "파이썬 로고">
    +
    +
    +
    잘못된 로고 + 파이썬 로고 +
  • +
+
    +
  1. figure, figcaption
  2. +
+
    +
  • +

    태그 안의 내용을 하나의 독립적인 콘텐츠로 분리하고 설명을 넣을 수 있는 태그

    +
  • +
  • +

    보통 이미지를 넣으며 인용문, 비디오/오디오 등 문서 흐름에 참조는 되지만 독립적으로 분리되어도 되는 내용을 담는다.

    +
  • +
  • +

    이미지 - 인라인 레벨 요소 / 피규어 - 블록 레벨 요소

    +
    + +
    +
    1
    +2
    +3
    +4
    +
    +
    <figure>
    +    <img src = "https://www.lgtwins.com/images/emblem/01.emblem.jpg" alt = "엘지 트윈스 로고">
    +    <figcaption> 엘지 트윈스 우승하자! </figcaption>
    +</figure>
    +
    +
    +
  • +
+
+
엘지 트윈스
+ 엘지 트윈스 로고 +
우승하자!
+
+
    +
  1. video
  2. +
+
    +
  • 문서 내에 영상을 첨부할 수 있는 태그
  • +
  • src : 비디오 파일이나 온라인 링크 연결
  • +
  • poster : 비디오 로드되기 전 포스터를 보여줄 수 있음
  • +
  • <source> 태그로 여러 타입의 비디오 제공 +
    + +
    +
    1
    +2
    +3
    +4
    +5
    +6
    +
    +
    <video src = "/video.mp4"></video>
    +<video poster = "/poster.png">
    +    <source src = "/video.mp4" type = "video/mp4">
    +    <source src = "/video.webm" type = "video/webm">
    +    비디오 태그가 실행되지 않을 때 보이는 글자
    +</video>
    +
    +
    +
  • +
+
    +
  1. audio
  2. +
+
    +
  • +

    문서 내에 소리를 첨부할 수 있는 태그

    +
  • +
  • +

    src : 음성 파일이나 온라인 링크 연결

    +
  • +
  • +

    <source> 태그로 여러 타입의 오디오 제공

    +
  • +
  • +

    controls : 재생/정지 버튼 등이 있는 컨트롤러

    +
    + +
    +
    1
    +2
    +3
    +4
    +5
    +6
    +
    +
    <audio src = "/audio.mp3" controls></audio>
    +<audio controls>
    +    <source src = "/audio.mp3" type = "audio/mp3">
    +    <source src = "/audio.ogg" type = "audio/ogg">
    +    오디오 태그가 실행되지 않을 때 보이는 글자
    +</audio>
    +
    +
    +
  • +
+
    +
  1. svg
  2. +
+
+

Scalable Vector Graphics
+그래픽으로 만들어진 이미지

+
+
    +
  • +

    해상도의 영향을 받지 않아 확대/축소 자유로움

    +
  • +
  • +

    크기를 자주 바꾸어야 하는 작은 아이콘 등에 많이 사용

    +
  • +
  • +

    최근 기기들은 해상도가 다양하게 변화하고 있어, 아이콘 외에 로고 등 주요 이미지에도 사용

    +
  • +
  • +

    <img>태그처럼 svg 파일을 불러올수도 있고, 태그를 그대로 사용할수도 있음

    +
  • +
  • +

    코드로 이루어져 있어서 스타일을 변경하거나, JS를 사용해 기능 추가도 가능

    +
    + +
    +
    1
    +2
    +3
    +4
    +5
    +6
    +
    +
    <img src="baseball.svg" alt="야구공 아이콘" />
    +<!--또는 .svg 파일의 내용을 가져다가 쓸 수 있음-->
    +
    +<svg>
    +    파일 내용
    +</svg>
    +
    +
    +
  • +
  • +

    svg 파일 출력 결과

    + + + + +
  • +
+

리스트

+
    +
  1. +

    <ul>, <li>

    +
    +

    순서가 없고 정렬되지 않은 목록

    +
    +
    + +
    +
     1
    + 2
    + 3
    + 4
    + 5
    + 6
    + 7
    + 8
    + 9
    +10
    +11
    +12
    +
    +
    <ul>
    +    <li>list 1</li> <!--자식 요소로 li만 와야 함-->
    +    <li>list 2
    +        <ul> <!-- ul or ol tag-->
    +            <li>sub list 1</li>
    +            <li>sub list 2</li>
    +        </ul>
    +        <ol> 
    +            <li>sub list 3</li>
    +        </ol>
    +    </li>
    +</ul>
    +
    +
    +

    HTML 출력 결과

    +
      +
    • list 1
    • +
    • list 2 +
        +
      • sub list 1
      • +
      • sub list 2
      • +
      +
        +
      1. sub list 3
      2. +
      +
    • +
    +
  2. +
  3. +

    <ol>

    +
    +

    순서가 존재하며 정렬된 목록

    +
    +
    + +
    +
     1
    + 2
    + 3
    + 4
    + 5
    + 6
    + 7
    + 8
    + 9
    +10
    +11
    +12
    +
    +
    <ol>
    +    <li>list 1</li> <!--자식 요소로 li만 와야 함-->
    +    <li>list 2
    +        <ol> <!-- ul or ol tag-->
    +            <li>sub list 1</li>
    +            <li>sub list 2</li>
    +        </ol>
    +        <ul> 
    +            <li>sub list 3</li>
    +        </ul>
    +    </li>
    +</ol>
    +
    +
    +

    HTML 출력 결과

    +
      +
    1. list 1
    2. +
    3. list 2 +
        +
      1. sub list 1
      2. +
      3. sub list 2
      4. +
      +
        +
      • sub list 3
      • +
      +
    4. +
    +
  4. +
  5. +

    <dl>, <dt>, <dd>

    +
  6. +
+
    +
  • 설명 목록 태그
  • +
  • <dt>에 작성된 단어 혹은 내용의 설명을 <dd>에 작성
  • +
  • 용어사전이나 key-value쌍의 목록을 나타낼 때 사용
  • +
  • <dt> 여러개에 하나의 <dd> 가능 / <dt> 하나에 여러개 <dd> 가능 +
    + +
    +
    1
    +2
    +3
    +4
    +5
    +6
    +7
    +8
    +9
    +
    +
    <dl>
    +    <dt>Chrome</dt>
    +    <dd>웹 브라우저<dd>
    +    <dd>구글에서 제작</dd>
    +    <br>
    +    <dt>Whale</dt>
    +    <dt>Microsoft Edge</dt>
    +    <dd>Web Browser</dd>
    +</dl>
    +
    +
    +
  • +
+

+
    +
  • <table> : 표를 만드는 태그
  • +
  • <tr> 로 행을, <td>로 열을 나타냄
  • +
  • <th> : 열 제목
  • +
  • <thead> : 제목 그룹 태그, 한번만 사용
  • +
  • <tbody> : 표의 본문 요소 그룹 태그, 역시 한번만 사용
  • +
  • <tfoot> : 표 바닥글 요소 태그
  • +
  • <caption> : 표 설명 태그 +
    + +
    +
     1
    + 2
    + 3
    + 4
    + 5
    + 6
    + 7
    + 8
    + 9
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +
    +
    <table>
    +    <caption>sample table</caption>
    +    <thead>
    +        <tr>
    +            <th>col 1</th>
    +            <th>col 2</th>
    +        </tr>
    +    </thead>
    +    <tfoot> <!-- HTML4 에선 tbody 앞-->
    +        <tr>
    +            <td>footer</td>
    +            <td>footer</td>
    +        </tr>
    +    </tfoot>
    +    <tbody>
    +        <tr>
    +            <td> row1 col1 </td>
    +            <td> row1 col2 </td>
    +        </tr>
    +    </tbody>
    +    <tr>
    +        <td> row2 col1 </td>
    +        <td> row2 col2 </td>
    +    </tr>
    +</table>
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + +
    sample table
    col 1col 2
    footerfooter
    row1 col1 row1 col2
    row2 col1 row2 col2
    +
  • +
+

iframe

+
+

현재 문서 안에 다른 HTML 페이지를 삽입하는 역할

+
+
    +
  • src 속성에 원하는 HTML 문서나 URL 전달
  • +
  • name 속성을 지정해 <a> target 속성을 사용해 iframe에서 문서나 URL 열리게 가능
  • +
  • 불러온 외부 페이지의 영향을 받을 수 있다. +
    + +
    +
    1
    +2
    +3
    +4
    +5
    +
    +
    <iframe src = "/sample.html" frameborder = "0"></iframe>
    +
    +<iframe name="sample" frameborder="0"></iframe>
    +<a href="https://example.com/" target="sample">example.com</a> 
    +<!--target으로 설정된 iframe에서 외부 페이지가 열림-->
    +
    +
    +
  • +
+

양식 태그

+

form

+
    +
  • +

    정보를 제출하기 위한 태그

    +
  • +
  • +

    정보 입력을 위한 <input>, <selectbox>, <textarea>

    +
  • +
  • +

    정보 제출을 위한 <button>

    +
  • +
  • +

    action 속성 : 정보 제출 시 페이지 이동

    +
  • +
  • +

    method 속성 : 정보 제출 시 처리 방식 결정

    +
      +
    • get : 검색 엔진 등에 사용
    • +
    • post : 로그인 등 보안이 중요한 방식에 사용
    • +
    +
    + +
    +
     1
    + 2
    + 3
    + 4
    + 5
    + 6
    + 7
    + 8
    + 9
    +10
    +
    +
    <form action="form-result.html" method="post">
    +    <input name="id" type="text">
    +    <input name="password" type="password">
    +    <select name="opt">
    +        <option>옵션1</option>
    +        <option>옵션2</option>
    +        <option>옵션3</option>
    +    </select>
    +    <button type="submit">전송</button>
    +</form>
    +
    +
    +
  • +
+

label

+
    +
  • <input>, <selectbox>, <textarea> 의 설명을 작성하는 태그
  • +
  • for 속성 : 연결하려는 태그의 id속성으로 지정하면 label클릭 시 연결된 태그가 선택됨
  • +
  • label 태그 내부에 input 태그를 넣으면, for->id 연결을 직접 작성하지 않아도 같은 처리를 해 준다.
  • +
  • id 속성값은 절대 중복되면 안됨
  • +
+
+ +
+
1
+2
+3
+4
+5
+6
+7
+
+
<label for ="userid">아이디</label>
+<input id = "userid" type = "text" name = "userid">
+
+<label>
+    비밀번호
+    <input name = "password" type = "password">
+</label>
+
+
+

input

+
    +
  • +

    사용자에게 데이터를 입력 받을 수 있는 대화형 태그

    +
  • +
  • +

    type 속성 : 받을 수 있는 input 유형을 정함 (기본:text)

    +
  • +
  • +

    value 속성 : 기본 내용을 입력해둘 수 있음

    +
  • +
  • +

    name : input 이름 지정

    +
  • +
  • +

    자주 사용되는 input type

    +
      +
    • checkbox
    • +
    • radio
    • +
    • file
    • +
    • button : input 태그를 버튼역할로 사용해야할 때 활용
    • +
    • hidden : 시각적으로 숨겨지지만 정보 제출 시 value속성에 입력된 값은 전송됨
    • +
    +
    + +
    +
    1
    +2
    +3
    +
    +
    <input type="text">
    +<input type="text" name="input-name">
    +<input type="text" value="입력 내용">
    +
    +
    +
  • +
+

select

+
    +
  • select, selectbox
  • +
  • 옵션 메뉴를 제공하는 태그
  • +
  • option 태그 : 선택할 옵션들을 정의
  • +
  • value 속성 : 제출 시 선택한 옵션의 value값이 전송됨
  • +
  • value 속성을 선언하지 않은 경우엔 option 태그 콘텐츠가 기본값
  • +
  • placehoder 속성 사용 불가
  • +
+
+ +
+
1
+2
+3
+4
+5
+6
+
+
<select name = "selectbox">
+    <option value="">choose</option>
+    <option value = "opt1">opt1</option>
+    <option value = "opt2">opt2</option>
+    <option>opt3</option> 
+</select>
+
+
+

textarea

+
    +
  • 여러 줄을 입력할 수 있는 대화형 태그
  • +
  • 콘텐츠에 내용을 입력할 경우 그 내용이 기본적으로 표시됨
  • +
  • cols/rows 속성 : 기본 너비와 높이를 지정할 수 있으며, 이는 글자 크기 기준으로 정의됨
  • +
  • 알아두면 좋은 속성 +
      +
    • readonly : 수정 불가능한 읽기 전용
    • +
    • required : form 제출 시 “필수 입력 사항"으로 설정 (안내 문구나 행동 등은 브라우저가 자동으로 처리함)
    • +
    • placeholder : input, textarea에 부가설명을 입력해둘 수 있으며, select 에는 사용 불가
    • +
    • disabled : 비활성화되어 제출 시 값이 전송되지 않음
    • +
    +
  • +
+

button

+
    +
  • 클릭가능한 버튼
  • +
  • form tag 내 어디서든 사용 가능
  • +
  • type 속성 +
      +
    • submit(기본): 양식 제출
    • +
    • reset: 입력 양식 모두 초기화
    • +
    +
  • +
  • 콘텐츠에 블록레벨을 제외한 태그 입력 가능
  • +
  • disabled 속성 가능
  • +
+

👀 CHECK

+
(어렵거나 새롭게 알게 된 것 등 다시 확인할 것들)
+
    +
  • vscode -> cmd + , -> folder 검색 -> 계층 구조 관련 옵션 바꿀 수 있음
  • +
  • markup : 설명 블로그
  • +
  • 맥에서 크롬 개발자 도구 한번에 키는 단축키 : cmd + shift + c
  • +
+

❗ 느낀 점

+

HTML문법이나 태그 등에 대한건 이미 알고 있었지만 이론적으로 정리해본 적은 없었기에 이번 강의를 듣고 정리할 수 있어서 좋았다. 특히 contents 태그와 단일 태그의 존재는 알았지만 그 명칭은 몰랐기 때문에 머리속에서 모호하게 정의된 개념들이 이름을 가지고 명확해져서 좋았다.

+

강의 내용을 정리하고 직접 실행해보고 궁금한 부분은 따로 찾아보는 등 하다보니 주어진 코어타임보다 훨씬 더 오랜 시간을 붙잡고 있게 되었다. 중간중간 집중력도 떨어지고 체력적으로도 힘든 걸 느끼면서, 이론적인 공부보다는 실제 코드를 작성하는 게 더 재밌다는걸 새삼 체감했다. 그렇지만 이론적인 공부가 전부가 아니더라도 기본적인건 알아야 하니까 재미없다고 등한시 하지는 않아야겠다. :<

+

이번주는 드디어 웹 크롤링과 분석을 시작하는데, 내가 해봤던 것과 다른점은 무엇이고 어떤걸 배워나가게 될지 벌써부터 기대가 된다. 내일도 열심히 하는 하루를 보내야겠다. :>

+ +
+ + +
+ + + + + +
+ + + + + + + + + Licensed under CC BY-NC-SA 4.0 +
+
+ + + +
+ + + + + + + + + + +
+
+ + +comments powered by Disqus +
+ + + + + + + +
+ + +
+ Hugo로 만듦
+ JimmyStack 테마 사용 중 +
+
+ + + + + +
+
+ + + + + diff --git a/public/p/rich-content/index.html b/public/p/day-7/index.html similarity index 53% rename from public/p/rich-content/index.html rename to public/p/day-7/index.html index cb5a402..4aaedca 100644 --- a/public/p/rich-content/index.html +++ b/public/p/day-7/index.html @@ -1,18 +1,20 @@ - + - -Rich Content - - - - - - - - - - + +Day 7 + + + + + + + + + + + + + + + + +
+
+
+ +
+ + + + +
+

+ Day 8 +

+ + +
+ + + + + +
+ +
+ + + + + + + + + + +
+ + + +
+ + + +
+ +
+ +
+ + + +

TIL - HTML 분석

+

📋 공부 내용

+

requests

+
    +
  • 라이브러리를 사용해 웹 브라우저와 같이 웹 페이지를 요청하고 응답을 받아옴
  • +
  • 응답 받은 문서 -> 분석 필요!
  • +
+

BeautifulSoup

+
+

HTML 코드를 분석 하는 라이브러리 (HTML Parser)

+
+

설치 방법

+

(mac, python3 기준)

+
+ +
+
1
+2
+3
+
+
pip install bs4
+or
+pip3 install bs4
+
+
+

HTML 분석 실습

+
    +
  • +

    필요 라이브러리 불러오기

    +
    + +
    +
    1
    +2
    +
    +
    import requests
    +from bs4 import BeautifulSoup #import bs library
    +
    +
    +
  • +
  • +

    사이트를 요청하고 응답받기

    +
    + +
    +
    1
    +2
    +
    +
    # requests.get으로 사이트 HTML을 받아 와 저장
    +res = requests.get("https://www.example.com")
    +
    +
    +
  • +
  • +

    응답받은 HTML으로 BeautifulSoup 객체를 만들고 내용을 출력해보기

    +
    + +
    +
    1
    +2
    +3
    +4
    +5
    +6
    +
    +
    # bs 객체를 만들고, res.text와 "html.paser"를 인자로 넘겨
    +# HTML parser 역할을 하게 만듬
    +soup = BeautifulSoup(res.text, "html.parser")
    +
    +# HTML의 구조를 잘 보여주도록 들여쓰기하여 출력
    +print(soup.prettify())
    +
    +
    +
  • +
  • +

    HTML의 특정 요소 찾기

    +
    + +
    +
     1
    + 2
    + 3
    + 4
    + 5
    + 6
    + 7
    + 8
    + 9
    +10
    +11
    +12
    +13
    +
    +
    # 해당하는 각 태그의 내용을 보여줌
    +soup.title
    +soup.head
    +soup.body
    +
    +# h1태그들 중 가장 먼저 나오는것을 찾아 반환
    +h1 = soup.find("h1")
    +# p태그 모두를 찾아 반환
    +soup.find_all("p")
    +
    +# 태그 이름과 (h1) 태그 안의 내용을 가져옴
    +h1.name
    +h1.text
    +
    +
    +
  • +
  • +

    특정 요소를 찾아 그 안의 원하는 정보만 추려내기

    +
    + +
    +
    1
    +2
    +3
    +4
    +5
    +6
    +7
    +8
    +9
    +
    +
    # 책 리스트를 찾아 그 제목만 추출하는 코드
    +
    +# 직접 사이트를 확인하고 h3태그에 책 이미지, 저자, 제목 등이 있는것을 확인하여 find_all로 가져옴
    +h3_results = soup.find_all('h3')
    +
    +# 객체로 만들게 되면, 내부 태그를 속성처럼 쓸 수 있음
    +# h3 > a 태그 내에 title 속성 value를 출력하는 함수
    +for book in h3_results:
    +    print(book.a['title'])
    +
    +
    +
  • +
  • +

    id를 이용해 요소 가져오기

    +
    + +
    +
    1
    +2
    +3
    +
    +
    # .find(<tag_name>, id = <id_name>)
    +soup.find_all("div", id="bo_list")
    +soup.find("div", id="bo_cate")
    +
    +
    +
  • +
  • +

    class를 이용해 요소 가져오기

    +
    + +
    +
    1
    +2
    +3
    +
    +
    # .find(<tag_name>, <class_name>)
    +soup.find_all("li", "questions") 
    +soup.find("div", "question")
    +
    +
    +
  • +
  • +

    user-agent 정보를 넘기면서 요청하기
    +user agent 확인 사이트

    +
    + +
    +
    1
    +2
    +3
    +4
    +5
    +
    +
    user_agent = {"User-Agent": <본인의 user agent 정보>}
    +import requests
    +from bs4 import BeautifulSoup
    +url = "https://qna.programmers.co.kr/"
    +res = requests.get(url, user_agent)
    +
    +
    +
  • +
  • +

    페이지네이션 (Pagination)

    +
    +

    정보를 인덱스로 구분하는 기법

    +
    +
    + +
    +
     1
    + 2
    + 3
    + 4
    + 5
    + 6
    + 7
    + 8
    + 9
    +10
    +11
    +12
    +13
    +14
    +15
    +
    +
    # 해당 사이트는 query string으로 구분
    +import time
    +import requests
    +from bs4 import BeautifulSoup
    +
    +url = "https://qna.programmers.co.kr/?page={}"
    +
    +for i in range(1, 6):
    +    res = requests.get(url.format(i), user_agent)
    +    soup = BeautifulSoup(res.text, "html.parser")
    +    questions = soup.find_all("li", "question-list-item")
    +    for question in questions:
    +        print(question.find("div", "question").find("div", "top").h4.a.text)
    +    # 과도한 요청을 방지하기 위해 1초마다 요청
    +    time.sleep(1)
    +
    +
    +
  • +
+

웹 사이트와 스크래핑

+

정적 or 동적 웹 사이트

+
    +
  • 웹 사이트는 정적(Static) 웹 사이트동적(Dynamic) 웹 사이트 로 나눌 수 있다. +
    + + + + + + + + + + + + + + + + + + + +
    웹 사이트StaticDynamic
    HTML 내용고정변경
    HTML 데이터 로드응답 이전에 완료됨응답 이후에 완료되기도 함
    +
  • +
+

동기 or 비동기 처리

+

동기 처리 (정적 웹 사이트)

+
    +
  • 렌더링이 완료된 이후에 데이터 처리를 진행
  • +
  • 요청에 따른 응답을 기다려야 함
  • +
+

비동기 처리 (동적 웹 사이트)

+
    +
  • 렌더링과 데이터 처리가 동시에 진행됨
  • +
  • 요청에 따른 응답을 기다리지 않음
  • +
  • 상황에 따라 응답 시 받은 HTML 문서의 데이터가 완전하지 않은 경우 발생
  • +
+

스크래핑

+
    +
  • +

    requests 요청의 문제점

    +
      +
    1. 불완전하고 원하지 않은 내용의 응답을 받게 되어 동적 웹사이트에 적용이 어려움
    2. +
    3. 키보드, 마우스 입력 등 UI와 상호작용 하기 어려움
    4. +
    +
  • +
  • +

    해결 방법

    +
      +
    1. 데이터 처리 후 응답을 받아오는 방식 적용
    2. +
    3. UI Action을 프로그래밍
    4. +
    5. 웹 브라우저 역할을 하는 대신 웹 브라우저를 조작 -> Selenium
    6. +
    +
  • +
+

👀 CHECK

+

(어렵거나 새롭게 알게 된 것 등 다시 확인할 것들)

+
    +
  • Pagination : 정보를 인덱스로 구분하는 기법 +
      +
    • Query String
    • +
    +
  • +
  • .format method +
    + +
    +
    1
    +
    +
    "{}".format(a) -> "a"
    +
    +
    +
  • +
  • 동기 처리와 비동기 처리의 개념에 대해 한번 더 복습
  • +
  • bs .find 함수 +
      +
    • 여러 요소를 찾을 때 or을 적용하여 A or B or C class 모두를 찾을 수 있는지 궁금
    • +
    • class A, B / class A 인 요소 두 개가 있을 때 class B를 가진 요소는 배제하고 찾는 방법도 궁금
    • +
    +
  • +
  • 정적 웹 사이트에는 requests같은 라이브러리를 쓰고 동적 웹 사이트에는 Selenium을 쓰는지 아니면 일괄적으로 Selenium처럼 웹 사이트를 조작하는 형식의 라이브러리만 쓰는지 궁금하다.
  • +
  • 중첩된 div 내에 h4가 있는 경우에 (div>div>h4) 가장 바깥 div 내에 h4가 하나뿐이라면 div_container.find("div").h4 로 쓰지 않고 div_container.h4로 작성해도 원하는 기능을 하던데 이유가 궁금하다.
  • +
+

❗ 느낀 점

+

오늘은 꽤나 만족스러운 하루를 보냈다.

+

강의와 실습은 내 기준엔 어렵지 않아 2시간 내로 완료했다. 실습을 하면서 주어진 사이트 외에 다른 사이트도 들어가서 분석하고 배운 함수를 적용해보았다. +실습을 하면서 궁금한 점이 몇개 생겼고 CHECK에도 적어놨는데, TIL을 다 적은 후에 구글링 및 슬랙 채널을 통해서 해결해 볼 생각이다.

+

그리고 코어타임 중간에 hugo로 만든 블로그에 글을 올려봤는데 내가 생각했던것 보다 더 쉬워서 안심했다. 블로그와 관련해 다음 세 가지 목표를 세웠다.

+
    +
  1. github action 수정해서 push 하면 자동으로 빌드, 배포되게 만들기
  2. +
  3. hugo new post 템플릿 만들기
  4. +
  5. 한국어 설정하기
  6. +
+

이렇게 세팅을 완료한 후에, 기존에 작성했던 TIL을 올리고 카테고리 설정까지 하면 완성이다. 나중엔 블로그 메인 페이지 커스텀, 댓글 위젯 설정, SEO 세팅 등을 해보려고 한다.

+ +
+ + + + + + +
+ + + + + + + + + + +
+
+ + +comments powered by Disqus +
+ + + + + + + +
+ + +
+ Hugo로 만듦
+ JimmyStack 테마 사용 중 +
+
+ + + + + +
+ + + + + + diff --git a/public/p/emoji-support/_huf941de4769045cdfa8c9ee7036519a2a_35369_36687b530fa140121781e790cfd060e7.jpg b/public/p/emoji-support/_huf941de4769045cdfa8c9ee7036519a2a_35369_36687b530fa140121781e790cfd060e7.jpg deleted file mode 100644 index 76a020e..0000000 Binary files a/public/p/emoji-support/_huf941de4769045cdfa8c9ee7036519a2a_35369_36687b530fa140121781e790cfd060e7.jpg and /dev/null differ diff --git a/public/p/emoji-support/the-creative-exchange-d2zvqp3fpro-unsplash.60116b1ccfc8632e9a65f7d51df3efc2.jpg b/public/p/emoji-support/the-creative-exchange-d2zvqp3fpro-unsplash.60116b1ccfc8632e9a65f7d51df3efc2.jpg deleted file mode 100644 index e34a59d..0000000 Binary files a/public/p/emoji-support/the-creative-exchange-d2zvqp3fpro-unsplash.60116b1ccfc8632e9a65f7d51df3efc2.jpg and /dev/null differ diff --git a/public/p/emoji-support/the-creative-exchange-d2zvqp3fpro-unsplash.jpg b/public/p/emoji-support/the-creative-exchange-d2zvqp3fpro-unsplash.jpg deleted file mode 100644 index e34a59d..0000000 Binary files a/public/p/emoji-support/the-creative-exchange-d2zvqp3fpro-unsplash.jpg and /dev/null differ diff --git a/public/p/emoji-support/the-creative-exchange-d2zvqp3fpro-unsplash_huf941de4769045cdfa8c9ee7036519a2a_35369_120x120_fill_q75_box_smart1.jpg b/public/p/emoji-support/the-creative-exchange-d2zvqp3fpro-unsplash_huf941de4769045cdfa8c9ee7036519a2a_35369_120x120_fill_q75_box_smart1.jpg deleted file mode 100644 index de5a1fa..0000000 Binary files a/public/p/emoji-support/the-creative-exchange-d2zvqp3fpro-unsplash_huf941de4769045cdfa8c9ee7036519a2a_35369_120x120_fill_q75_box_smart1.jpg and /dev/null differ diff --git a/public/p/emoji-support/the-creative-exchange-d2zvqp3fpro-unsplash_huf941de4769045cdfa8c9ee7036519a2a_35369_1600x0_resize_q75_box.jpg b/public/p/emoji-support/the-creative-exchange-d2zvqp3fpro-unsplash_huf941de4769045cdfa8c9ee7036519a2a_35369_1600x0_resize_q75_box.jpg deleted file mode 100644 index 7df1663..0000000 Binary files a/public/p/emoji-support/the-creative-exchange-d2zvqp3fpro-unsplash_huf941de4769045cdfa8c9ee7036519a2a_35369_1600x0_resize_q75_box.jpg and /dev/null differ diff --git a/public/p/emoji-support/the-creative-exchange-d2zvqp3fpro-unsplash_huf941de4769045cdfa8c9ee7036519a2a_35369_800x0_resize_q75_box.jpg b/public/p/emoji-support/the-creative-exchange-d2zvqp3fpro-unsplash_huf941de4769045cdfa8c9ee7036519a2a_35369_800x0_resize_q75_box.jpg deleted file mode 100644 index 985e522..0000000 Binary files a/public/p/emoji-support/the-creative-exchange-d2zvqp3fpro-unsplash_huf941de4769045cdfa8c9ee7036519a2a_35369_800x0_resize_q75_box.jpg and /dev/null differ diff --git a/public/p/markdown-syntax-guide/index.html b/public/p/markdown-syntax-guide/index.html deleted file mode 100644 index df26c09..0000000 --- a/public/p/markdown-syntax-guide/index.html +++ /dev/null @@ -1,872 +0,0 @@ - - - - -Markdown Syntax Guide - - - - - - - - - - - - - - -
- - - - -
-
-
-
- - Featured image of post Markdown Syntax Guide - - -
- - -
- - - - -
-

- Markdown Syntax Guide -

- - -

- Sample article showcasing basic Markdown syntax and formatting for HTML elements. -

- -
- - - - - -
- -
- - - - - - - - - - -
- - - -
- - - - - - - - - -
- -
- - - -
- -
- -
- - -

This article offers a sample of basic Markdown syntax that can be used in Hugo content files, also it shows whether basic HTML elements are decorated with CSS in a Hugo theme.

-

Headings

-

The following HTML <h1><h6> elements represent six levels of section headings. <h1> is the highest section level while <h6> is the lowest.

-

H1

-

H2

-

H3

-

H4

-
H5
-
H6
-

Paragraph

-

Xerum, quo qui aut unt expliquam qui dolut labo. Aque venitatiusda cum, voluptionse latur sitiae dolessi aut parist aut dollo enim qui voluptate ma dolestendit peritin re plis aut quas inctum laceat est volestemque commosa as cus endigna tectur, offic to cor sequas etum rerum idem sintibus eiur? Quianimin porecus evelectur, cum que nis nust voloribus ratem aut omnimi, sitatur? Quiatem. Nam, omnis sum am facea corem alique molestrunt et eos evelece arcillit ut aut eos eos nus, sin conecerem erum fuga. Ri oditatquam, ad quibus unda veliamenimin cusam et facea ipsamus es exerum sitate dolores editium rerore eost, temped molorro ratiae volorro te reribus dolorer sperchicium faceata tiustia prat.

-

Itatur? Quiatae cullecum rem ent aut odis in re eossequodi nonsequ idebis ne sapicia is sinveli squiatum, core et que aut hariosam ex eat.

-

Blockquotes

-

The blockquote element represents content that is quoted from another source, optionally with a citation which must be within a footer or cite element, and optionally with in-line changes such as annotations and abbreviations.

-

Blockquote without attribution

-
-

Tiam, ad mint andaepu dandae nostion secatur sequo quae. -Note that you can use Markdown syntax within a blockquote.

-
-

Blockquote with attribution

-
-

Don’t communicate by sharing memory, share memory by communicating.
-— Rob Pike1

-
-

Tables

-

Tables aren’t part of the core Markdown spec, but Hugo supports supports them out-of-the-box.

-
- - - - - - - - - - - - - - - - -
NameAge
Bob27
Alice23
-

Inline Markdown within tables

-
- - - - - - - - - - - - - - -
ItalicsBoldCode
italicsboldcode
-
- - - - - - - - - - - - - - - - - - - - -
ABCDEF
Lorem ipsum dolor sit amet, consectetur adipiscing elit.Phasellus ultricies, sapien non euismod aliquam, dui ligula tincidunt odio, at accumsan nulla sapien eget ex.Proin eleifend dictum ipsum, non euismod ipsum pulvinar et. Vivamus sollicitudin, quam in pulvinar aliquam, metus elit pretium purusProin sit amet velit nec enim imperdiet vehicula.Ut bibendum vestibulum quam, eu egestas turpis gravida necSed scelerisque nec turpis vel viverra. Vivamus vitae pretium sapien
-

Code Blocks

-

Code block with backticks

-
- -
-
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-
-
<!doctype html>
-<html lang="en">
-<head>
-  <meta charset="utf-8">
-  <title>Example HTML5 Document</title>
-</head>
-<body>
-  <p>Test</p>
-</body>
-</html>
-
-
-

Code block indented with four spaces

-
<!doctype html>
-<html lang="en">
-<head>
-  <meta charset="utf-8">
-  <title>Example HTML5 Document</title>
-</head>
-<body>
-  <p>Test</p>
-</body>
-</html>
-
-

Code block with Hugo’s internal highlight shortcode

-
- -
-
 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-
-
<!doctype html>
-<html lang="en">
-<head>
-  <meta charset="utf-8">
-  <title>Example HTML5 Document</title>
-</head>
-<body>
-  <p>Test</p>
-</body>
-</html>
-
-
-

Diff code block

-
- -
-
1
-2
-3
-4
-5
-
-
[dependencies.bevy]
-git = "https://github.com/bevyengine/bevy"
-rev = "11f52b8c72fc3a568e8bb4a4cd1f3eb025ac2e13"
-- features = ["dynamic"]
-+ features = ["jpeg", "dynamic"]
-
-
-

List Types

-

Ordered List

-
    -
  1. First item
  2. -
  3. Second item
  4. -
  5. Third item
  6. -
-

Unordered List

-
    -
  • List item
  • -
  • Another item
  • -
  • And another item
  • -
-

Nested list

-
    -
  • Fruit -
      -
    • Apple
    • -
    • Orange
    • -
    • Banana
    • -
    -
  • -
  • Dairy -
      -
    • Milk
    • -
    • Cheese
    • -
    -
  • -
-

Other Elements — abbr, sub, sup, kbd, mark

-

GIF is a bitmap image format.

-

H2O

-

Xn + Yn = Zn

-

Press CTRL + ALT + Delete to end the session.

-

Most salamanders are nocturnal, and hunt for insects, worms, and other small creatures.

-

Hyperlinked image

-

Google

-
-
-
    -
  1. -

    The above quote is excerpted from Rob Pike’s talk during Gopherfest, November 18, 2015. ↩︎

    -
  2. -
-
-
- - -
- - - - - -
- - - - - - - - - Licensed under CC BY-NC-SA 4.0 -
-
- - - -
- - - - - - - - -
-
- - -comments powered by Disqus -
- - - - - - - -
- - -
- Built with Hugo
- Theme Stack designed by Jimmy -
-
- - - - - -
-
- - - - - diff --git a/public/p/markdown-syntax-guide/pawel-czerwinski-8uZPynIu-rQ-unsplash.jpg b/public/p/markdown-syntax-guide/pawel-czerwinski-8uZPynIu-rQ-unsplash.jpg deleted file mode 100644 index 1634e85..0000000 Binary files a/public/p/markdown-syntax-guide/pawel-czerwinski-8uZPynIu-rQ-unsplash.jpg and /dev/null differ diff --git a/public/p/markdown-syntax-guide/pawel-czerwinski-8uZPynIu-rQ-unsplash_hud7e36f7e20e71be184458283bdae4646_55974_120x120_fill_q75_box_smart1.jpg b/public/p/markdown-syntax-guide/pawel-czerwinski-8uZPynIu-rQ-unsplash_hud7e36f7e20e71be184458283bdae4646_55974_120x120_fill_q75_box_smart1.jpg deleted file mode 100644 index 0707d56..0000000 Binary files a/public/p/markdown-syntax-guide/pawel-czerwinski-8uZPynIu-rQ-unsplash_hud7e36f7e20e71be184458283bdae4646_55974_120x120_fill_q75_box_smart1.jpg and /dev/null differ diff --git a/public/p/markdown-syntax-guide/pawel-czerwinski-8uZPynIu-rQ-unsplash_hud7e36f7e20e71be184458283bdae4646_55974_1600x0_resize_q75_box.jpg b/public/p/markdown-syntax-guide/pawel-czerwinski-8uZPynIu-rQ-unsplash_hud7e36f7e20e71be184458283bdae4646_55974_1600x0_resize_q75_box.jpg deleted file mode 100644 index 7c6ce44..0000000 Binary files a/public/p/markdown-syntax-guide/pawel-czerwinski-8uZPynIu-rQ-unsplash_hud7e36f7e20e71be184458283bdae4646_55974_1600x0_resize_q75_box.jpg and /dev/null differ diff --git a/public/p/markdown-syntax-guide/pawel-czerwinski-8uZPynIu-rQ-unsplash_hud7e36f7e20e71be184458283bdae4646_55974_800x0_resize_q75_box.jpg b/public/p/markdown-syntax-guide/pawel-czerwinski-8uZPynIu-rQ-unsplash_hud7e36f7e20e71be184458283bdae4646_55974_800x0_resize_q75_box.jpg deleted file mode 100644 index 2bc4162..0000000 Binary files a/public/p/markdown-syntax-guide/pawel-czerwinski-8uZPynIu-rQ-unsplash_hud7e36f7e20e71be184458283bdae4646_55974_800x0_resize_q75_box.jpg and /dev/null differ diff --git a/public/p/migrate-from-jekyl/index.html b/public/p/migrate-from-jekyl/index.html deleted file mode 100644 index 94bdbd8..0000000 --- a/public/p/migrate-from-jekyl/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - https://srlee056.github.io/p/markdown-syntax-guide/ - - - - - - diff --git a/public/p/placeholder-text/_hu958d513eeefe5556a31d065479ecc5ac_14205_7bffa90d1e66ca9b8184fda08a99dc7e.jpg b/public/p/placeholder-text/_hu958d513eeefe5556a31d065479ecc5ac_14205_7bffa90d1e66ca9b8184fda08a99dc7e.jpg deleted file mode 100644 index 461c3fa..0000000 Binary files a/public/p/placeholder-text/_hu958d513eeefe5556a31d065479ecc5ac_14205_7bffa90d1e66ca9b8184fda08a99dc7e.jpg and /dev/null differ diff --git a/public/p/placeholder-text/matt-le-SJSpo9hQf7s-unsplash.8eae06664ddfb3e8dc6e000756cb703b.jpg b/public/p/placeholder-text/matt-le-SJSpo9hQf7s-unsplash.8eae06664ddfb3e8dc6e000756cb703b.jpg deleted file mode 100644 index 3b28790..0000000 Binary files a/public/p/placeholder-text/matt-le-SJSpo9hQf7s-unsplash.8eae06664ddfb3e8dc6e000756cb703b.jpg and /dev/null differ diff --git a/public/p/placeholder-text/matt-le-SJSpo9hQf7s-unsplash.jpg b/public/p/placeholder-text/matt-le-SJSpo9hQf7s-unsplash.jpg deleted file mode 100644 index 3b28790..0000000 Binary files a/public/p/placeholder-text/matt-le-SJSpo9hQf7s-unsplash.jpg and /dev/null differ diff --git a/public/p/placeholder-text/matt-le-SJSpo9hQf7s-unsplash_hu958d513eeefe5556a31d065479ecc5ac_14205_120x120_fill_q75_box_smart1.jpg b/public/p/placeholder-text/matt-le-SJSpo9hQf7s-unsplash_hu958d513eeefe5556a31d065479ecc5ac_14205_120x120_fill_q75_box_smart1.jpg deleted file mode 100644 index edfece9..0000000 Binary files a/public/p/placeholder-text/matt-le-SJSpo9hQf7s-unsplash_hu958d513eeefe5556a31d065479ecc5ac_14205_120x120_fill_q75_box_smart1.jpg and /dev/null differ diff --git a/public/p/placeholder-text/matt-le-SJSpo9hQf7s-unsplash_hu958d513eeefe5556a31d065479ecc5ac_14205_1600x0_resize_q75_box.jpg b/public/p/placeholder-text/matt-le-SJSpo9hQf7s-unsplash_hu958d513eeefe5556a31d065479ecc5ac_14205_1600x0_resize_q75_box.jpg deleted file mode 100644 index 9157b65..0000000 Binary files a/public/p/placeholder-text/matt-le-SJSpo9hQf7s-unsplash_hu958d513eeefe5556a31d065479ecc5ac_14205_1600x0_resize_q75_box.jpg and /dev/null differ diff --git a/public/p/placeholder-text/matt-le-SJSpo9hQf7s-unsplash_hu958d513eeefe5556a31d065479ecc5ac_14205_800x0_resize_q75_box.jpg b/public/p/placeholder-text/matt-le-SJSpo9hQf7s-unsplash_hu958d513eeefe5556a31d065479ecc5ac_14205_800x0_resize_q75_box.jpg deleted file mode 100644 index 5ddd357..0000000 Binary files a/public/p/placeholder-text/matt-le-SJSpo9hQf7s-unsplash_hu958d513eeefe5556a31d065479ecc5ac_14205_800x0_resize_q75_box.jpg and /dev/null differ diff --git a/public/page/1/index.html b/public/page/1/index.html index c7451bc..bd61d0b 100644 --- a/public/page/1/index.html +++ b/public/page/1/index.html @@ -1,5 +1,5 @@ - + https://srlee056.github.io/ diff --git a/public/page/2/index.html b/public/page/2/index.html new file mode 100644 index 0000000..116a053 --- /dev/null +++ b/public/page/2/index.html @@ -0,0 +1,684 @@ + + + + + +서림록 + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + +
+ + +
+
+ +
+ + + + +
+

+ Day 3 +

+ + +
+ + + + + +
+ +
+ + + + + + + + + + +
+ + + +
+ + + +
+ +
+
+ + +
+
+ +
+ + + + +
+

+ Day 2 +

+ + +
+ + + + + +
+ +
+ + + + + + + + + + +
+ + + +
+ + + +
+ +
+
+ + +
+
+ +
+ + + + +
+

+ Blog 제작기 #1 +

+ + +
+ + + + + +
+ +
+ + + + + + + + + + +
+ + + +
+ + + +
+ +
+
+ + +
+
+ +
+ + + + +
+

+ Day 1 +

+ + +
+ + + + + +
+ +
+ + + + + + + + + + +
+ + + +
+ + + +
+ +
+
+ +
+ + +
+ + +
+ Hugo로 만듦
+ JimmyStack 테마 사용 중 +
+
+ +
+
+ + + + + diff --git a/public/page/index.html b/public/page/index.html index d3998de..db5866d 100644 --- a/public/page/index.html +++ b/public/page/index.html @@ -1,18 +1,20 @@ - + - + Pages - + - - + + - + + +
@@ -270,10 +268,10 @@

좋은 개발자로 한걸음 더

- - + + - + +

+ + +
+ + + + + + + + + + + + 🤩 + +
+ + + +
+

서림록

+

좋은 개발자로 한걸음 더

+
+
+ + +
+ + +
+
+

+ + 섹션 + +

+ +
+
+

9 페이지

+

Posts

+ +
+
+
+ +
+ + + + + + + + + +
+ + +
+ + +
+ Hugo로 만듦
+ JimmyStack 테마 사용 중 +
+
+ + +
+ + + + + + diff --git a/public/search/index.html b/public/search/index.html index 647d193..1c5aa50 100644 --- a/public/search/index.html +++ b/public/search/index.html @@ -1,5 +1,5 @@ - + Search @@ -9,10 +9,12 @@ - + - + + +
@@ -268,11 +266,11 @@

좋은 개발자로 한걸음 더

- - + +

- + +
+ + +
+ + + + + + + + + + + + 🤩 + +
+ + + +
+

서림록

+

좋은 개발자로 한걸음 더

+
+
+ + +
+ + +
+
+

+ + Tags + +

+ +
+
+

5 페이지

+

Data Structure

+ +
+
+
+ +
+ + + + + + + + + + + +
+
+ + +
+ Hugo로 만듦
+ JimmyStack 테마 사용 중 +
+
+ + +
+ + + + + + diff --git a/public/tags/data-structure/index.xml b/public/tags/data-structure/index.xml new file mode 100644 index 0000000..69bf205 --- /dev/null +++ b/public/tags/data-structure/index.xml @@ -0,0 +1,1547 @@ + + + + Data Structure on 서림록 + https://srlee056.github.io/tags/data-structure/ + Recent content in Data Structure on 서림록 + Hugo -- gohugo.io + ko + Seorim Lee + Fri, 20 Oct 2023 00:00:00 +0000 + Day 5 + https://srlee056.github.io/p/day-5/ + Fri, 20 Oct 2023 00:00:00 +0000 + + https://srlee056.github.io/p/day-5/ + <h1 id="span-stylecolor79ac78til---heap--dynamic-programming--dfsbfs-문제풀이-위주span"><strong><span style="color:#79AC78">TIL - Heap / Dynamic Programming / DFS&amp;BFS (문제풀이 위주)</span></strong></h1> +<h2 id="span-stylecolorb0d9b1공부-내용span">📋 <strong><span style="color:#B0D9B1">공부 내용</span></strong></h2> +<h3 id="span-stylecolord0e7d2heapspan"><span style="color:#D0E7D2">Heap</span></h3> +<hr> +<h4 id="더-맵게-문제-풀이">&lt;더 맵게&gt; 문제 풀이</h4> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span><span class="lnt">14 +</span><span class="lnt">15 +</span><span class="lnt">16 +</span><span class="lnt">17 +</span><span class="lnt">18 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">heapq</span> <span class="c1">#heap 라이브러리 사용</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">solution</span><span class="p">(</span><span class="n">scoville</span><span class="p">,</span> <span class="n">K</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">answer</span> <span class="o">=</span> <span class="mi">0</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># heapify, heappop, heappush 활용</span> +</span></span><span class="line"><span class="cl"> <span class="n">heapq</span><span class="o">.</span><span class="n">heapify</span><span class="p">(</span><span class="n">scoville</span><span class="p">)</span> <span class="c1">#min heap 구성</span> +</span></span><span class="line"><span class="cl"> <span class="k">while</span> <span class="kc">True</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">s1</span> <span class="o">=</span> <span class="n">heapq</span><span class="o">.</span><span class="n">heappop</span><span class="p">(</span><span class="n">scoville</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">s1</span> <span class="o">&gt;=</span> <span class="n">K</span> <span class="p">:</span> <span class="c1">#모든 스코빌 지수가 K이상</span> +</span></span><span class="line"><span class="cl"> <span class="k">break</span> +</span></span><span class="line"><span class="cl"> <span class="k">elif</span> <span class="nb">len</span><span class="p">(</span><span class="n">scoville</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span> <span class="c1"># K이상으로 만들 수 없는 경우</span> +</span></span><span class="line"><span class="cl"> <span class="n">answer</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span> +</span></span><span class="line"><span class="cl"> <span class="k">break</span> +</span></span><span class="line"><span class="cl"> <span class="n">s2</span> <span class="o">=</span> <span class="n">heapq</span><span class="o">.</span><span class="n">heappop</span><span class="p">(</span><span class="n">scoville</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="n">newS</span> <span class="o">=</span> <span class="n">s1</span> <span class="o">+</span> <span class="n">s2</span><span class="o">*</span><span class="mi">2</span> +</span></span><span class="line"><span class="cl"> <span class="n">heapq</span><span class="o">.</span><span class="n">heappush</span><span class="p">(</span><span class="n">scoville</span><span class="p">,</span><span class="n">newS</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="n">answer</span> <span class="o">+=</span> <span class="mi">1</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">answer</span> +</span></span></code></pre></td></tr></table> +</div> +</div><br> +<h3 id="span-stylecolord0e7d2dynamic-programmingspan"><span style="color:#D0E7D2">Dynamic Programming</span></h3> +<hr> +<h4 id="dpdynamic-programming">DP(Dynamic Programming)</h4> +<blockquote> +<p>알고리즘 진행에 따라 <code>탐색해야 할 범위를 동적으로 결정</code>하여 탐색 범위를 한정</p> +</blockquote> +<p><strong>EX1)</strong> <em>피보나치 수열</em></p> +<table> +<thead> +<tr> +<th>Complexity</th> +<th>재귀함수</th> +<th>DP</th> +</tr> +</thead> +<tbody> +<tr> +<td>Time</td> +<td>O(2^n)</td> +<td>O(n)</td> +</tr> +<tr> +<td>Space</td> +<td>O(n)</td> +<td>O(n)</td> +</tr> +</tbody> +</table> +<p>참고 : <a class="link" href="https://towardsdatascience.com/dynamic-programming-i-python-8b20387870f5" target="_blank" rel="noopener" + >Recursion vs Dynamic Programming - Fibonacci</a></p> +<p><strong>EX2)</strong> <em>knapsack problem</em><br> +weight / value를 가진 여러 물건이 있을 때, weight 제한이 있는 베낭에 value의 합이 가장 높도록 물건을 골라 담는 문제</p> +<br> +<h4 id="n으로-표현-문제-풀이">&lt;N으로 표현&gt; 문제 풀이</h4> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span><span class="lnt">14 +</span><span class="lnt">15 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">solution</span><span class="p">(</span><span class="n">N</span><span class="p">,</span> <span class="n">number</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">strN</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">N</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># 직관적인 코드를 위해 다음과 같이 index : 1~8 사용 설정 (index 0은 사용하지 않음)</span> +</span></span><span class="line"><span class="cl"> <span class="n">numberUsed</span> <span class="o">=</span> <span class="p">[{}</span> <span class="k">for</span> <span class="n">_</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">9</span><span class="p">)]</span> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">9</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">numberUsed</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span><span class="nb">int</span><span class="p">(</span><span class="n">strN</span> <span class="o">*</span> <span class="p">(</span><span class="n">i</span><span class="p">))}</span> <span class="c1"># N을 i번 나열한 숫자 ex) 555, 7777, ...</span> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">j</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span> <span class="p">,</span> <span class="n">i</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">n1</span> <span class="ow">in</span> <span class="n">numberUsed</span><span class="p">[</span><span class="n">j</span><span class="p">]:</span> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">n2</span> <span class="ow">in</span> <span class="n">numberUsed</span><span class="p">[</span><span class="n">i</span><span class="o">-</span><span class="n">j</span><span class="p">]:</span> +</span></span><span class="line"><span class="cl"> <span class="n">newNumbers</span> <span class="o">=</span> <span class="p">[</span><span class="n">n1</span><span class="o">*</span><span class="n">n2</span><span class="p">,</span> <span class="n">n1</span><span class="o">+</span><span class="n">n2</span><span class="p">,</span> <span class="n">n1</span><span class="o">-</span><span class="n">n2</span><span class="p">]</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">n2</span> <span class="o">!=</span> <span class="mi">0</span> <span class="p">:</span> <span class="n">newNumbers</span><span class="o">.</span><span class="n">append</span><span class="p">(</span> <span class="n">n1</span><span class="o">//</span><span class="n">n2</span> <span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="n">numberUsed</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">newNumbers</span><span class="p">)</span> <span class="c1">#set1.update(set2) 사용하여 원소 추가. set 아닌 list를 넘겨줄수도 있다.</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">number</span> <span class="ow">in</span> <span class="n">numberUsed</span><span class="p">[</span><span class="n">i</span><span class="p">]:</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">i</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="o">-</span><span class="mi">1</span> +</span></span></code></pre></td></tr></table> +</div> +</div><br> +<h3 id="span-stylecolord0e7d2dfs--bfsspan"><span style="color:#D0E7D2">DFS &amp; BFS</span></h3> +<h4 id="1-depth-first-search">1. Depth First Search</h4> +<blockquote> +<p>한 vertex에서 인접한 모든 vertex를 방문할 때, 인접한 vertex를 기준으로 <code>깊이 우선 탐색</code>을 끝낸 후 다음 vertex로 진행하는 방식<br> +<code>스택</code>을 이용하여 어느 정점에서 DFS를 진행하고 있는지를 기억</p> +</blockquote> +<h4 id="2-breadth-first-search">2. Breadth First Search</h4> +<blockquote> +<p>한 vertex에서 인접한 모든 vertex를 방문하고, 방문한 인접 vertex를 기준으로 <code>너비 우선 탐색</code>을 진행하는 방식</p> +</blockquote> +<h4 id="3-graph">3. Graph</h4> +<blockquote> +<p>-vertex(=node) &amp; edge(=link)<br> +-directed / undirected graph</p> +</blockquote> +<h4 id="여행-경로-문제-풀이">&lt;여행 경로&gt; 문제 풀이</h4> +<p>DFS를 응용한 재귀 한 붓 그리기</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span><span class="lnt">14 +</span><span class="lnt">15 +</span><span class="lnt">16 +</span><span class="lnt">17 +</span><span class="lnt">18 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">solution</span><span class="p">(</span><span class="n">tickets</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">routes</span> <span class="o">=</span> <span class="p">{}</span> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="ow">in</span> <span class="n">tickets</span><span class="p">:</span> <span class="c1">#출발지, 도착지</span> +</span></span><span class="line"><span class="cl"> <span class="n">routes</span><span class="p">[</span><span class="n">a</span><span class="p">]</span> <span class="o">=</span> <span class="n">routes</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="p">[])</span> +</span></span><span class="line"><span class="cl"> <span class="n">routes</span><span class="p">[</span><span class="n">a</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">b</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">r</span> <span class="ow">in</span> <span class="n">routes</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">routes</span><span class="p">[</span><span class="n">r</span><span class="p">]</span><span class="o">.</span><span class="n">sort</span><span class="p">(</span><span class="n">reverse</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># 역순인 이유? 파이썬의 데이터 삭제 과정을 살펴보면 뒤에서 뽑는게 더 효울적이기 때문 </span> +</span></span><span class="line"><span class="cl"> <span class="n">stack</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&#34;ICN&#34;</span><span class="p">]</span> +</span></span><span class="line"><span class="cl"> <span class="n">path</span> <span class="o">=</span> <span class="p">[]</span> +</span></span><span class="line"><span class="cl"> <span class="k">while</span> <span class="mi">0</span> <span class="o">&lt;</span> <span class="nb">len</span><span class="p">(</span><span class="n">stack</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">top</span> <span class="o">=</span> <span class="n">stack</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">top</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">routes</span> <span class="ow">or</span> <span class="nb">len</span><span class="p">(</span><span class="n">routes</span><span class="p">[</span><span class="n">top</span><span class="p">])</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span> <span class="c1"># 이 공항에서 떠나는 티켓이 존재하지 않음</span> +</span></span><span class="line"><span class="cl"> <span class="n">path</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">stack</span><span class="o">.</span><span class="n">pop</span><span class="p">())</span> +</span></span><span class="line"><span class="cl"> <span class="k">else</span> <span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">stack</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">routes</span><span class="p">[</span><span class="n">top</span><span class="p">]</span><span class="o">.</span><span class="n">pop</span><span class="p">())</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">path</span><span class="p">[::</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> +</span></span></code></pre></td></tr></table> +</div> +</div><br> +<h3 id="span-stylecolord0e7d2추가-문제풀이span"><span style="color:#D0E7D2">추가 문제풀이</span></h3> +<details> +<summary>문제 링크 모음(많이 김)</summary> +<!-- summary 아래 한칸 공백 두어야함 --> +<br> +프로그래머스 코딩테스트 문제 링크 (코스에 있는 문제여도 프로그래머스 코테 링크로 적음) +<ul> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/42576" target="_blank" rel="noopener" + >완주하지 못한 사람</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/12909" target="_blank" rel="noopener" + >올바른 괄호</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/49993" target="_blank" rel="noopener" + >스킬트리</a> +<br></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/12978" target="_blank" rel="noopener" + >배달</a> +<br></li> +<li>[세 소수의 합]</li> +<li>[주사위 게임]</li> +<li><a class="link" href="https://school.programmers.co.kr/app/courses/19071/curriculum/lessons/236812" target="_blank" rel="noopener" + >사탕 담기</a> +<br></li> +<li>[빙고]</li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/49994" target="_blank" rel="noopener" + >방문 길이</a></li> +<li>[쇠막대기]</li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/60059" target="_blank" rel="noopener" + >자물쇠와 열쇠</a> +<br></li> +<li>[게임 아이템] +<br></li> +<li><a class="link" href="https://school.programmers.co.kr/app/courses/19071/curriculum/lessons/236806" target="_blank" rel="noopener" + >기능개발</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/42626" target="_blank" rel="noopener" + >더 맵게</a></li> +<li>[배상 비용 최소화]</li> +<li>[문자열 압축 코드] +<br></li> +<li><a class="link" href="https://school.programmers.co.kr/app/courses/19071/curriculum/lessons/236811" target="_blank" rel="noopener" + >카펫</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/12982" target="_blank" rel="noopener" + >예산</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/12952" target="_blank" rel="noopener" + >N-Queen</a></li> +<li>[버스 여행] +<br></li> +<li><a class="link" href="https://school.programmers.co.kr/app/courses/19071/curriculum/lessons/236805" target="_blank" rel="noopener" + >예산_소팅</a></li> +<li><a class="link" href="https://school.programmers.co.kr/app/courses/19071/curriculum/lessons/236808" target="_blank" rel="noopener" + >최솟값 만들기</a></li> +<li><a class="link" href="https://school.programmers.co.kr/app/courses/19071/curriculum/lessons/236807" target="_blank" rel="noopener" + >가장 큰 수</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/42895" target="_blank" rel="noopener" + >N으로 표현</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/12900" target="_blank" rel="noopener" + >2 x n 타일링</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/42898" target="_blank" rel="noopener" + >등굣길</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/12904" target="_blank" rel="noopener" + >가장 긴 팰린드롬</a> +<br></li> +</ul> +</details> +<h2 id="span-stylecolorb0d9b1checkspan">👀 <strong><span style="color:#B0D9B1">CHECK</span></strong></h2> +<h6 id="어렵거나-새롭게-알게-된-것-등-다시-확인할-것들"><em>(어렵거나 새롭게 알게 된 것 등 다시 확인할 것들)</em></h6> +<h4 id="pep-8">PEP 8</h4> +<p>파이썬이 추구하는 코드 스타일. 들여쓰기, 공백, 변수명 작성 규칙 등이 포함된다.</p> +<ul> +<li><a class="link" href="https://peps.python.org/pep-0008/" target="_blank" rel="noopener" + >PEP 8 - Style Guide for Python Code(공식 문서)</a></li> +<li><a class="link" href="https://wayhome25.github.io/python/2017/05/04/pep8/" target="_blank" rel="noopener" + >PEP8 스타일 가이드를 설명하는 블로그(한국어)</a></li> +</ul> +<h4 id="tim-sort">Tim sort</h4> +<p>Insertion sort + Merge sort</p> +<ul> +<li>Insertion sort는 <code>n이 작을 때</code> (Quick sort보다도) 빠름</li> +<li>전체를 작은 덩어리로 잘라 Insertion sort -&gt; Merge</li> +<li><a class="link" href="https://d2.naver.com/helloworld/0315536" target="_blank" rel="noopener" + >Tim sort에 대해 설명하는 글</a></li> +</ul> +<h4 id="dp-익숙해지기">DP 익숙해지기</h4> +<ul> +<li>knapsack problem 등 문제풀이를 통해 익숙해지기</li> +</ul> +<h2 id="span-stylecolorb0d9b1느낀-점span">❗ <strong><span style="color:#B0D9B1">느낀 점</span></strong></h2> +<p>오늘은 DP(Dynamic Programming)과 DFS&amp;BFS의 개념에 대해 가볍게 배우고, 문제풀이를 위주로 강의가 진행되었다.</p> +<p>아는 알고리즘들이고 어제 강의의 문제가 나에겐 어렵지 않았기 때문에, 해설 강의를 듣기 전에 문제를 먼저 풀어 보았다. 문제를 풀다가 막히는 부분이 있으면 강의를 틀고, 해결되면 멈추고 다시 풀어보곤 했다.<br> +Heap 문제를 제외한 두 문제는 해설 없이 풀었고, Heap 문제도 heapq 라이브러리를 사용해야하는 것을 깨닫고는 금방 풀 수 있었다.</p> +<p>이번주 강의를 듣고 문제를 풀면서 느낀점이 몇개 있다.</p> +<ol> +<li> +<p>나는 알고리즘 자체는 꽤 잘 알고 활용도 잘 하는 편이지만 라이브러리 사용에 있어서 소극적인 면이 있다. 문제를 풀 때 파이썬 표준 라이브러리조차도 잘 import하지 않고 Dictionary나 Set정도만 사용하는 편이었다. <em>(Heap도 자체적으로 구현하거나 list를 사용하곤 했는데 왜 이런 습관이 들었는지는 잘 모르겠다.)</em> <br> +이번 강의를 들으면서 표준 라이브러리에 있는 여러 데이터형을 활용했고 다음에 문제를 풀 때도 적극적으로 활용하면서 더 효과적인 코드를 작성하는데 가까워지려고 한다.</p> +</li> +<li> +<p>나는 CS 용어를 잘 모른다. 아예 모른다는게 아니라, 많이 헷갈리며 정확한 명칭을 찾아보지 않았다는 의미이다. member method, list comprehension 등 용어들은 분명 내가 궁금해서 찾아봤지만 아직도 헷갈리거나 명칭 자체를 몰랐던 것들이다. 강의를 통해 명확해지거나 새롭게 알게 된 용어들이 있어서 좋았고, 이제부터는 모르는 부분에 대해 검색할 때는 아예 용어와 그 정의부터 찾는것부터 시작해야겠다고 다짐했다.</p> +</li> +</ol> +<p>내일은 강의가 없는 날이다. 하지만 해야 할 일들은 있다. 오늘까지 배운걸 복습하고, 배운 자료구조와 알고리즘을 활용하는 문제들을 lv3정도로 풀어 볼 것이다. 내일도 화이팅!!</p> + + + + Day 4 + https://srlee056.github.io/p/day-4/ + Thu, 19 Oct 2023 00:00:00 +0000 + + https://srlee056.github.io/p/day-4/ + <h1 id="span-stylecolor79ac78til---hash--greedy--sort-문제풀이-위주span"><strong><span style="color:#79AC78">TIL - Hash / Greedy &amp; Sort (문제풀이 위주)</span></strong></h1> +<h2 id="span-stylecolorb0d9b1공부-내용span">📋 <strong><span style="color:#B0D9B1">공부 내용</span></strong></h2> +<h3 id="span-stylecolord0e7d2hashspan"><span style="color:#D0E7D2">Hash</span></h3> +<ul> +<li> +<p>Hash?<br> +개념 정리가 필요하다고 느껴서 글을 따로 발행했다.</p> +<ul> +<li> +<p><a class="link" href="https://www.baeldung.com/cs/hash-tables" target="_blank" rel="noopener" + >Understanding Hash Table</a></p> +</li> +<li> +<p><a class="link" href="https://velog.io/@srlee056/Hash-Table-%EC%9D%B4%ED%95%B4%ED%95%98%EA%B8%B0" target="_blank" rel="noopener" + >(번역 및 정리)Hash Table 이해하기</a></p> +</li> +</ul> +</li> +<li> +<p><code>완주하지 못한 선수</code> 문제풀이</p> +<ul> +<li>python dictionary 를 활용하여 hasing 구현</li> +</ul> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">solution</span><span class="p">(</span><span class="n">participant</span><span class="p">,</span> <span class="n">completion</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">answer</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span> +</span></span><span class="line"><span class="cl"> <span class="n">pDict</span> <span class="o">=</span> <span class="p">{}</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># 참가자/ 완주자 정보가 주어질 때, 이름을 key로 활용하여 dictionary 형태에 넣고 빼는 방식으로</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># (동명이인이 있을 때에도) 어떤 이름을 가진 사람이 완주를 하지 못했는지 확인할 수 있다. </span> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">participant</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">pDict</span><span class="p">[</span><span class="n">p</span><span class="p">]</span> <span class="o">=</span> <span class="n">pDict</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> <span class="o">+</span> <span class="mi">1</span> <span class="c1">#.get()을 통해 default 값을 세팅하는 한 방법</span> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">completion</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">pDict</span><span class="p">[</span><span class="n">p</span><span class="p">]</span> <span class="o">-=</span> <span class="mi">1</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="n">incompletion</span> <span class="o">=</span> <span class="p">[</span><span class="n">k</span> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">pDict</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> <span class="k">if</span> <span class="n">v</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">]</span> +</span></span><span class="line"><span class="cl"> <span class="n">answer</span> <span class="o">=</span> <span class="n">incompletion</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">answer</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +</ul> +<h3 id="span-stylecolord0e7d2greedy-algorithmspan"><span style="color:#D0E7D2">Greedy Algorithm</span></h3> +<ul> +<li> +<p>탐욕법(greedy algorithm)</p> +<ul> +<li>알고리즘의 각 단계에서 <strong>그 순간의 최적의 선택</strong>을 함</li> +<li>탐욕법으로 최적해를 찾을 수 있는 문제<br> += 현재 선택이 마지막 답의 최적성을 해치지 않는 문제</li> +</ul> +</li> +<li> +<p><code>체육복</code> 문제풀이</p> +<ul> +<li>비슷해보이는 조건문이라해도 그 순서에 따라 전혀 다른 결과가 나올 수 있음</li> +<li>작은 번호부터 큰 번호로 순회하기 때문에, 작은 번호가 조건을 만족하는지 먼저 고려함</li> +</ul> +</li> +<li> +<p><code>큰 수 만들기</code> 문제풀이</p> +<ul> +<li>매 단계마다 작은 숫자를 지우는 탐욕법을 사용하며, 이 방식은 마지막에 최적성을 충족하게 됨</li> +</ul> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span><span class="lnt">14 +</span><span class="lnt">15 +</span><span class="lnt">16 +</span><span class="lnt">17 +</span><span class="lnt">18 +</span><span class="lnt">19 +</span><span class="lnt">20 +</span><span class="lnt">21 +</span><span class="lnt">22 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">solution</span><span class="p">(</span><span class="n">number</span><span class="p">,</span> <span class="n">k</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">collected</span> <span class="o">=</span> <span class="p">[]</span> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">num</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">number</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># collected에 미리 들어간 원소가 있을 것</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># 제일 마지막으로 들어간 원소는 현재 num 값보다 작을 것</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># (제거해야 하는 숫자의 개수) k가 0보다 클 것</span> +</span></span><span class="line"><span class="cl"> <span class="k">while</span> <span class="nb">len</span><span class="p">(</span><span class="n">collected</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="ow">and</span> <span class="n">collected</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">&lt;</span> <span class="n">num</span> <span class="ow">and</span> <span class="n">k</span> <span class="o">&gt;</span><span class="mi">0</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">collected</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> +</span></span><span class="line"><span class="cl"> <span class="n">k</span> <span class="o">-=</span><span class="mi">1</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">k</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">collected</span> <span class="o">+=</span> <span class="nb">list</span><span class="p">(</span><span class="n">number</span><span class="p">[</span><span class="n">i</span><span class="p">:])</span> +</span></span><span class="line"><span class="cl"> <span class="k">break</span> +</span></span><span class="line"><span class="cl"> <span class="n">collected</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">num</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="c1"># 제거해야 하는 숫자의 개수가 남아있을 때 </span> +</span></span><span class="line"><span class="cl"> <span class="c1"># (코드가 너무 직관적이고 예뻤다. :&gt;)</span> +</span></span><span class="line"><span class="cl"> <span class="n">collected</span> <span class="o">=</span> <span class="n">collected</span><span class="p">[:</span><span class="o">-</span><span class="n">k</span><span class="p">]</span> <span class="k">if</span> <span class="n">k</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="k">else</span> <span class="n">collected</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="n">answer</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">collected</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">answer</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +</ul> +<h3 id="span-stylecolord0e7d2sortspan"><span style="color:#D0E7D2">Sort</span></h3> +<ul> +<li><code>가장 큰 수</code> 문제풀이 +<ul> +<li>자릿수가 다른 숫자들을 문자열처럼 나열하여 더 큰 숫자를 만들 때, 숫자들의 우선순위를 정하는 방법은?</li> +</ul> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span><span class="lnt">5 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">sortedNumbers</span> <span class="o">=</span> <span class="nb">sorted</span><span class="p">(</span><span class="nb">map</span><span class="p">(</span><span class="nb">str</span><span class="p">,</span> <span class="n">numbers</span><span class="p">),</span> <span class="n">key</span> <span class="o">=</span> <span class="k">lambda</span> <span class="n">x</span> <span class="p">:</span> <span class="p">(</span><span class="n">x</span> <span class="o">*</span> <span class="mi">4</span><span class="p">)[:</span><span class="mi">4</span><span class="p">],</span> <span class="n">reverse</span> <span class="o">=</span> <span class="kc">True</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"><span class="c1"># map(str, numbers) : numbers 정수 리스트를 문자열 리스트로 변환</span> +</span></span><span class="line"><span class="cl"><span class="c1"># sorted(..., reverse = True) : 주어진 조건으로 정렬하며, 내림차순으로 반환</span> +</span></span><span class="line"><span class="cl"><span class="c1"># lambda x : (x*4)[:4] : 네 자리 수까지 주어지므로 4번 반복 후 네번째자리까지 끊음</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +</ul> +<h2 id="span-stylecolorb0d9b1checkspan">👀 <strong><span style="color:#B0D9B1">CHECK</span></strong></h2> +<h6 id="어렵거나-새롭게-알게-된-것-등-다시-확인할-것들"><em>(어렵거나 새롭게 알게 된 것 등 다시 확인할 것들)</em></h6> +<ul> +<li> +<p>Hash</p> +<ul> +<li>가볍게 정리했지만 더 자세하게 찾아보고 싶음 (활용되는 곳, 특성을 구현하는 법, hashing function, collision 등)</li> +</ul> +</li> +<li> +<p>list comprehension</p> +<ul> +<li>한 줄에 반복문 할당 배열생성 등이 한번에 일어남</li> +<li><a class="link" href="https://shoark7.github.io/programming/python/about-list-comprehension-python" target="_blank" rel="noopener" + >list comprehension 설명 블로그 글</a></li> +<li>쓸 줄 아는 방식이지만 용어를 처음 알게 됨 (예전에 배우고 까먹은 게 분명)</li> +</ul> +</li> +<li> +<p>list slicing 에 바로 대입하여 직관적으로 코드 작성 가능</p> +<ul> +<li>EX) list[1:3] = [1, 2]</li> +</ul> +</li> +</ul> +<h2 id="span-stylecolorb0d9b1느낀-점span">❗ <strong><span style="color:#B0D9B1">느낀 점</span></strong></h2> +<p>어제 더 나은 코드를 위해 어떤점을 고려해야하는지 많은 고민을 했는데, 오늘 강의에서 그 부분을 짚어줘서 좋았다.</p> +<p>오늘은 각 알고리즘이나 자료구조에 대한 설명보다는 문제 풀이와 해설을 위주로 강의가 진행되었는데, 그래서 나 스스로 그 개념에 대해 찾아보고 정리하는 시간이 필요했다. greedy나 sort는 이미 잘 알고 있는 부분이지만 hash는 헷갈리는 부분이 있어서 블로그와 document를 읽어보면서 글로 정리하는 시간을 가졌다.</p> +<p>깊이가 정해져있지 않다 보니 원하는 만큼 궁금해하고 파헤칠 수 있었지만, 내가 그 내용을 받아들이고 정리할 수 있는가는 별개의 문제임을 깨달았다. hash를 설명하는 블로그 글에 연결된 링크를 타고 여러 글을 읽어가다 보니, 어느새 encoding&amp;decoding, scheduling에 대한 글을 읽고 있었다. 이런 글들을 읽고 어느정도 이해할 수는 있었지만, 글로 정리하거나 그 사이의 관계를 명확하게 아는것은 큰 차이가 있었고, 머리속이 혼란스러웠다. 어떤 주제와 관련된 내용을 잘 찾고 정리하는것도 많은 노력이 필요하다는 걸 새삼 느끼는 순간이었다.</p> +<p>오늘처럼 깊이가 없는 공부를 해야하는 순간은 계속 있을것이고(있어왔고), 정해진 주제에 대해 찾아본 내용들을 글로 정리하면서 나만의 기준을 정립해야겠다는 결론을 내렸다.</p> +<p>+) 퇴고하기 위해 글을 읽어보는데 두서없고 추상적이라 맘에 들지 않음..(ㅠㅠ) 문장력을 키우고 싶은데 온라인으로도 필사할 수 있는지 찾아봐야겠다.</p> + + + + Day 3 + https://srlee056.github.io/p/day-3/ + Wed, 18 Oct 2023 00:00:00 +0000 + + https://srlee056.github.io/p/day-3/ + <h1 id="span-stylecolor79ac78til---queue-tree--heapspan"><strong><span style="color:#79AC78">TIL - Queue, Tree &amp; Heap</span></strong></h1> +<h2 id="span-stylecolorb0d9b1공부-내용span">📋 <strong><span style="color:#B0D9B1">공부 내용</span></strong></h2> +<h3 id="span-stylecolord0e7d2queuesspan"><span style="color:#D0E7D2">Queues</span></h3> +<ul> +<li> +<p>Queue?</p> +<ul> +<li>FIFO (First In First Out)</li> +<li>operations +<ul> +<li>enqueue</li> +<li>dequeue +<ul> +<li>선형 배열으로 구현: <code>O(n)</code> -&gt; 연결 리스트로 구현하는것이 더 좋음</li> +</ul> +</li> +</ul> +</li> +</ul> +</li> +<li> +<p>Circular Queues</p> +<ul> +<li>배열의 한쪽 끝과 다른쪽 끝이 닿아 있는 모습</li> +<li>원소의 개수가 정해져있음</li> +<li><code>front / rear 포인터</code>를 기억하고, dequeue된 원소 저장소는 재활용</li> +<li>선형 배열으로 구현하는것이 더 좋음</li> +</ul> +</li> +<li> +<p>Priority Queues</p> +<ul> +<li>원소들 사이의 우선순위를 따름</li> +<li>우선순위 구현 +<ul> +<li>원소를 넣을 때 enqueue vs. 원소를 꺼낼 때 dequeue +<ul> +<li>넣을 때(enqueue) 우선순위에 따라 정렬하는것이 조금 더 나은 Time Complexity를 가짐</li> +<li>데이터를 관리하고 활용하는 데에도 더 편리함</li> +</ul> +</li> +</ul> +</li> +</ul> +</li> +</ul> +<h3 id="span-stylecolord0e7d2treesspan"><span style="color:#D0E7D2">Trees</span></h3> +<ul> +<li> +<p><strong>Tree?</strong></p> +<ul> +<li>구성 +<ul> +<li>root node</li> +<li>interner nodes</li> +<li>leaf nodes</li> +</ul> +</li> +<li>특성 +<ul> +<li>parent node / child node</li> +<li>노드의 수준 (level) : root node로부터 거리</li> +<li>노드의 차수 (degree) : 노드의 자식 수</li> +<li>트리의 높이(height) 또는 깊이(depth) : 제일 큰 level + 1</li> +<li>subtree</li> +</ul> +</li> +</ul> +</li> +<li> +<p><strong>Binary Trees</strong></p> +<ul> +<li>모든 node의 degree &lt;= 2</li> +<li>operations +<ul> +<li>size()</li> +<li>depth()</li> +<li>순회 traversal +<ul> +<li>Depth First Traversal : 재귀 호출을 통해 구현 +<ul> +<li>inorder</li> +<li>preorder</li> +<li>postorder</li> +</ul> +</li> +<li>Breadth Tirst Traversal : queue 사용! +<ul> +<li>level이 낮은 노드를 우선으로 방문</li> +<li>같은 level인 경우 부모 노드의 순서를 따름</li> +</ul> +</li> +</ul> +</li> +</ul> +</li> +<li>포화 이진 트리 (full binary trees) +<ul> +<li>모든 node의 degree == 2</li> +</ul> +</li> +<li>완전 이진 트리 (complete binary trees) +<ul> +<li>(depth k) <code>level k-2</code>까지는 full binary tree, <code>level k-1</code>은 왼쪽부터 node 채워짐</li> +</ul> +</li> +</ul> +</li> +<li> +<p><strong>Binary Search Trees</strong></p> +<ul> +<li>모든 노드에 대해 다음 성질을 만족하는 Binary Tree +<ul> +<li>왼쪽 subtree&rsquo;s data &lt; 현재 node&rsquo;s data &lt; 오른쪽 subtree&rsquo;s data</li> +</ul> +</li> +<li>장단점 +<ul> +<li>장점 : 원소의 추가, 삭제가 편함</li> +<li>단점 : 큰 공간을 소요함 (연결 리스트로 구현)</li> +</ul> +</li> +<li>operations +<ul> +<li>insert()</li> +<li>remove()</li> +<li>lookup()</li> +<li>inorder()</li> +<li>min(), max()</li> +</ul> +</li> +</ul> +</li> +</ul> +<h3 id="span-stylecolord0e7d2heapspan"><span style="color:#D0E7D2">Heap</span></h3> +<ul> +<li>Heaps? +<ul> +<li> +<p>Binary Tree의 한 종류 (binary heap)</p> +</li> +<li> +<p>Min / Max heap</p> +<ul> +<li>root node가 항상 최소/최대 값을 가진다</li> +<li>complete binary tree +<ul> +<li><code>n</code> nodes -&gt; depth <code>log(n)+1</code></li> +<li>insert / remove operation의 Time Complexity : <code>O(log(n))</code></li> +</ul> +</li> +<li>subtree 또한 Min / Max heap</li> +</ul> +</li> +<li> +<p>Binary Seacrh Tree vs. Heap?</p> +<table> +<thead> +<tr> +<th></th> +<th>BST</th> +<th>Heap</th> +</tr> +</thead> +<tbody> +<tr> +<td>데이터 정렬</td> +<td>크기순서대로 완전 정렬</td> +<td>완전 정렬 X</td> +</tr> +<tr> +<td>데이터 검색</td> +<td>O</td> +<td>X</td> +</tr> +<tr> +<td>완전 이진 트리</td> +<td>X</td> +<td>O</td> +</tr> +<tr> +<td>연산 시간</td> +<td>(최악의 경우) O(n)</td> +<td>O(log(n))</td> +</tr> +<tr> +<td>선형 배열로 구현</td> +<td>X</td> +<td>O</td> +</tr> +</tbody> +</table> +</li> +<li> +<p>operations</p> +<ul> +<li>insert()</li> +<li>remove()</li> +</ul> +</li> +</ul> +</li> +</ul> +<h2 id="span-stylecolorb0d9b1checkspan">👀 <strong><span style="color:#B0D9B1">CHECK</span></strong></h2> +<h6 id="어렵거나-새롭게-알게-된-것-등-다시-확인할-것들"><em>(어렵거나 새롭게 알게 된 것 등 다시 확인할 것들)</em></h6> +<ul> +<li><strong>노드의 차수(degree) : # of children</strong> +<ul> +<li>binary tree : 모든 노드의 degree가 항상 2이하</li> +<li>leaf nodes : degree 0</li> +</ul> +</li> +<li><strong>단축 평가</strong> +<ul> +<li><a class="link" href="https://pydole.tistory.com/entry/Python-%EB%8B%A8%EC%B6%95%ED%8F%89%EA%B0%80short-circuit-evalution" target="_blank" rel="noopener" + >단축평가에 대해 참고한 블로그</a></li> +<li>2개 이상의 논리 조건식이 있을 경우에, <strong>앞 조건이 계산한 값에 의해 결과가 확실해지면 두번째 조건은 확인하지 않음</strong></li> +<li>False and (), True or () 인 경우 등이 해당됨</li> +</ul> +</li> +</ul> +<h2 id="span-stylecolorb0d9b1느낀-점span">❗ <strong><span style="color:#B0D9B1">느낀 점</span></strong></h2> +<p>어제의 교훈이 있어서 그런지, 오늘은 프로그래밍 과정에 실수가 적었다. +그리고, 자료구조를 구현하는 과정에서 더 나은 방식에 대해 고민하는 상황이 많아졌다.</p> +<p>오늘 주로 고민한 부분은</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span><span class="lnt">5 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-fallback" data-lang="fallback"><span class="line"><span class="cl">코드를 더 직관적으로 적고싶음 +</span></span><span class="line"><span class="cl">- 반복되는 같은 코드를 합칠 수 있는가? +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl">같은 코드 다른 효율? +</span></span><span class="line"><span class="cl">- 같은 기능을 하지만 살짝 다른 두 코드 중 더 나은것은? +</span></span></code></pre></td></tr></table> +</div> +</div><p>정도였다.</p> +<p>전자는 내가 평소 프로그래밍 할 때 자주 하긴 하는데, 항상 고민하는 부분이다. +반복되는 기능을 함수로 빼던가, 적용되는 변수를 리스트로 묶어서 반복하는 등의 방법을 쓰는데, 다른 방법은 뭐가 있을까 고민하고 있다.</p> +<p>후자는 Complexity를 구하는 방법에 대한 의문이 아니다. 실제로 이 operation이 어떻게 구현되고 있는지, 왜 그렇게 구현되었는지가 궁금한 것이다. <br> +실습 문제에서 우선순위 queue를 구현할 때, skeleton code의 dequeue 함수는 마지막 elements를 가져오는 방식으로 되어있었다.(<code>getAt(data.size())</code>) <br> +나는 처음 element를 가져오는 방식으로 생각하고(<code>getAt(1)</code>) 이에 해당하는 enqueue 함수를 작성했기 때문에 잠깐 막혔다가, 결국은 눈치채고 해결했다.<br> +그 코드를 보면서 이렇게 구현하는게 더 나은건지 궁금증이 들었고, 같은 기능을 하지만 결함이 적은(?) 코드를 작성하자는 생각이 들었다.</p> +<p>오늘은 추가 알고리즘 문제들이 있고 아직 풀지 않았는데, 쉬운 문제들이지만 이 두가지를 생각하면서 풀려고 노력해야겠다.</p> + + + + Day 2 + https://srlee056.github.io/p/day-2/ + Tue, 17 Oct 2023 00:00:00 +0000 + + https://srlee056.github.io/p/day-2/ + <h1 id="span-stylecolor79ac78til---linkedlist--stackspan"><strong><span style="color:#79AC78">TIL - LinkedList &amp; Stack</span></strong></h1> +<h2 id="span-stylecolorb0d9b1공부-내용span">📋 <strong><span style="color:#B0D9B1">공부 내용</span></strong></h2> +<h3 id="span-stylecolord0e7d2연결-리스트-linked-listspan"><span style="color:#D0E7D2">연결 리스트 Linked List</span></h3> +<ul> +<li> +<p><strong>추상적 자료구조 Abstract Data Structures</strong></p> +<ul> +<li>내부 구현에는 신경쓸 필요 없는 구조</li> +<li>data &amp; a set of operations</li> +<li>이 두 가지를 <strong>추상적으로 보여줌</strong></li> +</ul> +</li> +<li> +<p><strong>Linke List?</strong></p> +<ul> +<li>Node가 선형적으로 연결된 구조</li> +</ul> +</li> +<li> +<p><strong>Node &amp; LinkedList 구현</strong></p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"> <span class="k">class</span> <span class="nc">Node</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">item</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="o">=</span> <span class="n">item</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">next</span> <span class="o">=</span> <span class="kc">None</span> <span class="c1"># 다음 노드를 가리킴</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">class</span> <span class="nc">LinkedList</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span> <span class="o">=</span> <span class="mi">0</span> <span class="c1"># 노드의 총 갯수</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">head</span> <span class="o">=</span> <span class="kc">None</span> <span class="c1"># 첫번째 노드</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">tail</span> <span class="o">=</span> <span class="kc">None</span> <span class="c1"># 마지막 노드</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li> +<p><strong>Linked List 연산 (operations)</strong></p> +<p>linked list의 index는 1부터 시작 / 0은 다른 용도로 사용(Dummy node)</p> +<h6 id="실습으로-구현한-코드만-첨부했음">(실습으로 구현한 코드만 첨부했음)</h6> +<ul> +<li> +<p>kth element 참조</p> +</li> +<li> +<p>리스트 순회</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span><span class="lnt">5 +</span><span class="lnt">6 +</span><span class="lnt">7 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"> <span class="k">def</span> <span class="nf">traverse</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">curr</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">head</span> +</span></span><span class="line"><span class="cl"> <span class="n">returnList</span> <span class="o">=</span> <span class="p">[]</span> +</span></span><span class="line"><span class="cl"> <span class="k">while</span> <span class="n">curr</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">returnList</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">curr</span><span class="o">.</span><span class="n">data</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="n">curr</span> <span class="o">=</span> <span class="n">curr</span><span class="o">.</span><span class="n">next</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">returnList</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li> +<p>길이 얻기</p> +</li> +<li> +<p>원소 삽입</p> +<ul> +<li>Time complexity +<ul> +<li>맨 앞에 삽입 : O(1)</li> +<li>중간에 삽입 : O(n)</li> +<li>맨 끝에 삽입 : (Tail pointer가 있기 때문에) O(1)</li> +</ul> +</li> +</ul> +</li> +<li> +<p>원소 삭제</p> +<ul> +<li>Time complexity +<ul> +<li>맨 앞에 삽입 : O(1)</li> +<li>중간에 삽입 : O(n)</li> +<li>맨 끝에 삽입 : O(n) +→ 이 상황을 피하기 위해 이중 연결 리스트를 사용</li> +</ul> +</li> +</ul> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span><span class="lnt">14 +</span><span class="lnt">15 +</span><span class="lnt">16 +</span><span class="lnt">17 +</span><span class="lnt">18 +</span><span class="lnt">19 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"> <span class="c1"># 삭제한 node 데이터를 반환</span> +</span></span><span class="line"><span class="cl"> <span class="k">def</span> <span class="nf">popAt</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">pos</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">pos</span> <span class="o">&lt;</span> <span class="mi">1</span> <span class="ow">or</span> <span class="n">pos</span> <span class="o">&gt;</span> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="k">raise</span> <span class="ne">IndexError</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">pos</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span> <span class="o">=</span> <span class="kc">None</span> +</span></span><span class="line"><span class="cl"> <span class="n">curr</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">head</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">head</span> <span class="o">=</span> <span class="n">curr</span><span class="o">.</span><span class="n">next</span> +</span></span><span class="line"><span class="cl"> <span class="k">else</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">getAt</span><span class="p">(</span><span class="n">pos</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="n">curr</span> <span class="o">=</span> <span class="n">prev</span><span class="o">.</span><span class="n">next</span> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span><span class="o">.</span><span class="n">next</span> <span class="o">=</span> <span class="n">curr</span><span class="o">.</span><span class="n">next</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">pos</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">tail</span> <span class="o">=</span> <span class="n">prev</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span> <span class="o">-=</span> <span class="mi">1</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">curr</span><span class="o">.</span><span class="n">data</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li> +<p>두 리스트 합치기 concat</p> +</li> +</ul> +</li> +<li> +<p><strong>배열 Array vs 연결 리스트 Linked List</strong></p> +<table> +<thead> +<tr> +<th></th> +<th>배열</th> +<th>연결 리스트</th> +</tr> +</thead> +<tbody> +<tr> +<td>저장 공간</td> +<td>연속된 위치</td> +<td>임의의 위치</td> +</tr> +<tr> +<td>특정 원소 참조</td> +<td>매우 간편</td> +<td>선형탐색과 유사</td> +</tr> +<tr> +<td></td> +<td>O(1)</td> +<td>O(n)</td> +</tr> +</tbody> +</table> +<p><em>time complexity에 불리함이 있는데도 사용하는 이유는?</em></p> +</li> +<li> +<p><strong>연결 리스트 Linked List의 힘</strong></p> +<ul> +<li>유연한 삽입 및 삭제</li> +<li>Head, Tail에 dummy node를 추가하여 간편하고 직관적인 설계 가능</li> +<li>추가 구현 operations +<ul> +<li> +<p>insertAfter(prev, node)</p> +</li> +<li> +<p>popAfter(prev) &amp; popAt(pos)</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span><span class="lnt">14 +</span><span class="lnt">15 +</span><span class="lnt">16 +</span><span class="lnt">17 +</span><span class="lnt">18 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">popAfter</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">prev</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">curr</span> <span class="o">=</span> <span class="n">prev</span><span class="o">.</span><span class="n">next</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">curr</span> <span class="ow">is</span> <span class="kc">None</span> <span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="kc">None</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">curr</span><span class="o">.</span><span class="n">next</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">tail</span> <span class="o">=</span> <span class="n">prev</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span><span class="o">.</span><span class="n">next</span> <span class="o">=</span> <span class="n">curr</span><span class="o">.</span><span class="n">next</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span> <span class="o">-=</span> <span class="mi">1</span> <span class="c1"># nodeCount 꼭 체크하기</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">curr</span><span class="o">.</span><span class="n">data</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">popAt</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">pos</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">pos</span> <span class="o">&lt;</span> <span class="mi">1</span> <span class="ow">or</span> <span class="n">pos</span> <span class="o">&gt;</span> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="k">raise</span> <span class="ne">IndexError</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">getAt</span><span class="p">(</span><span class="n">pos</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">popAfter</span><span class="p">(</span><span class="n">prev</span><span class="p">)</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +</ul> +</li> +</ul> +</li> +</ul> +<hr> +<h3 id="span-stylecolord0e7d2양방향--이중-연결-리스트-double-linked-listspan"><span style="color:#D0E7D2">양방향 / 이중 연결 리스트 Double Linked List</span></h3> +<ul> +<li><strong>양쪽</strong>으로 연결된 link +- next node, previous node로 두 방향 모두 진행 가능 +- 메모리 사용량이 늘어나지만, 앞에서뿐만 아니라 뒤에서도 데이터를 찾아갈 수 있다는게 장점 +<ul> +<li>getAt() 함수 또한 pos가 중간값 이상일 때는 뒤에서부터 찾도록 구현할 수 있음</li> +</ul> +</li> +<li><strong>operations</strong> +<ul> +<li> +<p>reverse</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span><span class="lnt">5 +</span><span class="lnt">6 +</span><span class="lnt">7 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">reverse</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">result</span> <span class="o">=</span> <span class="p">[]</span> +</span></span><span class="line"><span class="cl"> <span class="n">curr</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">tail</span> +</span></span><span class="line"><span class="cl"> <span class="k">while</span> <span class="n">curr</span><span class="o">.</span><span class="n">prev</span><span class="o">.</span><span class="n">prev</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">curr</span> <span class="o">=</span> <span class="n">curr</span><span class="o">.</span><span class="n">prev</span> +</span></span><span class="line"><span class="cl"> <span class="n">result</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">curr</span><span class="o">.</span><span class="n">data</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">result</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li> +<p>insertBefore</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span><span class="lnt">5 +</span><span class="lnt">6 +</span><span class="lnt">7 +</span><span class="lnt">8 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">insertBefore</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">next</span><span class="p">,</span> <span class="n">newNode</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span> <span class="o">=</span> <span class="nb">next</span><span class="o">.</span><span class="n">prev</span> +</span></span><span class="line"><span class="cl"> <span class="n">newNode</span><span class="o">.</span><span class="n">next</span> <span class="o">=</span> <span class="nb">next</span> +</span></span><span class="line"><span class="cl"> <span class="n">newNode</span><span class="o">.</span><span class="n">prev</span> <span class="o">=</span> <span class="n">prev</span> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span><span class="o">.</span><span class="n">next</span> <span class="o">=</span> <span class="n">newNode</span> +</span></span><span class="line"><span class="cl"> <span class="nb">next</span><span class="o">.</span><span class="n">prev</span> <span class="o">=</span> <span class="n">newNode</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span> <span class="o">+=</span> <span class="mi">1</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="kc">True</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li> +<p>popAfter, popBefore, popAt</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span><span class="lnt">14 +</span><span class="lnt">15 +</span><span class="lnt">16 +</span><span class="lnt">17 +</span><span class="lnt">18 +</span><span class="lnt">19 +</span><span class="lnt">20 +</span><span class="lnt">21 +</span><span class="lnt">22 +</span><span class="lnt">23 +</span><span class="lnt">24 +</span><span class="lnt">25 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">popAfter</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">prev</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">curr</span> <span class="o">=</span> <span class="n">prev</span><span class="o">.</span><span class="n">next</span> +</span></span><span class="line"><span class="cl"> <span class="nb">next</span> <span class="o">=</span> <span class="n">curr</span><span class="o">.</span><span class="n">next</span> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span><span class="o">.</span><span class="n">next</span> <span class="o">=</span> <span class="nb">next</span> +</span></span><span class="line"><span class="cl"> <span class="nb">next</span><span class="o">.</span><span class="n">prev</span> <span class="o">=</span> <span class="n">prev</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span> <span class="o">-=</span> <span class="mi">1</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">curr</span><span class="o">.</span><span class="n">data</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">popBefore</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">next</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">curr</span> <span class="o">=</span> <span class="nb">next</span><span class="o">.</span><span class="n">prev</span> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span> <span class="o">=</span> <span class="n">curr</span><span class="o">.</span><span class="n">prev</span> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span><span class="o">.</span><span class="n">next</span> <span class="o">=</span> <span class="nb">next</span> +</span></span><span class="line"><span class="cl"> <span class="nb">next</span><span class="o">.</span><span class="n">prev</span> <span class="o">=</span> <span class="n">prev</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span> <span class="o">-=</span> <span class="mi">1</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">curr</span><span class="o">.</span><span class="n">data</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">popAt</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">pos</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">pos</span> <span class="o">&lt;</span> <span class="mi">1</span> <span class="ow">or</span> <span class="n">pos</span> <span class="o">&gt;</span> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="k">raise</span> <span class="ne">IndexError</span> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">getAt</span><span class="p">(</span><span class="n">pos</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">popAfter</span><span class="p">(</span><span class="n">prev</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="c1"># next = self.getAt(pos+1) # getAt 함수가 pos == nodeCount+1 일 때 지원을 하지 않아서 사용은 어려움</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># next = self.getAt(pos).next #로 사용 가능</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># return self.popBefore(next)</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li> +<p>concat(self, L)</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span><span class="lnt">5 +</span><span class="lnt">6 +</span><span class="lnt">7 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">concat</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">L</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">lastNode</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">tail</span><span class="o">.</span><span class="n">prev</span> +</span></span><span class="line"><span class="cl"> <span class="n">firstNode</span> <span class="o">=</span> <span class="n">L</span><span class="o">.</span><span class="n">head</span><span class="o">.</span><span class="n">next</span> +</span></span><span class="line"><span class="cl"> <span class="n">lastNode</span><span class="o">.</span><span class="n">next</span> <span class="o">=</span> <span class="n">firstNode</span> +</span></span><span class="line"><span class="cl"> <span class="n">firstNode</span><span class="o">.</span><span class="n">prev</span> <span class="o">=</span> <span class="n">lastNode</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">tail</span> <span class="o">=</span> <span class="n">L</span><span class="o">.</span><span class="n">tail</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span> <span class="o">+=</span> <span class="n">L</span><span class="o">.</span><span class="n">nodeCount</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +</ul> +</li> +</ul> +<hr> +<h3 id="span-stylecolord0e7d2스택-stackspan"><span style="color:#D0E7D2">스택 Stack</span></h3> +<ul> +<li><strong>data element를 보관할 수 있는 선형 구조 / LIFO</strong></li> +<li><strong>operations</strong> +<ul> +<li>size()</li> +<li>isEmpty()</li> +<li>push(x) +<ul> +<li>꽉 찬 스택에 push(x)로 원소를 더 추가하려고 할 때 <code>stack overflow</code> 발생</li> +</ul> +</li> +<li>pop() +<ul> +<li>비어있는 스택에서 pop()으로 없는 원소를 꺼내려 할 때 <code>stack underflow</code> 발생</li> +</ul> +</li> +<li>peek() +<ul> +<li>데이터 참조, 제거하지는 않음</li> +</ul> +</li> +</ul> +</li> +<li><strong>추상적 자료구조로 구현</strong> +<ul> +<li>Array 또는 LinkedList 이용</li> +<li>만들어져있는 Stack library 를 import 할 수도 있음 +<code>from pythonds.basic.stack import Stack</code></li> +</ul> +</li> +</ul> +<hr> +<ul> +<li> +<p><strong>스택의 응용 1) 후위 표기법으로 변환</strong></p> +<ul> +<li>중위 표기법 (infix notation) : (A+B) * (C+D) +→ 후위 표기법 (postfix notation) : AB+CD+*</li> +<li>알고리즘 설계 +<ul> +<li> +<p>operator 연산자를 스택에 넣는 방식</p> +</li> +<li> +<p>연산자 우선순위 설정</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">prec</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;*&#39;</span><span class="p">:</span><span class="mi">3</span><span class="p">,</span> <span class="s1">&#39;/&#39;</span><span class="p">:</span><span class="mi">3</span><span class="p">,</span> <span class="s1">&#39;+&#39;</span><span class="p">:</span><span class="mi">2</span><span class="p">,</span> <span class="s1">&#39;-&#39;</span><span class="p">:</span><span class="mi">2</span><span class="p">,</span> <span class="s1">&#39;(&#39;</span><span class="p">:</span><span class="mi">1</span><span class="p">}</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li> +<p>구현 코드</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span><span class="lnt">14 +</span><span class="lnt">15 +</span><span class="lnt">16 +</span><span class="lnt">17 +</span><span class="lnt">18 +</span><span class="lnt">19 +</span><span class="lnt">20 +</span><span class="lnt">21 +</span><span class="lnt">22 +</span><span class="lnt">23 +</span><span class="lnt">24 +</span><span class="lnt">25 +</span><span class="lnt">26 +</span><span class="lnt">27 +</span><span class="lnt">28 +</span><span class="lnt">29 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">solution</span><span class="p">(</span><span class="n">S</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">opStack</span> <span class="o">=</span> <span class="n">ArrayStack</span><span class="p">()</span> +</span></span><span class="line"><span class="cl"> <span class="n">charList</span> <span class="o">=</span> <span class="p">[]</span> <span class="c1"># 수식을 리스트 형태로 저장한 후 .join을 통해 문자열로 변환</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">s</span> <span class="ow">in</span> <span class="n">S</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">s</span> <span class="ow">in</span> <span class="n">prec</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span> <span class="c1"># 연산자 + 여는 괄호</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">s</span> <span class="o">==</span> <span class="s2">&#34;(&#34;</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">opStack</span><span class="o">.</span><span class="n">push</span><span class="p">(</span><span class="n">s</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="k">else</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="k">while</span> <span class="ow">not</span> <span class="n">opStack</span><span class="o">.</span><span class="n">isEmpty</span><span class="p">():</span> <span class="c1"># 스택이 비어있는 동안 계속</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">prec</span><span class="p">[</span><span class="n">opStack</span><span class="o">.</span><span class="n">peek</span><span class="p">()]</span> <span class="o">&gt;=</span> <span class="n">prec</span><span class="p">[</span><span class="n">s</span><span class="p">]:</span> <span class="c1"># 스택 맨 위의 우선순위가 높거나 같은 경우에만</span> +</span></span><span class="line"><span class="cl"> <span class="n">charList</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">opStack</span><span class="o">.</span><span class="n">pop</span><span class="p">())</span> <span class="c1"># pop()하여 문자열에 출력</span> +</span></span><span class="line"><span class="cl"> <span class="k">else</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="k">break</span> +</span></span><span class="line"><span class="cl"> <span class="n">opStack</span><span class="o">.</span><span class="n">push</span><span class="p">(</span><span class="n">s</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">elif</span> <span class="n">s</span> <span class="o">==</span> <span class="s2">&#34;)&#34;</span><span class="p">:</span> <span class="c1"># 닫는 괄호</span> +</span></span><span class="line"><span class="cl"> <span class="k">while</span> <span class="n">opStack</span><span class="o">.</span><span class="n">peek</span><span class="p">()</span> <span class="o">!=</span> <span class="s2">&#34;(&#34;</span><span class="p">:</span> <span class="c1"># 여는 괄호가 나올때까지 모든 연산자를 꺼내 출력</span> +</span></span><span class="line"><span class="cl"> <span class="n">charList</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">opStack</span><span class="o">.</span><span class="n">pop</span><span class="p">())</span> +</span></span><span class="line"><span class="cl"> <span class="n">opStack</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> <span class="c1"># pop &#39;(&#39;</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">else</span><span class="p">:</span> <span class="c1"># 피연산자</span> +</span></span><span class="line"><span class="cl"> <span class="n">charList</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">s</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">while</span> <span class="ow">not</span> <span class="n">opStack</span><span class="o">.</span><span class="n">isEmpty</span><span class="p">():</span> <span class="c1"># 스택에 남아있는 연산자들을 모두 출력</span> +</span></span><span class="line"><span class="cl"> <span class="n">charList</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">opStack</span><span class="o">.</span><span class="n">pop</span><span class="p">())</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="n">answer</span> <span class="o">=</span> <span class="s2">&#34;&#34;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">charList</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">answer</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +</ul> +</li> +</ul> +</li> +<li> +<p><strong>스택의 응용 2) 후위 표기법 계산</strong></p> +<ul> +<li>앞에서부터 뒤로 읽어나가면서 먼저 만나는 연산자를 먼저 계산</li> +<li>알고리즘 설계 +<ul> +<li> +<p>operands 피연산자들을 스택에 넣는 방식</p> +</li> +<li> +<p>구현 코드</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span><span class="lnt">14 +</span><span class="lnt">15 +</span><span class="lnt">16 +</span><span class="lnt">17 +</span><span class="lnt">18 +</span><span class="lnt">19 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">postfixEval</span><span class="p">(</span><span class="n">tokenList</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">valStack</span> <span class="o">=</span> <span class="n">ArrayStack</span><span class="p">()</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">t</span> <span class="ow">in</span> <span class="n">tokenList</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="nb">type</span><span class="p">(</span><span class="n">t</span><span class="p">)</span> <span class="ow">is</span> <span class="nb">int</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">valStack</span><span class="o">.</span><span class="n">push</span><span class="p">(</span><span class="n">t</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="k">else</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">b</span> <span class="o">=</span> <span class="n">valStack</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> +</span></span><span class="line"><span class="cl"> <span class="n">a</span> <span class="o">=</span> <span class="n">valStack</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">t</span> <span class="o">==</span> <span class="s1">&#39;*&#39;</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">valStack</span><span class="o">.</span><span class="n">push</span><span class="p">(</span><span class="n">a</span><span class="o">*</span><span class="n">b</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="k">elif</span> <span class="n">t</span> <span class="o">==</span> <span class="s1">&#39;/&#39;</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">valStack</span><span class="o">.</span><span class="n">push</span><span class="p">(</span><span class="n">a</span><span class="o">/</span><span class="n">b</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="k">elif</span> <span class="n">t</span> <span class="o">==</span> <span class="s1">&#39;+&#39;</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">valStack</span><span class="o">.</span><span class="n">push</span><span class="p">(</span><span class="n">a</span><span class="o">+</span><span class="n">b</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="k">elif</span> <span class="n">t</span> <span class="o">==</span> <span class="s1">&#39;-&#39;</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">valStack</span><span class="o">.</span><span class="n">push</span><span class="p">(</span><span class="n">a</span><span class="o">-</span><span class="n">b</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">valStack</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +</ul> +</li> +</ul> +</li> +</ul> +<h2 id="span-stylecolorb0d9b1checkspan">👀 <strong><span style="color:#B0D9B1">CHECK</span></strong></h2> +<h6 id="어렵거나-새롭게-알게-된-것-등-다시-확인할-것들"><em>(어렵거나 새롭게 알게 된 것 등 다시 확인할 것들)</em></h6> +<ul> +<li> +<p>member field, member method</p> +<ul> +<li>용어의 뜻은 알지만 애매해서 다시 정리하기 위해 찾아봄 <br> +<a class="link" href="https://as-i-am-programing.tistory.com/7" target="_blank" rel="noopener" + >정리에 참고한 사이트</a></li> +</ul> +</li> +<li> +<p>추상적 자료구조</p> +<ul> +<li>abstract data type vs. data structure +<ul> +<li>an ADT (Abstract Data Type) is more of a logical description, while a Data Structure is concrete.</li> +</ul> +</li> +<li><a class="link" href="https://velog.io/@hwan2da/%EC%9E%90%EB%A3%8C%EA%B5%AC%EC%A1%B0-%EC%B6%94%EC%83%81%EC%9E%90%EB%A3%8C%ED%98%95" target="_blank" rel="noopener" + >정리에 참고한 사이트 : 추상적 자료형 vs. 자료구조</a></li> +</ul> +</li> +<li> +<p>dummy node를 추가한 구조의 linked list</p> +</li> +<li> +<p>stack underflow</p> +</li> +</ul> +<h2 id="span-stylecolorb0d9b1느낀-점span">‼️ <strong><span style="color:#B0D9B1">느낀 점</span></strong></h2> +<p>오늘은 두 가지 교훈(?) 을 얻었다.</p> +<ol> +<li> +<p>한번에 두가지 일을 하지 않기 +강의를 들으면서 TIL을 적으려고 했는데, 외려 더 정신없고 힘들었다. 강의 듣는 중간에 적다 보니, 그냥 받아쓰기가 되는것도 별로였다. 큰 주제 (오늘 같은 경우 LinkedList / Stack)를 다 듣고 정리하는게 나을 듯!</p> +</li> +<li> +<p>사소한 실수 하지 않고 꼼꼼하게 체크하기 +오늘 연습문제를 풀면서</p> +<blockquote> +</blockquote> +<p>node.data 대신 node 객체를 반환함 +linked list의 nodeCount 증감시키는걸 빼먹음</p> +<p>명시된 조건을 빼먹는 실수를 저질러서 디버깅 한다고 다 합해서 한시간 가까이 소모했다. +몰라서 못 푸는것 보다 이런 부분에서 꼼꼼하지 못해서 못 푸는게 더 싫다. 심지어 원래는 그렇게 자주 하는 실수도 아니어서 자존심이 더 상했다. ㅠㅠ <br> +그래도 이런 날이 있어야 앞으로 안 그럴 수 있으니까 계속 담아두지는 말아야지!</p> +</li> +</ol> +<p>내일은 강의와 실습을 꼼꼼하게 진행하고, 내가 이해한 내용을 토대로 TIL을 잘 적어봐야겠다. :&gt;. +그리고 내일은 github 블로그에 올려봐야지! 🔥 어렵지만 할 만한 가치가 있어보인다 😊</p> + + + + Day 1 + https://srlee056.github.io/p/day-1/ + Mon, 16 Oct 2023 00:00:00 +0000 + + https://srlee056.github.io/p/day-1/ + <h1 id="span-stylecolor79ac781-자료구조--알고리즘-강의-및-코드-리뷰span"><strong><span style="color:#79AC78">1. 자료구조 &amp; 알고리즘 강의 및 코드 리뷰</span></strong></h1> +<h2 id="span-stylecolorb0d9b1공부-내용span">📋 <strong><span style="color:#B0D9B1">공부 내용</span></strong></h2> +<h3 id="span-stylecolord0e7d2선형-배열---linear-arraysspan"><span style="color:#D0E7D2">선형 배열 - Linear Arrays</span></h3> +<ul> +<li> +<p>배열(array) : 개념적 구조 / 리스트 : python 데이터형</p> +</li> +<li> +<p>리스트 methods</p> +<ul> +<li>time complexity O(1) +<ul> +<li><code>.append()</code></li> +<li><code>.pop()</code></li> +</ul> +</li> +<li>time complexity O(n) +<ul> +<li><code>.insert()</code></li> +<li><code>.del()</code></li> +<li><code>.index()</code></li> +<li><code>.insert()</code></li> +</ul> +</li> +</ul> +</li> +<li> +<p>정렬(sort)</p> +<ul> +<li><code>sorted()</code> : function, 정렬된 새로운 리스트를 반환하며 기존 리스트에는 변화 없음.</li> +<li><code>.sort()</code> : method, 기존 리스트가 정렬됨</li> +<li>숫자가 아닌 문자열 등 데이터형의 정렬 : 사전순이 기본, 문자열의 길이 등 다른 정렬 조건을 사용하고 싶다면 <code>lambda</code> 활용 +<ul> +<li> +<p>문자열을 길이순으로 정렬</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="nb">sorted</span><span class="p">(</span><span class="n">L</span><span class="p">,</span> <span class="n">key</span> <span class="o">=</span> <span class="k">lambda</span> <span class="n">x</span> <span class="p">:</span> <span class="nb">len</span><span class="p">(</span><span class="n">x</span><span class="p">))</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li> +<p>사전 데이터형(dictionary)에 key = ‘name’인 value의 문자열 순서대로 정렬</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">L</span> <span class="o">=</span> <span class="p">[</span> <span class="p">{</span><span class="s1">&#39;name&#39;</span> <span class="p">:</span> <span class="s1">&#39;John&#39;</span><span class="p">,</span> <span class="s1">&#39;score&#39;</span><span class="p">:</span> <span class="mi">90</span><span class="p">},</span> +</span></span><span class="line"><span class="cl"> <span class="p">{</span><span class="s1">&#39;name&#39;</span> <span class="p">:</span> <span class="s1">&#39;Paul&#39;</span><span class="p">,</span> <span class="s1">&#39;score&#39;</span><span class="p">:</span> <span class="mi">80</span><span class="p">}</span> <span class="p">]</span> +</span></span><span class="line"><span class="cl"><span class="nb">sorted</span><span class="p">(</span><span class="n">L</span><span class="p">,</span> <span class="n">key</span> <span class="o">=</span> <span class="k">lambda</span> <span class="n">x</span> <span class="p">:</span> <span class="n">x</span><span class="p">[</span><span class="s1">&#39;name&#39;</span><span class="p">]</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +</ul> +</li> +</ul> +</li> +<li> +<p>탐색(search)</p> +<ul> +<li>선형(linear) 탐색, 순차(sequential) 탐색</li> +<li>이진(binary) 탐색</li> +</ul> +</li> +</ul> +<h3 id="span-stylecolord0e7d2재귀-알고리즘---recursive-algorithmsspan"><span style="color:#D0E7D2">재귀 알고리즘 - recursive algorithms</span></h3> +<ul> +<li><strong>종결 조건(trivial case)</strong> 을 명시해야 함</li> +<li>예시 +<ul> +<li> +<p>1부터 x까지 숫자의 합을 구하는 함수 (sum)</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">recursiveSum</span><span class="p">(</span><span class="n">x</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">x</span> <span class="o">&lt;</span> <span class="mi">1</span> <span class="p">:</span> <span class="k">return</span> <span class="n">x</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">recursiveSum</span><span class="p">(</span><span class="n">x</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="o">+</span> <span class="n">x</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li> +<p>조합의 수 (nCm)</p> +</li> +<li> +<p>하노이의 탑</p> +</li> +<li> +<p>피보나치 순열</p> +</li> +</ul> +</li> +<li>장점 : 알고리즘을 간단하고 이해하기 쉽게 풀어냄</li> +<li>단점 : time complexity 부분에서 비효율적인 경우가 많음</li> +<li>이러한 특성 때문에 tree 자료구조를 이용하는 알고리즘에 활용</li> +</ul> +<h3 id="span-stylecolord0e7d2complexityspan"><span style="color:#D0E7D2">Complexity</span></h3> +<ul> +<li>Time Complexity</li> +<li>Space Complexity</li> +<li>다루는 데이터가 커질수록, 더 효율적인 complexity를 가지는 방식이 필요함 (2^n, n! 등의 complexity <strong>X</strong>)</li> +</ul> +<h2 id="span-stylecolorb0d9b1checkspan">👀 <strong><span style="color:#B0D9B1">CHECK</span></strong></h2> +<h6 id="어렵거나-새롭게-알게-된-것-등-다시-확인할-것들"><em>(어렵거나 새롭게 알게 된 것 등 다시 확인할 것들)</em></h6> +<ul> +<li>코드로 elapsed time을 확인 -&gt; 디버깅이나 time complexity를 직관적으로 확인하는 등에 활용</li> +<li>list method <code>.pop()</code> 과 <code>.remove()</code>의 차이점</li> +<li>big O notation - O of n 으로 읽음</li> +<li>list의 앞과 뒤에 접근하는것은 O(1)의 time complextity를 갖는다.</li> +</ul> +<h2 id="span-stylecolorb0d9b1느낀-점span">‼️ <strong><span style="color:#B0D9B1">느낀 점</span></strong></h2> +<p>아직까지는 전공 과정 복습하는 느낌이고, 쉽다고 느꼈다. 막히는 부분은 없었다. 코드를 작성하면서 조금 더 나은 코드에 대해 생각해보는것 정도. <br> +공부하는 중이나 이후에 바로 TIL을 적는게 제일 좋다고 생각하는데, 블로그 세팅에 정신이 팔려서 나중에 작성하게 된 건 조금 아쉽다. <br> +오늘은 코어타임보다 일찍 강의를 들어버려서 시간 분배가 애매했다. 내일은 코어타임 시작할 때 듣기 시작하고, 그 전에는 전날 내용을 복습하거나, 알고리즘 문제를 풀고 code review를 작성하는 시간을 가져야겠다.</p> +<h1 id="span-stylecolor79ac782-블로그-세팅-과정span"><strong><span style="color:#79AC78">2. 블로그 세팅 과정</span></strong></h1> +<p><img src="https://blog.kakaocdn.net/dn/cKgXTh/btsyuerJaNh/HhtKTmduAbBOsbBmTD8g00/img.png" + + + + loading="lazy" + + alt="https://blog.kakaocdn.net/dn/cKgXTh/btsyuerJaNh/HhtKTmduAbBOsbBmTD8g00/img.png" + + +></p> +<p>노션이나 옵시디언으로 TIL을 적고 깃에 업로드 한 적은 많지만 블로그에 올리는건 처음이라, 어디에 올리지 고민하다가 일단 티스토리 계정과 블로그를 만들었다.<br> +그런데 만들다 보니 <strong>github repo와 연동되는 page를 세팅하고 싶다..!</strong> 라는 욕심이 들기 시작했고, <br> +jekyll 등을 알아보다가 hugo를 활용한 페이지 세팅을 접하게 되어 장장 3시간을 투자했다.</p> +<p>그런데 이 글을 티스토리에 올리는 이유는? 세팅에 실패했기 때문 ㅠㅠ<br> +TIL 작성하고 나서 다시 도전해서 세팅 과정에 대해서도 글을 써 볼 예정이다.</p> +<p>+) 티스토리에서 md로 작성한게 예쁘게 안나와서 벨로그로 옮겼다 😂 훨씬 편한 것 같은데 깃허브랑 연동 전까진 벨로그로 해야겠다 :&gt;</p> +<h2 id="span-stylecolorb0d9b1지금까지-참고한-링크들span"><span style="color:#B0D9B1">(지금까지 참고한 링크들)</span></h2> +<ul> +<li><a class="link" href="https://gohugo.io/getting-started/quick-start/" target="_blank" rel="noopener" + >휴고 사이트 생성 가이드</a></li> +<li><a class="link" href="https://gohugo.io/hosting-and-deployment/hosting-on-github/" target="_blank" rel="noopener" + >휴고 사이트 깃허브 연결 가이드</a></li> +<li><a class="link" href="https://themes.gohugo.io/themes/salinger-theme/#quick-start-" target="_blank" rel="noopener" + >사용 테마1</a></li> +<li><a class="link" href="https://github.com/CaiJimmy/hugo-theme-stack-starter" target="_blank" rel="noopener" + >사용 테마2</a></li> +</ul> + + + + + diff --git a/public/tags/data-structure/page/1/index.html b/public/tags/data-structure/page/1/index.html new file mode 100644 index 0000000..52ff6e3 --- /dev/null +++ b/public/tags/data-structure/page/1/index.html @@ -0,0 +1,10 @@ + + + + https://srlee056.github.io/tags/data-structure/ + + + + + + diff --git a/public/tags/dfsbfs/index.html b/public/tags/dfsbfs/index.html new file mode 100644 index 0000000..02693ee --- /dev/null +++ b/public/tags/dfsbfs/index.html @@ -0,0 +1,479 @@ + + + + +Tag: DFS&BFS - 서림록 + + + + + + + + + + + + + + + +
+ + + + +
+
+

+ + Tags + +

+ +
+
+

1 페이지

+

DFS&BFS

+ +
+
+
+ +
+ + + +
+
+ + +
+ Hugo로 만듦
+ JimmyStack 테마 사용 중 +
+
+ + +
+
+ + + + + diff --git a/public/tags/dfsbfs/index.xml b/public/tags/dfsbfs/index.xml new file mode 100644 index 0000000..fcf0a83 --- /dev/null +++ b/public/tags/dfsbfs/index.xml @@ -0,0 +1,299 @@ + + + + DFS&BFS on 서림록 + https://srlee056.github.io/tags/dfsbfs/ + Recent content in DFS&BFS on 서림록 + Hugo -- gohugo.io + ko + Seorim Lee + Fri, 20 Oct 2023 00:00:00 +0000 + Day 5 + https://srlee056.github.io/p/day-5/ + Fri, 20 Oct 2023 00:00:00 +0000 + + https://srlee056.github.io/p/day-5/ + <h1 id="span-stylecolor79ac78til---heap--dynamic-programming--dfsbfs-문제풀이-위주span"><strong><span style="color:#79AC78">TIL - Heap / Dynamic Programming / DFS&amp;BFS (문제풀이 위주)</span></strong></h1> +<h2 id="span-stylecolorb0d9b1공부-내용span">📋 <strong><span style="color:#B0D9B1">공부 내용</span></strong></h2> +<h3 id="span-stylecolord0e7d2heapspan"><span style="color:#D0E7D2">Heap</span></h3> +<hr> +<h4 id="더-맵게-문제-풀이">&lt;더 맵게&gt; 문제 풀이</h4> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span><span class="lnt">14 +</span><span class="lnt">15 +</span><span class="lnt">16 +</span><span class="lnt">17 +</span><span class="lnt">18 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">heapq</span> <span class="c1">#heap 라이브러리 사용</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">solution</span><span class="p">(</span><span class="n">scoville</span><span class="p">,</span> <span class="n">K</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">answer</span> <span class="o">=</span> <span class="mi">0</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># heapify, heappop, heappush 활용</span> +</span></span><span class="line"><span class="cl"> <span class="n">heapq</span><span class="o">.</span><span class="n">heapify</span><span class="p">(</span><span class="n">scoville</span><span class="p">)</span> <span class="c1">#min heap 구성</span> +</span></span><span class="line"><span class="cl"> <span class="k">while</span> <span class="kc">True</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">s1</span> <span class="o">=</span> <span class="n">heapq</span><span class="o">.</span><span class="n">heappop</span><span class="p">(</span><span class="n">scoville</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">s1</span> <span class="o">&gt;=</span> <span class="n">K</span> <span class="p">:</span> <span class="c1">#모든 스코빌 지수가 K이상</span> +</span></span><span class="line"><span class="cl"> <span class="k">break</span> +</span></span><span class="line"><span class="cl"> <span class="k">elif</span> <span class="nb">len</span><span class="p">(</span><span class="n">scoville</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span> <span class="c1"># K이상으로 만들 수 없는 경우</span> +</span></span><span class="line"><span class="cl"> <span class="n">answer</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span> +</span></span><span class="line"><span class="cl"> <span class="k">break</span> +</span></span><span class="line"><span class="cl"> <span class="n">s2</span> <span class="o">=</span> <span class="n">heapq</span><span class="o">.</span><span class="n">heappop</span><span class="p">(</span><span class="n">scoville</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="n">newS</span> <span class="o">=</span> <span class="n">s1</span> <span class="o">+</span> <span class="n">s2</span><span class="o">*</span><span class="mi">2</span> +</span></span><span class="line"><span class="cl"> <span class="n">heapq</span><span class="o">.</span><span class="n">heappush</span><span class="p">(</span><span class="n">scoville</span><span class="p">,</span><span class="n">newS</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="n">answer</span> <span class="o">+=</span> <span class="mi">1</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">answer</span> +</span></span></code></pre></td></tr></table> +</div> +</div><br> +<h3 id="span-stylecolord0e7d2dynamic-programmingspan"><span style="color:#D0E7D2">Dynamic Programming</span></h3> +<hr> +<h4 id="dpdynamic-programming">DP(Dynamic Programming)</h4> +<blockquote> +<p>알고리즘 진행에 따라 <code>탐색해야 할 범위를 동적으로 결정</code>하여 탐색 범위를 한정</p> +</blockquote> +<p><strong>EX1)</strong> <em>피보나치 수열</em></p> +<table> +<thead> +<tr> +<th>Complexity</th> +<th>재귀함수</th> +<th>DP</th> +</tr> +</thead> +<tbody> +<tr> +<td>Time</td> +<td>O(2^n)</td> +<td>O(n)</td> +</tr> +<tr> +<td>Space</td> +<td>O(n)</td> +<td>O(n)</td> +</tr> +</tbody> +</table> +<p>참고 : <a class="link" href="https://towardsdatascience.com/dynamic-programming-i-python-8b20387870f5" target="_blank" rel="noopener" + >Recursion vs Dynamic Programming - Fibonacci</a></p> +<p><strong>EX2)</strong> <em>knapsack problem</em><br> +weight / value를 가진 여러 물건이 있을 때, weight 제한이 있는 베낭에 value의 합이 가장 높도록 물건을 골라 담는 문제</p> +<br> +<h4 id="n으로-표현-문제-풀이">&lt;N으로 표현&gt; 문제 풀이</h4> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span><span class="lnt">14 +</span><span class="lnt">15 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">solution</span><span class="p">(</span><span class="n">N</span><span class="p">,</span> <span class="n">number</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">strN</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">N</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># 직관적인 코드를 위해 다음과 같이 index : 1~8 사용 설정 (index 0은 사용하지 않음)</span> +</span></span><span class="line"><span class="cl"> <span class="n">numberUsed</span> <span class="o">=</span> <span class="p">[{}</span> <span class="k">for</span> <span class="n">_</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">9</span><span class="p">)]</span> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">9</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">numberUsed</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span><span class="nb">int</span><span class="p">(</span><span class="n">strN</span> <span class="o">*</span> <span class="p">(</span><span class="n">i</span><span class="p">))}</span> <span class="c1"># N을 i번 나열한 숫자 ex) 555, 7777, ...</span> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">j</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span> <span class="p">,</span> <span class="n">i</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">n1</span> <span class="ow">in</span> <span class="n">numberUsed</span><span class="p">[</span><span class="n">j</span><span class="p">]:</span> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">n2</span> <span class="ow">in</span> <span class="n">numberUsed</span><span class="p">[</span><span class="n">i</span><span class="o">-</span><span class="n">j</span><span class="p">]:</span> +</span></span><span class="line"><span class="cl"> <span class="n">newNumbers</span> <span class="o">=</span> <span class="p">[</span><span class="n">n1</span><span class="o">*</span><span class="n">n2</span><span class="p">,</span> <span class="n">n1</span><span class="o">+</span><span class="n">n2</span><span class="p">,</span> <span class="n">n1</span><span class="o">-</span><span class="n">n2</span><span class="p">]</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">n2</span> <span class="o">!=</span> <span class="mi">0</span> <span class="p">:</span> <span class="n">newNumbers</span><span class="o">.</span><span class="n">append</span><span class="p">(</span> <span class="n">n1</span><span class="o">//</span><span class="n">n2</span> <span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="n">numberUsed</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">newNumbers</span><span class="p">)</span> <span class="c1">#set1.update(set2) 사용하여 원소 추가. set 아닌 list를 넘겨줄수도 있다.</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">number</span> <span class="ow">in</span> <span class="n">numberUsed</span><span class="p">[</span><span class="n">i</span><span class="p">]:</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">i</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="o">-</span><span class="mi">1</span> +</span></span></code></pre></td></tr></table> +</div> +</div><br> +<h3 id="span-stylecolord0e7d2dfs--bfsspan"><span style="color:#D0E7D2">DFS &amp; BFS</span></h3> +<h4 id="1-depth-first-search">1. Depth First Search</h4> +<blockquote> +<p>한 vertex에서 인접한 모든 vertex를 방문할 때, 인접한 vertex를 기준으로 <code>깊이 우선 탐색</code>을 끝낸 후 다음 vertex로 진행하는 방식<br> +<code>스택</code>을 이용하여 어느 정점에서 DFS를 진행하고 있는지를 기억</p> +</blockquote> +<h4 id="2-breadth-first-search">2. Breadth First Search</h4> +<blockquote> +<p>한 vertex에서 인접한 모든 vertex를 방문하고, 방문한 인접 vertex를 기준으로 <code>너비 우선 탐색</code>을 진행하는 방식</p> +</blockquote> +<h4 id="3-graph">3. Graph</h4> +<blockquote> +<p>-vertex(=node) &amp; edge(=link)<br> +-directed / undirected graph</p> +</blockquote> +<h4 id="여행-경로-문제-풀이">&lt;여행 경로&gt; 문제 풀이</h4> +<p>DFS를 응용한 재귀 한 붓 그리기</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span><span class="lnt">14 +</span><span class="lnt">15 +</span><span class="lnt">16 +</span><span class="lnt">17 +</span><span class="lnt">18 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">solution</span><span class="p">(</span><span class="n">tickets</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">routes</span> <span class="o">=</span> <span class="p">{}</span> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="ow">in</span> <span class="n">tickets</span><span class="p">:</span> <span class="c1">#출발지, 도착지</span> +</span></span><span class="line"><span class="cl"> <span class="n">routes</span><span class="p">[</span><span class="n">a</span><span class="p">]</span> <span class="o">=</span> <span class="n">routes</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="p">[])</span> +</span></span><span class="line"><span class="cl"> <span class="n">routes</span><span class="p">[</span><span class="n">a</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">b</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">r</span> <span class="ow">in</span> <span class="n">routes</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">routes</span><span class="p">[</span><span class="n">r</span><span class="p">]</span><span class="o">.</span><span class="n">sort</span><span class="p">(</span><span class="n">reverse</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># 역순인 이유? 파이썬의 데이터 삭제 과정을 살펴보면 뒤에서 뽑는게 더 효울적이기 때문 </span> +</span></span><span class="line"><span class="cl"> <span class="n">stack</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&#34;ICN&#34;</span><span class="p">]</span> +</span></span><span class="line"><span class="cl"> <span class="n">path</span> <span class="o">=</span> <span class="p">[]</span> +</span></span><span class="line"><span class="cl"> <span class="k">while</span> <span class="mi">0</span> <span class="o">&lt;</span> <span class="nb">len</span><span class="p">(</span><span class="n">stack</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">top</span> <span class="o">=</span> <span class="n">stack</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">top</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">routes</span> <span class="ow">or</span> <span class="nb">len</span><span class="p">(</span><span class="n">routes</span><span class="p">[</span><span class="n">top</span><span class="p">])</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span> <span class="c1"># 이 공항에서 떠나는 티켓이 존재하지 않음</span> +</span></span><span class="line"><span class="cl"> <span class="n">path</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">stack</span><span class="o">.</span><span class="n">pop</span><span class="p">())</span> +</span></span><span class="line"><span class="cl"> <span class="k">else</span> <span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">stack</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">routes</span><span class="p">[</span><span class="n">top</span><span class="p">]</span><span class="o">.</span><span class="n">pop</span><span class="p">())</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">path</span><span class="p">[::</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> +</span></span></code></pre></td></tr></table> +</div> +</div><br> +<h3 id="span-stylecolord0e7d2추가-문제풀이span"><span style="color:#D0E7D2">추가 문제풀이</span></h3> +<details> +<summary>문제 링크 모음(많이 김)</summary> +<!-- summary 아래 한칸 공백 두어야함 --> +<br> +프로그래머스 코딩테스트 문제 링크 (코스에 있는 문제여도 프로그래머스 코테 링크로 적음) +<ul> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/42576" target="_blank" rel="noopener" + >완주하지 못한 사람</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/12909" target="_blank" rel="noopener" + >올바른 괄호</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/49993" target="_blank" rel="noopener" + >스킬트리</a> +<br></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/12978" target="_blank" rel="noopener" + >배달</a> +<br></li> +<li>[세 소수의 합]</li> +<li>[주사위 게임]</li> +<li><a class="link" href="https://school.programmers.co.kr/app/courses/19071/curriculum/lessons/236812" target="_blank" rel="noopener" + >사탕 담기</a> +<br></li> +<li>[빙고]</li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/49994" target="_blank" rel="noopener" + >방문 길이</a></li> +<li>[쇠막대기]</li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/60059" target="_blank" rel="noopener" + >자물쇠와 열쇠</a> +<br></li> +<li>[게임 아이템] +<br></li> +<li><a class="link" href="https://school.programmers.co.kr/app/courses/19071/curriculum/lessons/236806" target="_blank" rel="noopener" + >기능개발</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/42626" target="_blank" rel="noopener" + >더 맵게</a></li> +<li>[배상 비용 최소화]</li> +<li>[문자열 압축 코드] +<br></li> +<li><a class="link" href="https://school.programmers.co.kr/app/courses/19071/curriculum/lessons/236811" target="_blank" rel="noopener" + >카펫</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/12982" target="_blank" rel="noopener" + >예산</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/12952" target="_blank" rel="noopener" + >N-Queen</a></li> +<li>[버스 여행] +<br></li> +<li><a class="link" href="https://school.programmers.co.kr/app/courses/19071/curriculum/lessons/236805" target="_blank" rel="noopener" + >예산_소팅</a></li> +<li><a class="link" href="https://school.programmers.co.kr/app/courses/19071/curriculum/lessons/236808" target="_blank" rel="noopener" + >최솟값 만들기</a></li> +<li><a class="link" href="https://school.programmers.co.kr/app/courses/19071/curriculum/lessons/236807" target="_blank" rel="noopener" + >가장 큰 수</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/42895" target="_blank" rel="noopener" + >N으로 표현</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/12900" target="_blank" rel="noopener" + >2 x n 타일링</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/42898" target="_blank" rel="noopener" + >등굣길</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/12904" target="_blank" rel="noopener" + >가장 긴 팰린드롬</a> +<br></li> +</ul> +</details> +<h2 id="span-stylecolorb0d9b1checkspan">👀 <strong><span style="color:#B0D9B1">CHECK</span></strong></h2> +<h6 id="어렵거나-새롭게-알게-된-것-등-다시-확인할-것들"><em>(어렵거나 새롭게 알게 된 것 등 다시 확인할 것들)</em></h6> +<h4 id="pep-8">PEP 8</h4> +<p>파이썬이 추구하는 코드 스타일. 들여쓰기, 공백, 변수명 작성 규칙 등이 포함된다.</p> +<ul> +<li><a class="link" href="https://peps.python.org/pep-0008/" target="_blank" rel="noopener" + >PEP 8 - Style Guide for Python Code(공식 문서)</a></li> +<li><a class="link" href="https://wayhome25.github.io/python/2017/05/04/pep8/" target="_blank" rel="noopener" + >PEP8 스타일 가이드를 설명하는 블로그(한국어)</a></li> +</ul> +<h4 id="tim-sort">Tim sort</h4> +<p>Insertion sort + Merge sort</p> +<ul> +<li>Insertion sort는 <code>n이 작을 때</code> (Quick sort보다도) 빠름</li> +<li>전체를 작은 덩어리로 잘라 Insertion sort -&gt; Merge</li> +<li><a class="link" href="https://d2.naver.com/helloworld/0315536" target="_blank" rel="noopener" + >Tim sort에 대해 설명하는 글</a></li> +</ul> +<h4 id="dp-익숙해지기">DP 익숙해지기</h4> +<ul> +<li>knapsack problem 등 문제풀이를 통해 익숙해지기</li> +</ul> +<h2 id="span-stylecolorb0d9b1느낀-점span">❗ <strong><span style="color:#B0D9B1">느낀 점</span></strong></h2> +<p>오늘은 DP(Dynamic Programming)과 DFS&amp;BFS의 개념에 대해 가볍게 배우고, 문제풀이를 위주로 강의가 진행되었다.</p> +<p>아는 알고리즘들이고 어제 강의의 문제가 나에겐 어렵지 않았기 때문에, 해설 강의를 듣기 전에 문제를 먼저 풀어 보았다. 문제를 풀다가 막히는 부분이 있으면 강의를 틀고, 해결되면 멈추고 다시 풀어보곤 했다.<br> +Heap 문제를 제외한 두 문제는 해설 없이 풀었고, Heap 문제도 heapq 라이브러리를 사용해야하는 것을 깨닫고는 금방 풀 수 있었다.</p> +<p>이번주 강의를 듣고 문제를 풀면서 느낀점이 몇개 있다.</p> +<ol> +<li> +<p>나는 알고리즘 자체는 꽤 잘 알고 활용도 잘 하는 편이지만 라이브러리 사용에 있어서 소극적인 면이 있다. 문제를 풀 때 파이썬 표준 라이브러리조차도 잘 import하지 않고 Dictionary나 Set정도만 사용하는 편이었다. <em>(Heap도 자체적으로 구현하거나 list를 사용하곤 했는데 왜 이런 습관이 들었는지는 잘 모르겠다.)</em> <br> +이번 강의를 들으면서 표준 라이브러리에 있는 여러 데이터형을 활용했고 다음에 문제를 풀 때도 적극적으로 활용하면서 더 효과적인 코드를 작성하는데 가까워지려고 한다.</p> +</li> +<li> +<p>나는 CS 용어를 잘 모른다. 아예 모른다는게 아니라, 많이 헷갈리며 정확한 명칭을 찾아보지 않았다는 의미이다. member method, list comprehension 등 용어들은 분명 내가 궁금해서 찾아봤지만 아직도 헷갈리거나 명칭 자체를 몰랐던 것들이다. 강의를 통해 명확해지거나 새롭게 알게 된 용어들이 있어서 좋았고, 이제부터는 모르는 부분에 대해 검색할 때는 아예 용어와 그 정의부터 찾는것부터 시작해야겠다고 다짐했다.</p> +</li> +</ol> +<p>내일은 강의가 없는 날이다. 하지만 해야 할 일들은 있다. 오늘까지 배운걸 복습하고, 배운 자료구조와 알고리즘을 활용하는 문제들을 lv3정도로 풀어 볼 것이다. 내일도 화이팅!!</p> + + + + + diff --git a/public/tags/themes/page/1/index.html b/public/tags/dfsbfs/page/1/index.html similarity index 68% rename from public/tags/themes/page/1/index.html rename to public/tags/dfsbfs/page/1/index.html index e8378c0..105bc2c 100644 --- a/public/tags/themes/page/1/index.html +++ b/public/tags/dfsbfs/page/1/index.html @@ -1,10 +1,10 @@ - + - https://srlee056.github.io/tags/themes/ - + https://srlee056.github.io/tags/dfsbfs/ + - + diff --git a/public/tags/dom/index.html b/public/tags/dom/index.html new file mode 100644 index 0000000..93d3bcf --- /dev/null +++ b/public/tags/dom/index.html @@ -0,0 +1,479 @@ + + + + +Tag: DOM - 서림록 + + + + + + + + + + + + + + + +
+ + + + +
+
+

+ + Tags + +

+ +
+
+

1 페이지

+

DOM

+ +
+
+
+ +
+ + + +
+
+ + +
+ Hugo로 만듦
+ JimmyStack 테마 사용 중 +
+
+ + +
+
+ + + + + diff --git a/public/tags/dom/index.xml b/public/tags/dom/index.xml new file mode 100644 index 0000000..35f5784 --- /dev/null +++ b/public/tags/dom/index.xml @@ -0,0 +1,192 @@ + + + + DOM on 서림록 + https://srlee056.github.io/tags/dom/ + Recent content in DOM on 서림록 + Hugo -- gohugo.io + ko + Seorim Lee + Tue, 24 Oct 2023 00:00:00 +0000 + Day 7 + https://srlee056.github.io/p/day-7/ + Tue, 24 Oct 2023 00:00:00 +0000 + + https://srlee056.github.io/p/day-7/ + <h1 id="span-stylecolor79ac78til---httpspan"><span style="color:#79AC78">TIL - HTTP</span></h1> +<h2 id="span-stylecolorb0d9b1공부-내용span">📋 <span style="color:#B0D9B1">공부 내용</span></h2> +<h3 id="span-stylecolord0e7d2웹span"><span style="color:#D0E7D2">웹</span></h3> +<h4 id="span-stylecolorf9b572웹-페이지와-htmlspan"><span style="color:#F9B572">웹 페이지와 HTML</span></h4> +<p>웹 페이지</p> +<ul> +<li>웹 속의 <strong>문서 하나</strong></li> +<li>ex) 네이버 메인 페이지</li> +<li>HTML으로 구성되어있음</li> +</ul> +<p>웹 사이트</p> +<ul> +<li>여러 웹 페이지의 모음</li> +<li>ex) <em>네이버</em>라는 웹 사이트</li> +</ul> +<p>웹 브라우저</p> +<ul> +<li>HTTP요청을 보낸 후, HTTP응답에 담긴 HTML문서를 사용자가 보기 쉽게 화면으로 그려주는 (렌더링) 역할</li> +</ul> +<p><a class="link" href="https://velog.io/@srlee056/%EB%8D%B0%EC%9D%B4%ED%84%B0-%EC%97%94%EC%A7%80%EB%8B%88%EC%96%B4%EB%A7%81-%EB%8D%B0%EB%B8%8C%EC%BD%94%EC%8A%A4-6%EC%9D%BC%EC%B0%A8" target="_blank" rel="noopener" + >HTML(개념 정리 글 링크)</a></p> +<ul> +<li>이전 강의에서 다룬 내용 참고</li> +<li>웹 브라우저마다 지원하는 태그와 속성이 달라짐</li> +</ul> +<h4 id="span-stylecolorf9b572웹-스크래핑--웹-크롤링span"><span style="color:#F9B572">웹 스크래핑 / 웹 크롤링</span></h4> +<p>웹 스크래핑</p> +<ul> +<li>특정 목적에 따라 웹 페이지에서 원하는 데이터를 &ldquo;추출&rdquo;</li> +<li>ex) 날씨 정보 가져오기, 주식 데이터 가져오기, &hellip;</li> +</ul> +<p>웹 크롤링</p> +<ul> +<li>크롤러를 이용해 URL을 타고 이동하며 반복적으로 웹 페이지의 데이터를 가져와 &ldquo;인덱싱&rdquo;(데이터 색인)</li> +<li>구글, 네이버 등 검색 엔진의 웹 크롤러</li> +</ul> +<h4 id="span-stylecolorf9b572올바른-http-requestspan"><span style="color:#F9B572">올바른 HTTP Request</span></h4> +<p>올바른 HTTP Request를 위해선..</p> +<ul> +<li>어떤 목적을 달성하려 하는가?</li> +<li>서버에 영향을 미치는가?</li> +</ul> +<p>로봇 배제 프로토콜(REP)</p> +<ul> +<li>웹 크롤링, 스크래핑은 로봇에 의해 실행 가능</li> +<li>사이트의 모든 정보를 취득하는것이 정당한가? 의문에서 시작</li> +<li>robots.txt +<ul> +<li>각 사이트마다 허용하는 크롤러 정보와 허용범위에 대한 정보를 담고 있음</li> +<li>User-agent, Disallow, Allow</li> +</ul> +</li> +</ul> +<h3 id="span-stylecolord0e7d2httpspan"><span style="color:#D0E7D2">HTTP</span></h3> +<h4 id="span-stylecolorf9b572httpspan"><span style="color:#F9B572">HTTP?</span></h4> +<blockquote> +<p>HyterText Transfer Protocol<br> +웹 상에서 정보를 주고받기 위한 <em>약속</em></p> +</blockquote> +<table> +<thead> +<tr> +<th></th> +<th>HTTP Request</th> +<th>HTTP Response</th> +</tr> +</thead> +<tbody> +<tr> +<td>방향</td> +<td>Client -&gt; Server</td> +<td>Client &lt;- Server</td> +</tr> +<tr> +<td>역할</td> +<td>정보 요청</td> +<td>요청에 대한 내용을 담은 응답</td> +</tr> +<tr> +<td>HEAD</td> +<td>method, path, &hellip;</td> +<td>content-type, date, &hellip;</td> +</tr> +<tr> +<td>BODY</td> +<td></td> +<td>document</td> +</tr> +</tbody> +</table> +<h4 id="span-stylecolorf9b572통신하기span"><span style="color:#F9B572">통신하기</span></h4> +<p><code>requests</code></p> +<ul> +<li>Python으로 HTTP 통신을 진행할 수 있게 해주는 라이브러리</li> +</ul> +<p><code>GET</code></p> +<ul> +<li>naver 메인 페이지를 요청하는 코드</li> +</ul> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">requests</span> +</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">requests</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&#34;https://www.naver.com&#34;</span><span class="p">)</span> <span class="c1"># HTTP Response</span> +</span></span><span class="line"><span class="cl"><span class="n">res</span><span class="o">.</span><span class="n">headers</span> <span class="c1"># Header 확인</span> +</span></span><span class="line"><span class="cl"><span class="n">res</span><span class="o">.</span><span class="n">text</span> <span class="c1"># Body(document) text 형태로 확인</span> +</span></span></code></pre></td></tr></table> +</div> +</div><p><code>POST</code></p> +<ul> +<li><a class="link" href="https://webhook.site" target="_blank" rel="noopener" + >https://webhook.site</a> 를 통해 POST 통신을 진행할 수 있음</li> +</ul> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">payload</span> <span class="o">=</span> <span class="p">{</span><span class="s2">&#34;name&#34;</span><span class="p">:</span> <span class="s2">&#34;Hello&#34;</span><span class="p">,</span> <span class="s2">&#34;age&#34;</span><span class="p">:</span> <span class="mi">13</span><span class="p">}</span> +</span></span><span class="line"><span class="cl"><span class="n">url</span> <span class="o">=</span> <span class="s2">&#34;https://webhook.site/&lt;개인 주소&gt;&#34;</span> +</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">requests</span><span class="o">.</span><span class="n">post</span><span class="p">(</span><span class="n">url</span><span class="p">,</span> <span class="n">payload</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"><span class="n">res</span><span class="o">.</span><span class="n">status_code</span> <span class="c1"># 상태 코드 확인</span> +</span></span></code></pre></td></tr></table> +</div> +</div><h3 id="span-stylecolord0e7d2domspan"><span style="color:#D0E7D2">DOM</span></h3> +<h4 id="span-stylecolorf9b572domspan"><span style="color:#F9B572">DOM?</span></h4> +<blockquote> +<p>Document Object Model<br> +HTML을 파싱하여, 브라우저가 이해하도록 만든 Tree형태의 자료구조</p> +</blockquote> +<ul> +<li> +<p>DOM의 각 노드를 객체로 생각하여, 문서를 편리하게 관리할 수 있음</p> +</li> +<li> +<p>원하는 요소를 동적으로 변경할 수 있음</p> +</li> +<li> +<p>원하는 요소를 쉽게 찾을 수 있음</p> +</li> +<li> +<p>python으로 HTML을 직접 분석하려면 DOM을 생성해주는 브라우저를 거치지 않기 때문에, +직접 HTML을 분석하는 <code>HTML Parser</code>가 필요</p> +</li> +</ul> +<h2 id="span-stylecolorb0d9b1checkspan">👀 <span style="color:#B0D9B1">CHECK</span></h2> +<p><em><span style = "font-size:15px">(어렵거나 새롭게 알게 된 것 등 다시 확인할 것들)</span></em></p> +<ul> +<li> +<p>Jupyter lab</p> +<ul> +<li>Jupyter notebook이나 Colab은 써 봤는데 Jupyter lab은 처음 접해봄</li> +<li>Jupyter notebook과 비슷하지만 더 개선된 버전(?)</li> +</ul> +</li> +<li> +<p>DOM에 대한 설명 및 활용 : 복습 후 다른 예시들을 더 찾아볼 것</p> +</li> +</ul> +<h2 id="span-stylecolorb0d9b1느낀-점span">❗ <span style="color:#B0D9B1">느낀 점</span></h2> +<p>HTML 스크래핑을 해본적이 있어서 이론이나 실습 모두 빠르게 진행했다. 5시간 분량의 강의인데 3시간 내로 끝난 것 같다. TIL을 잘 적고 싶어서 고민을 좀 했고 그 외의 시간은 평소보다는 널널하게 흘려보냈다.</p> +<p>TIL을 적을 때 기존에는 강의 받아쓰기처럼 적는 경향이 있었는데, 나중에 다시 읽어보니 이해하고 쓴 것 같은 느낌이 전혀 들지 않았다. 어제 HTML이론에 대한 TIL은 실습 부분 외에도 직접 사용해보고 하면서 적은거라, &lsquo;내가 직접 써보고 이해한 내용&rsquo;임을 알 수 있었다. 그런데 초반에 적은 TIL을 다시 보니까 그냥 받아적은게 티가 나기도 하고 잘 기억이 나지 않았다.</p> +<p>오늘은 강의를 처음부터 끝까지 들은 후 키워드만 체크해 필기한 다음, TIL을 적으면서 중간중간 다시 듣는 방식을 사용했다. 이 방식으로 더 잘 읽히고 짜임새 있는 구성의 글을 쓰게 되어서 만족스러웠다. TIL 쓰는 시간은 오래 걸리지만 익숙해지면 줄어들 것 같아서 걱정은 되지 않는다.</p> +<p>커리큘럼을 보니 내일부터는 BeautifulSoup를 사용해 스크래핑을 시작하는데, 모르는 부분이 많을 것 같아 벌써부터 기대가 된다. :&gt;</p> + + + + + diff --git a/public/tags/css/page/1/index.html b/public/tags/dom/page/1/index.html similarity index 70% rename from public/tags/css/page/1/index.html rename to public/tags/dom/page/1/index.html index 7ba2598..8b5191d 100644 --- a/public/tags/css/page/1/index.html +++ b/public/tags/dom/page/1/index.html @@ -1,10 +1,10 @@ - + - https://srlee056.github.io/tags/css/ - + https://srlee056.github.io/tags/dom/ + - + diff --git a/public/tags/dp/index.html b/public/tags/dp/index.html new file mode 100644 index 0000000..3e935c5 --- /dev/null +++ b/public/tags/dp/index.html @@ -0,0 +1,479 @@ + + + + +Tag: DP - 서림록 + + + + + + + + + + + + + + + +
+ + + + +
+
+

+ + Tags + +

+ +
+
+

1 페이지

+

DP

+ +
+
+
+ +
+ + + +
+
+ + +
+ Hugo로 만듦
+ JimmyStack 테마 사용 중 +
+
+ + +
+
+ + + + + diff --git a/public/tags/dp/index.xml b/public/tags/dp/index.xml new file mode 100644 index 0000000..d60bddd --- /dev/null +++ b/public/tags/dp/index.xml @@ -0,0 +1,299 @@ + + + + DP on 서림록 + https://srlee056.github.io/tags/dp/ + Recent content in DP on 서림록 + Hugo -- gohugo.io + ko + Seorim Lee + Fri, 20 Oct 2023 00:00:00 +0000 + Day 5 + https://srlee056.github.io/p/day-5/ + Fri, 20 Oct 2023 00:00:00 +0000 + + https://srlee056.github.io/p/day-5/ + <h1 id="span-stylecolor79ac78til---heap--dynamic-programming--dfsbfs-문제풀이-위주span"><strong><span style="color:#79AC78">TIL - Heap / Dynamic Programming / DFS&amp;BFS (문제풀이 위주)</span></strong></h1> +<h2 id="span-stylecolorb0d9b1공부-내용span">📋 <strong><span style="color:#B0D9B1">공부 내용</span></strong></h2> +<h3 id="span-stylecolord0e7d2heapspan"><span style="color:#D0E7D2">Heap</span></h3> +<hr> +<h4 id="더-맵게-문제-풀이">&lt;더 맵게&gt; 문제 풀이</h4> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span><span class="lnt">14 +</span><span class="lnt">15 +</span><span class="lnt">16 +</span><span class="lnt">17 +</span><span class="lnt">18 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">heapq</span> <span class="c1">#heap 라이브러리 사용</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">solution</span><span class="p">(</span><span class="n">scoville</span><span class="p">,</span> <span class="n">K</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">answer</span> <span class="o">=</span> <span class="mi">0</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># heapify, heappop, heappush 활용</span> +</span></span><span class="line"><span class="cl"> <span class="n">heapq</span><span class="o">.</span><span class="n">heapify</span><span class="p">(</span><span class="n">scoville</span><span class="p">)</span> <span class="c1">#min heap 구성</span> +</span></span><span class="line"><span class="cl"> <span class="k">while</span> <span class="kc">True</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">s1</span> <span class="o">=</span> <span class="n">heapq</span><span class="o">.</span><span class="n">heappop</span><span class="p">(</span><span class="n">scoville</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">s1</span> <span class="o">&gt;=</span> <span class="n">K</span> <span class="p">:</span> <span class="c1">#모든 스코빌 지수가 K이상</span> +</span></span><span class="line"><span class="cl"> <span class="k">break</span> +</span></span><span class="line"><span class="cl"> <span class="k">elif</span> <span class="nb">len</span><span class="p">(</span><span class="n">scoville</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span> <span class="c1"># K이상으로 만들 수 없는 경우</span> +</span></span><span class="line"><span class="cl"> <span class="n">answer</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span> +</span></span><span class="line"><span class="cl"> <span class="k">break</span> +</span></span><span class="line"><span class="cl"> <span class="n">s2</span> <span class="o">=</span> <span class="n">heapq</span><span class="o">.</span><span class="n">heappop</span><span class="p">(</span><span class="n">scoville</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="n">newS</span> <span class="o">=</span> <span class="n">s1</span> <span class="o">+</span> <span class="n">s2</span><span class="o">*</span><span class="mi">2</span> +</span></span><span class="line"><span class="cl"> <span class="n">heapq</span><span class="o">.</span><span class="n">heappush</span><span class="p">(</span><span class="n">scoville</span><span class="p">,</span><span class="n">newS</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="n">answer</span> <span class="o">+=</span> <span class="mi">1</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">answer</span> +</span></span></code></pre></td></tr></table> +</div> +</div><br> +<h3 id="span-stylecolord0e7d2dynamic-programmingspan"><span style="color:#D0E7D2">Dynamic Programming</span></h3> +<hr> +<h4 id="dpdynamic-programming">DP(Dynamic Programming)</h4> +<blockquote> +<p>알고리즘 진행에 따라 <code>탐색해야 할 범위를 동적으로 결정</code>하여 탐색 범위를 한정</p> +</blockquote> +<p><strong>EX1)</strong> <em>피보나치 수열</em></p> +<table> +<thead> +<tr> +<th>Complexity</th> +<th>재귀함수</th> +<th>DP</th> +</tr> +</thead> +<tbody> +<tr> +<td>Time</td> +<td>O(2^n)</td> +<td>O(n)</td> +</tr> +<tr> +<td>Space</td> +<td>O(n)</td> +<td>O(n)</td> +</tr> +</tbody> +</table> +<p>참고 : <a class="link" href="https://towardsdatascience.com/dynamic-programming-i-python-8b20387870f5" target="_blank" rel="noopener" + >Recursion vs Dynamic Programming - Fibonacci</a></p> +<p><strong>EX2)</strong> <em>knapsack problem</em><br> +weight / value를 가진 여러 물건이 있을 때, weight 제한이 있는 베낭에 value의 합이 가장 높도록 물건을 골라 담는 문제</p> +<br> +<h4 id="n으로-표현-문제-풀이">&lt;N으로 표현&gt; 문제 풀이</h4> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span><span class="lnt">14 +</span><span class="lnt">15 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">solution</span><span class="p">(</span><span class="n">N</span><span class="p">,</span> <span class="n">number</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">strN</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">N</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># 직관적인 코드를 위해 다음과 같이 index : 1~8 사용 설정 (index 0은 사용하지 않음)</span> +</span></span><span class="line"><span class="cl"> <span class="n">numberUsed</span> <span class="o">=</span> <span class="p">[{}</span> <span class="k">for</span> <span class="n">_</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">9</span><span class="p">)]</span> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">9</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">numberUsed</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span><span class="nb">int</span><span class="p">(</span><span class="n">strN</span> <span class="o">*</span> <span class="p">(</span><span class="n">i</span><span class="p">))}</span> <span class="c1"># N을 i번 나열한 숫자 ex) 555, 7777, ...</span> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">j</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span> <span class="p">,</span> <span class="n">i</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">n1</span> <span class="ow">in</span> <span class="n">numberUsed</span><span class="p">[</span><span class="n">j</span><span class="p">]:</span> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">n2</span> <span class="ow">in</span> <span class="n">numberUsed</span><span class="p">[</span><span class="n">i</span><span class="o">-</span><span class="n">j</span><span class="p">]:</span> +</span></span><span class="line"><span class="cl"> <span class="n">newNumbers</span> <span class="o">=</span> <span class="p">[</span><span class="n">n1</span><span class="o">*</span><span class="n">n2</span><span class="p">,</span> <span class="n">n1</span><span class="o">+</span><span class="n">n2</span><span class="p">,</span> <span class="n">n1</span><span class="o">-</span><span class="n">n2</span><span class="p">]</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">n2</span> <span class="o">!=</span> <span class="mi">0</span> <span class="p">:</span> <span class="n">newNumbers</span><span class="o">.</span><span class="n">append</span><span class="p">(</span> <span class="n">n1</span><span class="o">//</span><span class="n">n2</span> <span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="n">numberUsed</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">newNumbers</span><span class="p">)</span> <span class="c1">#set1.update(set2) 사용하여 원소 추가. set 아닌 list를 넘겨줄수도 있다.</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">number</span> <span class="ow">in</span> <span class="n">numberUsed</span><span class="p">[</span><span class="n">i</span><span class="p">]:</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">i</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="o">-</span><span class="mi">1</span> +</span></span></code></pre></td></tr></table> +</div> +</div><br> +<h3 id="span-stylecolord0e7d2dfs--bfsspan"><span style="color:#D0E7D2">DFS &amp; BFS</span></h3> +<h4 id="1-depth-first-search">1. Depth First Search</h4> +<blockquote> +<p>한 vertex에서 인접한 모든 vertex를 방문할 때, 인접한 vertex를 기준으로 <code>깊이 우선 탐색</code>을 끝낸 후 다음 vertex로 진행하는 방식<br> +<code>스택</code>을 이용하여 어느 정점에서 DFS를 진행하고 있는지를 기억</p> +</blockquote> +<h4 id="2-breadth-first-search">2. Breadth First Search</h4> +<blockquote> +<p>한 vertex에서 인접한 모든 vertex를 방문하고, 방문한 인접 vertex를 기준으로 <code>너비 우선 탐색</code>을 진행하는 방식</p> +</blockquote> +<h4 id="3-graph">3. Graph</h4> +<blockquote> +<p>-vertex(=node) &amp; edge(=link)<br> +-directed / undirected graph</p> +</blockquote> +<h4 id="여행-경로-문제-풀이">&lt;여행 경로&gt; 문제 풀이</h4> +<p>DFS를 응용한 재귀 한 붓 그리기</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span><span class="lnt">14 +</span><span class="lnt">15 +</span><span class="lnt">16 +</span><span class="lnt">17 +</span><span class="lnt">18 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">solution</span><span class="p">(</span><span class="n">tickets</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">routes</span> <span class="o">=</span> <span class="p">{}</span> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="ow">in</span> <span class="n">tickets</span><span class="p">:</span> <span class="c1">#출발지, 도착지</span> +</span></span><span class="line"><span class="cl"> <span class="n">routes</span><span class="p">[</span><span class="n">a</span><span class="p">]</span> <span class="o">=</span> <span class="n">routes</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="p">[])</span> +</span></span><span class="line"><span class="cl"> <span class="n">routes</span><span class="p">[</span><span class="n">a</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">b</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">r</span> <span class="ow">in</span> <span class="n">routes</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">routes</span><span class="p">[</span><span class="n">r</span><span class="p">]</span><span class="o">.</span><span class="n">sort</span><span class="p">(</span><span class="n">reverse</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># 역순인 이유? 파이썬의 데이터 삭제 과정을 살펴보면 뒤에서 뽑는게 더 효울적이기 때문 </span> +</span></span><span class="line"><span class="cl"> <span class="n">stack</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&#34;ICN&#34;</span><span class="p">]</span> +</span></span><span class="line"><span class="cl"> <span class="n">path</span> <span class="o">=</span> <span class="p">[]</span> +</span></span><span class="line"><span class="cl"> <span class="k">while</span> <span class="mi">0</span> <span class="o">&lt;</span> <span class="nb">len</span><span class="p">(</span><span class="n">stack</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">top</span> <span class="o">=</span> <span class="n">stack</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">top</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">routes</span> <span class="ow">or</span> <span class="nb">len</span><span class="p">(</span><span class="n">routes</span><span class="p">[</span><span class="n">top</span><span class="p">])</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span> <span class="c1"># 이 공항에서 떠나는 티켓이 존재하지 않음</span> +</span></span><span class="line"><span class="cl"> <span class="n">path</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">stack</span><span class="o">.</span><span class="n">pop</span><span class="p">())</span> +</span></span><span class="line"><span class="cl"> <span class="k">else</span> <span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">stack</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">routes</span><span class="p">[</span><span class="n">top</span><span class="p">]</span><span class="o">.</span><span class="n">pop</span><span class="p">())</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">path</span><span class="p">[::</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> +</span></span></code></pre></td></tr></table> +</div> +</div><br> +<h3 id="span-stylecolord0e7d2추가-문제풀이span"><span style="color:#D0E7D2">추가 문제풀이</span></h3> +<details> +<summary>문제 링크 모음(많이 김)</summary> +<!-- summary 아래 한칸 공백 두어야함 --> +<br> +프로그래머스 코딩테스트 문제 링크 (코스에 있는 문제여도 프로그래머스 코테 링크로 적음) +<ul> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/42576" target="_blank" rel="noopener" + >완주하지 못한 사람</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/12909" target="_blank" rel="noopener" + >올바른 괄호</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/49993" target="_blank" rel="noopener" + >스킬트리</a> +<br></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/12978" target="_blank" rel="noopener" + >배달</a> +<br></li> +<li>[세 소수의 합]</li> +<li>[주사위 게임]</li> +<li><a class="link" href="https://school.programmers.co.kr/app/courses/19071/curriculum/lessons/236812" target="_blank" rel="noopener" + >사탕 담기</a> +<br></li> +<li>[빙고]</li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/49994" target="_blank" rel="noopener" + >방문 길이</a></li> +<li>[쇠막대기]</li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/60059" target="_blank" rel="noopener" + >자물쇠와 열쇠</a> +<br></li> +<li>[게임 아이템] +<br></li> +<li><a class="link" href="https://school.programmers.co.kr/app/courses/19071/curriculum/lessons/236806" target="_blank" rel="noopener" + >기능개발</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/42626" target="_blank" rel="noopener" + >더 맵게</a></li> +<li>[배상 비용 최소화]</li> +<li>[문자열 압축 코드] +<br></li> +<li><a class="link" href="https://school.programmers.co.kr/app/courses/19071/curriculum/lessons/236811" target="_blank" rel="noopener" + >카펫</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/12982" target="_blank" rel="noopener" + >예산</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/12952" target="_blank" rel="noopener" + >N-Queen</a></li> +<li>[버스 여행] +<br></li> +<li><a class="link" href="https://school.programmers.co.kr/app/courses/19071/curriculum/lessons/236805" target="_blank" rel="noopener" + >예산_소팅</a></li> +<li><a class="link" href="https://school.programmers.co.kr/app/courses/19071/curriculum/lessons/236808" target="_blank" rel="noopener" + >최솟값 만들기</a></li> +<li><a class="link" href="https://school.programmers.co.kr/app/courses/19071/curriculum/lessons/236807" target="_blank" rel="noopener" + >가장 큰 수</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/42895" target="_blank" rel="noopener" + >N으로 표현</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/12900" target="_blank" rel="noopener" + >2 x n 타일링</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/42898" target="_blank" rel="noopener" + >등굣길</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/12904" target="_blank" rel="noopener" + >가장 긴 팰린드롬</a> +<br></li> +</ul> +</details> +<h2 id="span-stylecolorb0d9b1checkspan">👀 <strong><span style="color:#B0D9B1">CHECK</span></strong></h2> +<h6 id="어렵거나-새롭게-알게-된-것-등-다시-확인할-것들"><em>(어렵거나 새롭게 알게 된 것 등 다시 확인할 것들)</em></h6> +<h4 id="pep-8">PEP 8</h4> +<p>파이썬이 추구하는 코드 스타일. 들여쓰기, 공백, 변수명 작성 규칙 등이 포함된다.</p> +<ul> +<li><a class="link" href="https://peps.python.org/pep-0008/" target="_blank" rel="noopener" + >PEP 8 - Style Guide for Python Code(공식 문서)</a></li> +<li><a class="link" href="https://wayhome25.github.io/python/2017/05/04/pep8/" target="_blank" rel="noopener" + >PEP8 스타일 가이드를 설명하는 블로그(한국어)</a></li> +</ul> +<h4 id="tim-sort">Tim sort</h4> +<p>Insertion sort + Merge sort</p> +<ul> +<li>Insertion sort는 <code>n이 작을 때</code> (Quick sort보다도) 빠름</li> +<li>전체를 작은 덩어리로 잘라 Insertion sort -&gt; Merge</li> +<li><a class="link" href="https://d2.naver.com/helloworld/0315536" target="_blank" rel="noopener" + >Tim sort에 대해 설명하는 글</a></li> +</ul> +<h4 id="dp-익숙해지기">DP 익숙해지기</h4> +<ul> +<li>knapsack problem 등 문제풀이를 통해 익숙해지기</li> +</ul> +<h2 id="span-stylecolorb0d9b1느낀-점span">❗ <strong><span style="color:#B0D9B1">느낀 점</span></strong></h2> +<p>오늘은 DP(Dynamic Programming)과 DFS&amp;BFS의 개념에 대해 가볍게 배우고, 문제풀이를 위주로 강의가 진행되었다.</p> +<p>아는 알고리즘들이고 어제 강의의 문제가 나에겐 어렵지 않았기 때문에, 해설 강의를 듣기 전에 문제를 먼저 풀어 보았다. 문제를 풀다가 막히는 부분이 있으면 강의를 틀고, 해결되면 멈추고 다시 풀어보곤 했다.<br> +Heap 문제를 제외한 두 문제는 해설 없이 풀었고, Heap 문제도 heapq 라이브러리를 사용해야하는 것을 깨닫고는 금방 풀 수 있었다.</p> +<p>이번주 강의를 듣고 문제를 풀면서 느낀점이 몇개 있다.</p> +<ol> +<li> +<p>나는 알고리즘 자체는 꽤 잘 알고 활용도 잘 하는 편이지만 라이브러리 사용에 있어서 소극적인 면이 있다. 문제를 풀 때 파이썬 표준 라이브러리조차도 잘 import하지 않고 Dictionary나 Set정도만 사용하는 편이었다. <em>(Heap도 자체적으로 구현하거나 list를 사용하곤 했는데 왜 이런 습관이 들었는지는 잘 모르겠다.)</em> <br> +이번 강의를 들으면서 표준 라이브러리에 있는 여러 데이터형을 활용했고 다음에 문제를 풀 때도 적극적으로 활용하면서 더 효과적인 코드를 작성하는데 가까워지려고 한다.</p> +</li> +<li> +<p>나는 CS 용어를 잘 모른다. 아예 모른다는게 아니라, 많이 헷갈리며 정확한 명칭을 찾아보지 않았다는 의미이다. member method, list comprehension 등 용어들은 분명 내가 궁금해서 찾아봤지만 아직도 헷갈리거나 명칭 자체를 몰랐던 것들이다. 강의를 통해 명확해지거나 새롭게 알게 된 용어들이 있어서 좋았고, 이제부터는 모르는 부분에 대해 검색할 때는 아예 용어와 그 정의부터 찾는것부터 시작해야겠다고 다짐했다.</p> +</li> +</ol> +<p>내일은 강의가 없는 날이다. 하지만 해야 할 일들은 있다. 오늘까지 배운걸 복습하고, 배운 자료구조와 알고리즘을 활용하는 문제들을 lv3정도로 풀어 볼 것이다. 내일도 화이팅!!</p> + + + + + diff --git a/public/tags/emoji/page/1/index.html b/public/tags/dp/page/1/index.html similarity index 69% rename from public/tags/emoji/page/1/index.html rename to public/tags/dp/page/1/index.html index 6a9cb35..d1c9667 100644 --- a/public/tags/emoji/page/1/index.html +++ b/public/tags/dp/page/1/index.html @@ -1,10 +1,10 @@ - + - https://srlee056.github.io/tags/emoji/ - + https://srlee056.github.io/tags/dp/ + - + diff --git a/public/tags/emoji/index.xml b/public/tags/emoji/index.xml deleted file mode 100644 index 97ccbbd..0000000 --- a/public/tags/emoji/index.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - emoji on Seorim Log - https://srlee056.github.io/tags/emoji/ - Recent content in emoji on Seorim Log - Hugo -- gohugo.io - en - Seorim Lee - Tue, 05 Mar 2019 00:00:00 +0000 - Emoji Support - https://srlee056.github.io/p/emoji-support/ - Tue, 05 Mar 2019 00:00:00 +0000 - - https://srlee056.github.io/p/emoji-support/ - <img src="https://srlee056.github.io/p/emoji-support/the-creative-exchange-d2zvqp3fpro-unsplash.jpg" alt="Featured image of post Emoji Support" /><p>Emoji can be enabled in a Hugo project in a number of ways.</p> -<p>The <a class="link" href="https://gohugo.io/functions/emojify/" target="_blank" rel="noopener" - ><code>emojify</code></a> function can be called directly in templates or <a class="link" href="https://gohugo.io/templates/shortcode-templates/#inline-shortcodes" target="_blank" rel="noopener" - >Inline Shortcodes</a>.</p> -<p>To enable emoji globally, set <code>enableEmoji</code> to <code>true</code> in your site&rsquo;s <a class="link" href="https://gohugo.io/getting-started/configuration/" target="_blank" rel="noopener" - >configuration</a> and then you can type emoji shorthand codes directly in content files; e.g.</p> -<p><span class="nowrap"><span class="emojify">🙈</span> <code>:see_no_evil:</code></span> <span class="nowrap"><span class="emojify">🙉</span> <code>:hear_no_evil:</code></span> <span class="nowrap"><span class="emojify">🙊</span> <code>:speak_no_evil:</code></span></p> -<br> -<p>The <a class="link" href="http://www.emoji-cheat-sheet.com/" target="_blank" rel="noopener" - >Emoji cheat sheet</a> is a useful reference for emoji shorthand codes.</p> -<hr> -<p><strong>N.B.</strong> The above steps enable Unicode Standard emoji characters and sequences in Hugo, however the rendering of these glyphs depends on the browser and the platform. To style the emoji you can either use a third party emoji font or a font stack; e.g.</p> -<div class="highlight"><div class="chroma"> -<table class="lntable"><tr><td class="lntd"> -<pre tabindex="0" class="chroma"><code><span class="lnt">1 -</span><span class="lnt">2 -</span><span class="lnt">3 -</span></code></pre></td> -<td class="lntd"> -<pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl">.emoji { -</span></span><span class="line"><span class="cl"> font-family: Apple Color Emoji, Segoe UI Emoji, NotoColorEmoji, Segoe UI Symbol, Android Emoji, EmojiSymbols; -</span></span><span class="line"><span class="cl">}</span></span></code></pre></td></tr></table> -</div> -</div> - - - - diff --git a/public/tags/emoji/index.html b/public/tags/github-pages/index.html similarity index 78% rename from public/tags/emoji/index.html rename to public/tags/github-pages/index.html index 6f2b650..a43f6a7 100644 --- a/public/tags/emoji/index.html +++ b/public/tags/github-pages/index.html @@ -1,18 +1,20 @@ - + - -Tag: emoji - Seorim Log - - - - - - - - - - + +Tag: Github Pages - 서림록 + + + + + + + + + + + +
@@ -270,10 +268,10 @@

좋은 개발자로 한걸음 더

- - + + - + +

+ + +
+ + + + + + + + + + + + 🤩 + +
+ + + +
+

서림록

+

좋은 개발자로 한걸음 더

+
+
+ + +
+ + +
+
+

+ + Tags + +

+ +
+
+

1 페이지

+

Greedy

+ +
+
+
+ +
+ + + +
+
+ + +
+ Hugo로 만듦
+ JimmyStack 테마 사용 중 +
+
+ + +
+ + + + + + diff --git a/public/tags/greedy/index.xml b/public/tags/greedy/index.xml new file mode 100644 index 0000000..2e1c8e7 --- /dev/null +++ b/public/tags/greedy/index.xml @@ -0,0 +1,206 @@ + + + + Greedy on 서림록 + https://srlee056.github.io/tags/greedy/ + Recent content in Greedy on 서림록 + Hugo -- gohugo.io + ko + Seorim Lee + Thu, 19 Oct 2023 00:00:00 +0000 + Day 4 + https://srlee056.github.io/p/day-4/ + Thu, 19 Oct 2023 00:00:00 +0000 + + https://srlee056.github.io/p/day-4/ + <h1 id="span-stylecolor79ac78til---hash--greedy--sort-문제풀이-위주span"><strong><span style="color:#79AC78">TIL - Hash / Greedy &amp; Sort (문제풀이 위주)</span></strong></h1> +<h2 id="span-stylecolorb0d9b1공부-내용span">📋 <strong><span style="color:#B0D9B1">공부 내용</span></strong></h2> +<h3 id="span-stylecolord0e7d2hashspan"><span style="color:#D0E7D2">Hash</span></h3> +<ul> +<li> +<p>Hash?<br> +개념 정리가 필요하다고 느껴서 글을 따로 발행했다.</p> +<ul> +<li> +<p><a class="link" href="https://www.baeldung.com/cs/hash-tables" target="_blank" rel="noopener" + >Understanding Hash Table</a></p> +</li> +<li> +<p><a class="link" href="https://velog.io/@srlee056/Hash-Table-%EC%9D%B4%ED%95%B4%ED%95%98%EA%B8%B0" target="_blank" rel="noopener" + >(번역 및 정리)Hash Table 이해하기</a></p> +</li> +</ul> +</li> +<li> +<p><code>완주하지 못한 선수</code> 문제풀이</p> +<ul> +<li>python dictionary 를 활용하여 hasing 구현</li> +</ul> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">solution</span><span class="p">(</span><span class="n">participant</span><span class="p">,</span> <span class="n">completion</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">answer</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span> +</span></span><span class="line"><span class="cl"> <span class="n">pDict</span> <span class="o">=</span> <span class="p">{}</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># 참가자/ 완주자 정보가 주어질 때, 이름을 key로 활용하여 dictionary 형태에 넣고 빼는 방식으로</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># (동명이인이 있을 때에도) 어떤 이름을 가진 사람이 완주를 하지 못했는지 확인할 수 있다. </span> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">participant</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">pDict</span><span class="p">[</span><span class="n">p</span><span class="p">]</span> <span class="o">=</span> <span class="n">pDict</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> <span class="o">+</span> <span class="mi">1</span> <span class="c1">#.get()을 통해 default 값을 세팅하는 한 방법</span> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">completion</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">pDict</span><span class="p">[</span><span class="n">p</span><span class="p">]</span> <span class="o">-=</span> <span class="mi">1</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="n">incompletion</span> <span class="o">=</span> <span class="p">[</span><span class="n">k</span> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">pDict</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> <span class="k">if</span> <span class="n">v</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">]</span> +</span></span><span class="line"><span class="cl"> <span class="n">answer</span> <span class="o">=</span> <span class="n">incompletion</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">answer</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +</ul> +<h3 id="span-stylecolord0e7d2greedy-algorithmspan"><span style="color:#D0E7D2">Greedy Algorithm</span></h3> +<ul> +<li> +<p>탐욕법(greedy algorithm)</p> +<ul> +<li>알고리즘의 각 단계에서 <strong>그 순간의 최적의 선택</strong>을 함</li> +<li>탐욕법으로 최적해를 찾을 수 있는 문제<br> += 현재 선택이 마지막 답의 최적성을 해치지 않는 문제</li> +</ul> +</li> +<li> +<p><code>체육복</code> 문제풀이</p> +<ul> +<li>비슷해보이는 조건문이라해도 그 순서에 따라 전혀 다른 결과가 나올 수 있음</li> +<li>작은 번호부터 큰 번호로 순회하기 때문에, 작은 번호가 조건을 만족하는지 먼저 고려함</li> +</ul> +</li> +<li> +<p><code>큰 수 만들기</code> 문제풀이</p> +<ul> +<li>매 단계마다 작은 숫자를 지우는 탐욕법을 사용하며, 이 방식은 마지막에 최적성을 충족하게 됨</li> +</ul> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span><span class="lnt">14 +</span><span class="lnt">15 +</span><span class="lnt">16 +</span><span class="lnt">17 +</span><span class="lnt">18 +</span><span class="lnt">19 +</span><span class="lnt">20 +</span><span class="lnt">21 +</span><span class="lnt">22 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">solution</span><span class="p">(</span><span class="n">number</span><span class="p">,</span> <span class="n">k</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">collected</span> <span class="o">=</span> <span class="p">[]</span> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">num</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">number</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># collected에 미리 들어간 원소가 있을 것</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># 제일 마지막으로 들어간 원소는 현재 num 값보다 작을 것</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># (제거해야 하는 숫자의 개수) k가 0보다 클 것</span> +</span></span><span class="line"><span class="cl"> <span class="k">while</span> <span class="nb">len</span><span class="p">(</span><span class="n">collected</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="ow">and</span> <span class="n">collected</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">&lt;</span> <span class="n">num</span> <span class="ow">and</span> <span class="n">k</span> <span class="o">&gt;</span><span class="mi">0</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">collected</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> +</span></span><span class="line"><span class="cl"> <span class="n">k</span> <span class="o">-=</span><span class="mi">1</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">k</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">collected</span> <span class="o">+=</span> <span class="nb">list</span><span class="p">(</span><span class="n">number</span><span class="p">[</span><span class="n">i</span><span class="p">:])</span> +</span></span><span class="line"><span class="cl"> <span class="k">break</span> +</span></span><span class="line"><span class="cl"> <span class="n">collected</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">num</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="c1"># 제거해야 하는 숫자의 개수가 남아있을 때 </span> +</span></span><span class="line"><span class="cl"> <span class="c1"># (코드가 너무 직관적이고 예뻤다. :&gt;)</span> +</span></span><span class="line"><span class="cl"> <span class="n">collected</span> <span class="o">=</span> <span class="n">collected</span><span class="p">[:</span><span class="o">-</span><span class="n">k</span><span class="p">]</span> <span class="k">if</span> <span class="n">k</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="k">else</span> <span class="n">collected</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="n">answer</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">collected</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">answer</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +</ul> +<h3 id="span-stylecolord0e7d2sortspan"><span style="color:#D0E7D2">Sort</span></h3> +<ul> +<li><code>가장 큰 수</code> 문제풀이 +<ul> +<li>자릿수가 다른 숫자들을 문자열처럼 나열하여 더 큰 숫자를 만들 때, 숫자들의 우선순위를 정하는 방법은?</li> +</ul> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span><span class="lnt">5 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">sortedNumbers</span> <span class="o">=</span> <span class="nb">sorted</span><span class="p">(</span><span class="nb">map</span><span class="p">(</span><span class="nb">str</span><span class="p">,</span> <span class="n">numbers</span><span class="p">),</span> <span class="n">key</span> <span class="o">=</span> <span class="k">lambda</span> <span class="n">x</span> <span class="p">:</span> <span class="p">(</span><span class="n">x</span> <span class="o">*</span> <span class="mi">4</span><span class="p">)[:</span><span class="mi">4</span><span class="p">],</span> <span class="n">reverse</span> <span class="o">=</span> <span class="kc">True</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"><span class="c1"># map(str, numbers) : numbers 정수 리스트를 문자열 리스트로 변환</span> +</span></span><span class="line"><span class="cl"><span class="c1"># sorted(..., reverse = True) : 주어진 조건으로 정렬하며, 내림차순으로 반환</span> +</span></span><span class="line"><span class="cl"><span class="c1"># lambda x : (x*4)[:4] : 네 자리 수까지 주어지므로 4번 반복 후 네번째자리까지 끊음</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +</ul> +<h2 id="span-stylecolorb0d9b1checkspan">👀 <strong><span style="color:#B0D9B1">CHECK</span></strong></h2> +<h6 id="어렵거나-새롭게-알게-된-것-등-다시-확인할-것들"><em>(어렵거나 새롭게 알게 된 것 등 다시 확인할 것들)</em></h6> +<ul> +<li> +<p>Hash</p> +<ul> +<li>가볍게 정리했지만 더 자세하게 찾아보고 싶음 (활용되는 곳, 특성을 구현하는 법, hashing function, collision 등)</li> +</ul> +</li> +<li> +<p>list comprehension</p> +<ul> +<li>한 줄에 반복문 할당 배열생성 등이 한번에 일어남</li> +<li><a class="link" href="https://shoark7.github.io/programming/python/about-list-comprehension-python" target="_blank" rel="noopener" + >list comprehension 설명 블로그 글</a></li> +<li>쓸 줄 아는 방식이지만 용어를 처음 알게 됨 (예전에 배우고 까먹은 게 분명)</li> +</ul> +</li> +<li> +<p>list slicing 에 바로 대입하여 직관적으로 코드 작성 가능</p> +<ul> +<li>EX) list[1:3] = [1, 2]</li> +</ul> +</li> +</ul> +<h2 id="span-stylecolorb0d9b1느낀-점span">❗ <strong><span style="color:#B0D9B1">느낀 점</span></strong></h2> +<p>어제 더 나은 코드를 위해 어떤점을 고려해야하는지 많은 고민을 했는데, 오늘 강의에서 그 부분을 짚어줘서 좋았다.</p> +<p>오늘은 각 알고리즘이나 자료구조에 대한 설명보다는 문제 풀이와 해설을 위주로 강의가 진행되었는데, 그래서 나 스스로 그 개념에 대해 찾아보고 정리하는 시간이 필요했다. greedy나 sort는 이미 잘 알고 있는 부분이지만 hash는 헷갈리는 부분이 있어서 블로그와 document를 읽어보면서 글로 정리하는 시간을 가졌다.</p> +<p>깊이가 정해져있지 않다 보니 원하는 만큼 궁금해하고 파헤칠 수 있었지만, 내가 그 내용을 받아들이고 정리할 수 있는가는 별개의 문제임을 깨달았다. hash를 설명하는 블로그 글에 연결된 링크를 타고 여러 글을 읽어가다 보니, 어느새 encoding&amp;decoding, scheduling에 대한 글을 읽고 있었다. 이런 글들을 읽고 어느정도 이해할 수는 있었지만, 글로 정리하거나 그 사이의 관계를 명확하게 아는것은 큰 차이가 있었고, 머리속이 혼란스러웠다. 어떤 주제와 관련된 내용을 잘 찾고 정리하는것도 많은 노력이 필요하다는 걸 새삼 느끼는 순간이었다.</p> +<p>오늘처럼 깊이가 없는 공부를 해야하는 순간은 계속 있을것이고(있어왔고), 정해진 주제에 대해 찾아본 내용들을 글로 정리하면서 나만의 기준을 정립해야겠다는 결론을 내렸다.</p> +<p>+) 퇴고하기 위해 글을 읽어보는데 두서없고 추상적이라 맘에 들지 않음..(ㅠㅠ) 문장력을 키우고 싶은데 온라인으로도 필사할 수 있는지 찾아봐야겠다.</p> + + + + + diff --git a/public/tags/greedy/page/1/index.html b/public/tags/greedy/page/1/index.html new file mode 100644 index 0000000..5bc8c80 --- /dev/null +++ b/public/tags/greedy/page/1/index.html @@ -0,0 +1,10 @@ + + + + https://srlee056.github.io/tags/greedy/ + + + + + + diff --git a/public/tags/hash/index.html b/public/tags/hash/index.html new file mode 100644 index 0000000..4dc4436 --- /dev/null +++ b/public/tags/hash/index.html @@ -0,0 +1,479 @@ + + + + +Tag: Hash - 서림록 + + + + + + + + + + + + + + + +
+ + + + +
+
+

+ + Tags + +

+ +
+
+

1 페이지

+

Hash

+ +
+
+
+ +
+ + + +
+
+ + +
+ Hugo로 만듦
+ JimmyStack 테마 사용 중 +
+
+ + +
+
+ + + + + diff --git a/public/tags/hash/index.xml b/public/tags/hash/index.xml new file mode 100644 index 0000000..09ab902 --- /dev/null +++ b/public/tags/hash/index.xml @@ -0,0 +1,206 @@ + + + + Hash on 서림록 + https://srlee056.github.io/tags/hash/ + Recent content in Hash on 서림록 + Hugo -- gohugo.io + ko + Seorim Lee + Thu, 19 Oct 2023 00:00:00 +0000 + Day 4 + https://srlee056.github.io/p/day-4/ + Thu, 19 Oct 2023 00:00:00 +0000 + + https://srlee056.github.io/p/day-4/ + <h1 id="span-stylecolor79ac78til---hash--greedy--sort-문제풀이-위주span"><strong><span style="color:#79AC78">TIL - Hash / Greedy &amp; Sort (문제풀이 위주)</span></strong></h1> +<h2 id="span-stylecolorb0d9b1공부-내용span">📋 <strong><span style="color:#B0D9B1">공부 내용</span></strong></h2> +<h3 id="span-stylecolord0e7d2hashspan"><span style="color:#D0E7D2">Hash</span></h3> +<ul> +<li> +<p>Hash?<br> +개념 정리가 필요하다고 느껴서 글을 따로 발행했다.</p> +<ul> +<li> +<p><a class="link" href="https://www.baeldung.com/cs/hash-tables" target="_blank" rel="noopener" + >Understanding Hash Table</a></p> +</li> +<li> +<p><a class="link" href="https://velog.io/@srlee056/Hash-Table-%EC%9D%B4%ED%95%B4%ED%95%98%EA%B8%B0" target="_blank" rel="noopener" + >(번역 및 정리)Hash Table 이해하기</a></p> +</li> +</ul> +</li> +<li> +<p><code>완주하지 못한 선수</code> 문제풀이</p> +<ul> +<li>python dictionary 를 활용하여 hasing 구현</li> +</ul> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">solution</span><span class="p">(</span><span class="n">participant</span><span class="p">,</span> <span class="n">completion</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">answer</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span> +</span></span><span class="line"><span class="cl"> <span class="n">pDict</span> <span class="o">=</span> <span class="p">{}</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># 참가자/ 완주자 정보가 주어질 때, 이름을 key로 활용하여 dictionary 형태에 넣고 빼는 방식으로</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># (동명이인이 있을 때에도) 어떤 이름을 가진 사람이 완주를 하지 못했는지 확인할 수 있다. </span> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">participant</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">pDict</span><span class="p">[</span><span class="n">p</span><span class="p">]</span> <span class="o">=</span> <span class="n">pDict</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> <span class="o">+</span> <span class="mi">1</span> <span class="c1">#.get()을 통해 default 값을 세팅하는 한 방법</span> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">completion</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">pDict</span><span class="p">[</span><span class="n">p</span><span class="p">]</span> <span class="o">-=</span> <span class="mi">1</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="n">incompletion</span> <span class="o">=</span> <span class="p">[</span><span class="n">k</span> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">pDict</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> <span class="k">if</span> <span class="n">v</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">]</span> +</span></span><span class="line"><span class="cl"> <span class="n">answer</span> <span class="o">=</span> <span class="n">incompletion</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">answer</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +</ul> +<h3 id="span-stylecolord0e7d2greedy-algorithmspan"><span style="color:#D0E7D2">Greedy Algorithm</span></h3> +<ul> +<li> +<p>탐욕법(greedy algorithm)</p> +<ul> +<li>알고리즘의 각 단계에서 <strong>그 순간의 최적의 선택</strong>을 함</li> +<li>탐욕법으로 최적해를 찾을 수 있는 문제<br> += 현재 선택이 마지막 답의 최적성을 해치지 않는 문제</li> +</ul> +</li> +<li> +<p><code>체육복</code> 문제풀이</p> +<ul> +<li>비슷해보이는 조건문이라해도 그 순서에 따라 전혀 다른 결과가 나올 수 있음</li> +<li>작은 번호부터 큰 번호로 순회하기 때문에, 작은 번호가 조건을 만족하는지 먼저 고려함</li> +</ul> +</li> +<li> +<p><code>큰 수 만들기</code> 문제풀이</p> +<ul> +<li>매 단계마다 작은 숫자를 지우는 탐욕법을 사용하며, 이 방식은 마지막에 최적성을 충족하게 됨</li> +</ul> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span><span class="lnt">14 +</span><span class="lnt">15 +</span><span class="lnt">16 +</span><span class="lnt">17 +</span><span class="lnt">18 +</span><span class="lnt">19 +</span><span class="lnt">20 +</span><span class="lnt">21 +</span><span class="lnt">22 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">solution</span><span class="p">(</span><span class="n">number</span><span class="p">,</span> <span class="n">k</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">collected</span> <span class="o">=</span> <span class="p">[]</span> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">num</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">number</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># collected에 미리 들어간 원소가 있을 것</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># 제일 마지막으로 들어간 원소는 현재 num 값보다 작을 것</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># (제거해야 하는 숫자의 개수) k가 0보다 클 것</span> +</span></span><span class="line"><span class="cl"> <span class="k">while</span> <span class="nb">len</span><span class="p">(</span><span class="n">collected</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="ow">and</span> <span class="n">collected</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">&lt;</span> <span class="n">num</span> <span class="ow">and</span> <span class="n">k</span> <span class="o">&gt;</span><span class="mi">0</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">collected</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> +</span></span><span class="line"><span class="cl"> <span class="n">k</span> <span class="o">-=</span><span class="mi">1</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">k</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">collected</span> <span class="o">+=</span> <span class="nb">list</span><span class="p">(</span><span class="n">number</span><span class="p">[</span><span class="n">i</span><span class="p">:])</span> +</span></span><span class="line"><span class="cl"> <span class="k">break</span> +</span></span><span class="line"><span class="cl"> <span class="n">collected</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">num</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="c1"># 제거해야 하는 숫자의 개수가 남아있을 때 </span> +</span></span><span class="line"><span class="cl"> <span class="c1"># (코드가 너무 직관적이고 예뻤다. :&gt;)</span> +</span></span><span class="line"><span class="cl"> <span class="n">collected</span> <span class="o">=</span> <span class="n">collected</span><span class="p">[:</span><span class="o">-</span><span class="n">k</span><span class="p">]</span> <span class="k">if</span> <span class="n">k</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="k">else</span> <span class="n">collected</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="n">answer</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">collected</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">answer</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +</ul> +<h3 id="span-stylecolord0e7d2sortspan"><span style="color:#D0E7D2">Sort</span></h3> +<ul> +<li><code>가장 큰 수</code> 문제풀이 +<ul> +<li>자릿수가 다른 숫자들을 문자열처럼 나열하여 더 큰 숫자를 만들 때, 숫자들의 우선순위를 정하는 방법은?</li> +</ul> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span><span class="lnt">5 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">sortedNumbers</span> <span class="o">=</span> <span class="nb">sorted</span><span class="p">(</span><span class="nb">map</span><span class="p">(</span><span class="nb">str</span><span class="p">,</span> <span class="n">numbers</span><span class="p">),</span> <span class="n">key</span> <span class="o">=</span> <span class="k">lambda</span> <span class="n">x</span> <span class="p">:</span> <span class="p">(</span><span class="n">x</span> <span class="o">*</span> <span class="mi">4</span><span class="p">)[:</span><span class="mi">4</span><span class="p">],</span> <span class="n">reverse</span> <span class="o">=</span> <span class="kc">True</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"><span class="c1"># map(str, numbers) : numbers 정수 리스트를 문자열 리스트로 변환</span> +</span></span><span class="line"><span class="cl"><span class="c1"># sorted(..., reverse = True) : 주어진 조건으로 정렬하며, 내림차순으로 반환</span> +</span></span><span class="line"><span class="cl"><span class="c1"># lambda x : (x*4)[:4] : 네 자리 수까지 주어지므로 4번 반복 후 네번째자리까지 끊음</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +</ul> +<h2 id="span-stylecolorb0d9b1checkspan">👀 <strong><span style="color:#B0D9B1">CHECK</span></strong></h2> +<h6 id="어렵거나-새롭게-알게-된-것-등-다시-확인할-것들"><em>(어렵거나 새롭게 알게 된 것 등 다시 확인할 것들)</em></h6> +<ul> +<li> +<p>Hash</p> +<ul> +<li>가볍게 정리했지만 더 자세하게 찾아보고 싶음 (활용되는 곳, 특성을 구현하는 법, hashing function, collision 등)</li> +</ul> +</li> +<li> +<p>list comprehension</p> +<ul> +<li>한 줄에 반복문 할당 배열생성 등이 한번에 일어남</li> +<li><a class="link" href="https://shoark7.github.io/programming/python/about-list-comprehension-python" target="_blank" rel="noopener" + >list comprehension 설명 블로그 글</a></li> +<li>쓸 줄 아는 방식이지만 용어를 처음 알게 됨 (예전에 배우고 까먹은 게 분명)</li> +</ul> +</li> +<li> +<p>list slicing 에 바로 대입하여 직관적으로 코드 작성 가능</p> +<ul> +<li>EX) list[1:3] = [1, 2]</li> +</ul> +</li> +</ul> +<h2 id="span-stylecolorb0d9b1느낀-점span">❗ <strong><span style="color:#B0D9B1">느낀 점</span></strong></h2> +<p>어제 더 나은 코드를 위해 어떤점을 고려해야하는지 많은 고민을 했는데, 오늘 강의에서 그 부분을 짚어줘서 좋았다.</p> +<p>오늘은 각 알고리즘이나 자료구조에 대한 설명보다는 문제 풀이와 해설을 위주로 강의가 진행되었는데, 그래서 나 스스로 그 개념에 대해 찾아보고 정리하는 시간이 필요했다. greedy나 sort는 이미 잘 알고 있는 부분이지만 hash는 헷갈리는 부분이 있어서 블로그와 document를 읽어보면서 글로 정리하는 시간을 가졌다.</p> +<p>깊이가 정해져있지 않다 보니 원하는 만큼 궁금해하고 파헤칠 수 있었지만, 내가 그 내용을 받아들이고 정리할 수 있는가는 별개의 문제임을 깨달았다. hash를 설명하는 블로그 글에 연결된 링크를 타고 여러 글을 읽어가다 보니, 어느새 encoding&amp;decoding, scheduling에 대한 글을 읽고 있었다. 이런 글들을 읽고 어느정도 이해할 수는 있었지만, 글로 정리하거나 그 사이의 관계를 명확하게 아는것은 큰 차이가 있었고, 머리속이 혼란스러웠다. 어떤 주제와 관련된 내용을 잘 찾고 정리하는것도 많은 노력이 필요하다는 걸 새삼 느끼는 순간이었다.</p> +<p>오늘처럼 깊이가 없는 공부를 해야하는 순간은 계속 있을것이고(있어왔고), 정해진 주제에 대해 찾아본 내용들을 글로 정리하면서 나만의 기준을 정립해야겠다는 결론을 내렸다.</p> +<p>+) 퇴고하기 위해 글을 읽어보는데 두서없고 추상적이라 맘에 들지 않음..(ㅠㅠ) 문장력을 키우고 싶은데 온라인으로도 필사할 수 있는지 찾아봐야겠다.</p> + + + + + diff --git a/public/tags/hash/page/1/index.html b/public/tags/hash/page/1/index.html new file mode 100644 index 0000000..ca397a4 --- /dev/null +++ b/public/tags/hash/page/1/index.html @@ -0,0 +1,10 @@ + + + + https://srlee056.github.io/tags/hash/ + + + + + + diff --git a/public/tags/heap/index.html b/public/tags/heap/index.html new file mode 100644 index 0000000..ea32239 --- /dev/null +++ b/public/tags/heap/index.html @@ -0,0 +1,490 @@ + + + + +Tag: Heap - 서림록 + + + + + + + + + + + + + + + +
+ + + + +
+
+

+ + Tags + +

+ +
+
+

2 페이지

+

Heap

+ +
+
+
+ +
+ + + + + +
+
+ + +
+ Hugo로 만듦
+ JimmyStack 테마 사용 중 +
+
+ + +
+
+ + + + + diff --git a/public/tags/heap/index.xml b/public/tags/heap/index.xml new file mode 100644 index 0000000..aa0142c --- /dev/null +++ b/public/tags/heap/index.xml @@ -0,0 +1,556 @@ + + + + Heap on 서림록 + https://srlee056.github.io/tags/heap/ + Recent content in Heap on 서림록 + Hugo -- gohugo.io + ko + Seorim Lee + Fri, 20 Oct 2023 00:00:00 +0000 + Day 5 + https://srlee056.github.io/p/day-5/ + Fri, 20 Oct 2023 00:00:00 +0000 + + https://srlee056.github.io/p/day-5/ + <h1 id="span-stylecolor79ac78til---heap--dynamic-programming--dfsbfs-문제풀이-위주span"><strong><span style="color:#79AC78">TIL - Heap / Dynamic Programming / DFS&amp;BFS (문제풀이 위주)</span></strong></h1> +<h2 id="span-stylecolorb0d9b1공부-내용span">📋 <strong><span style="color:#B0D9B1">공부 내용</span></strong></h2> +<h3 id="span-stylecolord0e7d2heapspan"><span style="color:#D0E7D2">Heap</span></h3> +<hr> +<h4 id="더-맵게-문제-풀이">&lt;더 맵게&gt; 문제 풀이</h4> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span><span class="lnt">14 +</span><span class="lnt">15 +</span><span class="lnt">16 +</span><span class="lnt">17 +</span><span class="lnt">18 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">heapq</span> <span class="c1">#heap 라이브러리 사용</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">solution</span><span class="p">(</span><span class="n">scoville</span><span class="p">,</span> <span class="n">K</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">answer</span> <span class="o">=</span> <span class="mi">0</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># heapify, heappop, heappush 활용</span> +</span></span><span class="line"><span class="cl"> <span class="n">heapq</span><span class="o">.</span><span class="n">heapify</span><span class="p">(</span><span class="n">scoville</span><span class="p">)</span> <span class="c1">#min heap 구성</span> +</span></span><span class="line"><span class="cl"> <span class="k">while</span> <span class="kc">True</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">s1</span> <span class="o">=</span> <span class="n">heapq</span><span class="o">.</span><span class="n">heappop</span><span class="p">(</span><span class="n">scoville</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">s1</span> <span class="o">&gt;=</span> <span class="n">K</span> <span class="p">:</span> <span class="c1">#모든 스코빌 지수가 K이상</span> +</span></span><span class="line"><span class="cl"> <span class="k">break</span> +</span></span><span class="line"><span class="cl"> <span class="k">elif</span> <span class="nb">len</span><span class="p">(</span><span class="n">scoville</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span> <span class="c1"># K이상으로 만들 수 없는 경우</span> +</span></span><span class="line"><span class="cl"> <span class="n">answer</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span> +</span></span><span class="line"><span class="cl"> <span class="k">break</span> +</span></span><span class="line"><span class="cl"> <span class="n">s2</span> <span class="o">=</span> <span class="n">heapq</span><span class="o">.</span><span class="n">heappop</span><span class="p">(</span><span class="n">scoville</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="n">newS</span> <span class="o">=</span> <span class="n">s1</span> <span class="o">+</span> <span class="n">s2</span><span class="o">*</span><span class="mi">2</span> +</span></span><span class="line"><span class="cl"> <span class="n">heapq</span><span class="o">.</span><span class="n">heappush</span><span class="p">(</span><span class="n">scoville</span><span class="p">,</span><span class="n">newS</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="n">answer</span> <span class="o">+=</span> <span class="mi">1</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">answer</span> +</span></span></code></pre></td></tr></table> +</div> +</div><br> +<h3 id="span-stylecolord0e7d2dynamic-programmingspan"><span style="color:#D0E7D2">Dynamic Programming</span></h3> +<hr> +<h4 id="dpdynamic-programming">DP(Dynamic Programming)</h4> +<blockquote> +<p>알고리즘 진행에 따라 <code>탐색해야 할 범위를 동적으로 결정</code>하여 탐색 범위를 한정</p> +</blockquote> +<p><strong>EX1)</strong> <em>피보나치 수열</em></p> +<table> +<thead> +<tr> +<th>Complexity</th> +<th>재귀함수</th> +<th>DP</th> +</tr> +</thead> +<tbody> +<tr> +<td>Time</td> +<td>O(2^n)</td> +<td>O(n)</td> +</tr> +<tr> +<td>Space</td> +<td>O(n)</td> +<td>O(n)</td> +</tr> +</tbody> +</table> +<p>참고 : <a class="link" href="https://towardsdatascience.com/dynamic-programming-i-python-8b20387870f5" target="_blank" rel="noopener" + >Recursion vs Dynamic Programming - Fibonacci</a></p> +<p><strong>EX2)</strong> <em>knapsack problem</em><br> +weight / value를 가진 여러 물건이 있을 때, weight 제한이 있는 베낭에 value의 합이 가장 높도록 물건을 골라 담는 문제</p> +<br> +<h4 id="n으로-표현-문제-풀이">&lt;N으로 표현&gt; 문제 풀이</h4> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span><span class="lnt">14 +</span><span class="lnt">15 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">solution</span><span class="p">(</span><span class="n">N</span><span class="p">,</span> <span class="n">number</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">strN</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">N</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># 직관적인 코드를 위해 다음과 같이 index : 1~8 사용 설정 (index 0은 사용하지 않음)</span> +</span></span><span class="line"><span class="cl"> <span class="n">numberUsed</span> <span class="o">=</span> <span class="p">[{}</span> <span class="k">for</span> <span class="n">_</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">9</span><span class="p">)]</span> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">9</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">numberUsed</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span><span class="nb">int</span><span class="p">(</span><span class="n">strN</span> <span class="o">*</span> <span class="p">(</span><span class="n">i</span><span class="p">))}</span> <span class="c1"># N을 i번 나열한 숫자 ex) 555, 7777, ...</span> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">j</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span> <span class="p">,</span> <span class="n">i</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">n1</span> <span class="ow">in</span> <span class="n">numberUsed</span><span class="p">[</span><span class="n">j</span><span class="p">]:</span> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">n2</span> <span class="ow">in</span> <span class="n">numberUsed</span><span class="p">[</span><span class="n">i</span><span class="o">-</span><span class="n">j</span><span class="p">]:</span> +</span></span><span class="line"><span class="cl"> <span class="n">newNumbers</span> <span class="o">=</span> <span class="p">[</span><span class="n">n1</span><span class="o">*</span><span class="n">n2</span><span class="p">,</span> <span class="n">n1</span><span class="o">+</span><span class="n">n2</span><span class="p">,</span> <span class="n">n1</span><span class="o">-</span><span class="n">n2</span><span class="p">]</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">n2</span> <span class="o">!=</span> <span class="mi">0</span> <span class="p">:</span> <span class="n">newNumbers</span><span class="o">.</span><span class="n">append</span><span class="p">(</span> <span class="n">n1</span><span class="o">//</span><span class="n">n2</span> <span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="n">numberUsed</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">newNumbers</span><span class="p">)</span> <span class="c1">#set1.update(set2) 사용하여 원소 추가. set 아닌 list를 넘겨줄수도 있다.</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">number</span> <span class="ow">in</span> <span class="n">numberUsed</span><span class="p">[</span><span class="n">i</span><span class="p">]:</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">i</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="o">-</span><span class="mi">1</span> +</span></span></code></pre></td></tr></table> +</div> +</div><br> +<h3 id="span-stylecolord0e7d2dfs--bfsspan"><span style="color:#D0E7D2">DFS &amp; BFS</span></h3> +<h4 id="1-depth-first-search">1. Depth First Search</h4> +<blockquote> +<p>한 vertex에서 인접한 모든 vertex를 방문할 때, 인접한 vertex를 기준으로 <code>깊이 우선 탐색</code>을 끝낸 후 다음 vertex로 진행하는 방식<br> +<code>스택</code>을 이용하여 어느 정점에서 DFS를 진행하고 있는지를 기억</p> +</blockquote> +<h4 id="2-breadth-first-search">2. Breadth First Search</h4> +<blockquote> +<p>한 vertex에서 인접한 모든 vertex를 방문하고, 방문한 인접 vertex를 기준으로 <code>너비 우선 탐색</code>을 진행하는 방식</p> +</blockquote> +<h4 id="3-graph">3. Graph</h4> +<blockquote> +<p>-vertex(=node) &amp; edge(=link)<br> +-directed / undirected graph</p> +</blockquote> +<h4 id="여행-경로-문제-풀이">&lt;여행 경로&gt; 문제 풀이</h4> +<p>DFS를 응용한 재귀 한 붓 그리기</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span><span class="lnt">14 +</span><span class="lnt">15 +</span><span class="lnt">16 +</span><span class="lnt">17 +</span><span class="lnt">18 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">solution</span><span class="p">(</span><span class="n">tickets</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">routes</span> <span class="o">=</span> <span class="p">{}</span> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="ow">in</span> <span class="n">tickets</span><span class="p">:</span> <span class="c1">#출발지, 도착지</span> +</span></span><span class="line"><span class="cl"> <span class="n">routes</span><span class="p">[</span><span class="n">a</span><span class="p">]</span> <span class="o">=</span> <span class="n">routes</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="p">[])</span> +</span></span><span class="line"><span class="cl"> <span class="n">routes</span><span class="p">[</span><span class="n">a</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">b</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">r</span> <span class="ow">in</span> <span class="n">routes</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">routes</span><span class="p">[</span><span class="n">r</span><span class="p">]</span><span class="o">.</span><span class="n">sort</span><span class="p">(</span><span class="n">reverse</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># 역순인 이유? 파이썬의 데이터 삭제 과정을 살펴보면 뒤에서 뽑는게 더 효울적이기 때문 </span> +</span></span><span class="line"><span class="cl"> <span class="n">stack</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&#34;ICN&#34;</span><span class="p">]</span> +</span></span><span class="line"><span class="cl"> <span class="n">path</span> <span class="o">=</span> <span class="p">[]</span> +</span></span><span class="line"><span class="cl"> <span class="k">while</span> <span class="mi">0</span> <span class="o">&lt;</span> <span class="nb">len</span><span class="p">(</span><span class="n">stack</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">top</span> <span class="o">=</span> <span class="n">stack</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">top</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">routes</span> <span class="ow">or</span> <span class="nb">len</span><span class="p">(</span><span class="n">routes</span><span class="p">[</span><span class="n">top</span><span class="p">])</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span> <span class="c1"># 이 공항에서 떠나는 티켓이 존재하지 않음</span> +</span></span><span class="line"><span class="cl"> <span class="n">path</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">stack</span><span class="o">.</span><span class="n">pop</span><span class="p">())</span> +</span></span><span class="line"><span class="cl"> <span class="k">else</span> <span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">stack</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">routes</span><span class="p">[</span><span class="n">top</span><span class="p">]</span><span class="o">.</span><span class="n">pop</span><span class="p">())</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">path</span><span class="p">[::</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> +</span></span></code></pre></td></tr></table> +</div> +</div><br> +<h3 id="span-stylecolord0e7d2추가-문제풀이span"><span style="color:#D0E7D2">추가 문제풀이</span></h3> +<details> +<summary>문제 링크 모음(많이 김)</summary> +<!-- summary 아래 한칸 공백 두어야함 --> +<br> +프로그래머스 코딩테스트 문제 링크 (코스에 있는 문제여도 프로그래머스 코테 링크로 적음) +<ul> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/42576" target="_blank" rel="noopener" + >완주하지 못한 사람</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/12909" target="_blank" rel="noopener" + >올바른 괄호</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/49993" target="_blank" rel="noopener" + >스킬트리</a> +<br></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/12978" target="_blank" rel="noopener" + >배달</a> +<br></li> +<li>[세 소수의 합]</li> +<li>[주사위 게임]</li> +<li><a class="link" href="https://school.programmers.co.kr/app/courses/19071/curriculum/lessons/236812" target="_blank" rel="noopener" + >사탕 담기</a> +<br></li> +<li>[빙고]</li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/49994" target="_blank" rel="noopener" + >방문 길이</a></li> +<li>[쇠막대기]</li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/60059" target="_blank" rel="noopener" + >자물쇠와 열쇠</a> +<br></li> +<li>[게임 아이템] +<br></li> +<li><a class="link" href="https://school.programmers.co.kr/app/courses/19071/curriculum/lessons/236806" target="_blank" rel="noopener" + >기능개발</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/42626" target="_blank" rel="noopener" + >더 맵게</a></li> +<li>[배상 비용 최소화]</li> +<li>[문자열 압축 코드] +<br></li> +<li><a class="link" href="https://school.programmers.co.kr/app/courses/19071/curriculum/lessons/236811" target="_blank" rel="noopener" + >카펫</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/12982" target="_blank" rel="noopener" + >예산</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/12952" target="_blank" rel="noopener" + >N-Queen</a></li> +<li>[버스 여행] +<br></li> +<li><a class="link" href="https://school.programmers.co.kr/app/courses/19071/curriculum/lessons/236805" target="_blank" rel="noopener" + >예산_소팅</a></li> +<li><a class="link" href="https://school.programmers.co.kr/app/courses/19071/curriculum/lessons/236808" target="_blank" rel="noopener" + >최솟값 만들기</a></li> +<li><a class="link" href="https://school.programmers.co.kr/app/courses/19071/curriculum/lessons/236807" target="_blank" rel="noopener" + >가장 큰 수</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/42895" target="_blank" rel="noopener" + >N으로 표현</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/12900" target="_blank" rel="noopener" + >2 x n 타일링</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/42898" target="_blank" rel="noopener" + >등굣길</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/12904" target="_blank" rel="noopener" + >가장 긴 팰린드롬</a> +<br></li> +</ul> +</details> +<h2 id="span-stylecolorb0d9b1checkspan">👀 <strong><span style="color:#B0D9B1">CHECK</span></strong></h2> +<h6 id="어렵거나-새롭게-알게-된-것-등-다시-확인할-것들"><em>(어렵거나 새롭게 알게 된 것 등 다시 확인할 것들)</em></h6> +<h4 id="pep-8">PEP 8</h4> +<p>파이썬이 추구하는 코드 스타일. 들여쓰기, 공백, 변수명 작성 규칙 등이 포함된다.</p> +<ul> +<li><a class="link" href="https://peps.python.org/pep-0008/" target="_blank" rel="noopener" + >PEP 8 - Style Guide for Python Code(공식 문서)</a></li> +<li><a class="link" href="https://wayhome25.github.io/python/2017/05/04/pep8/" target="_blank" rel="noopener" + >PEP8 스타일 가이드를 설명하는 블로그(한국어)</a></li> +</ul> +<h4 id="tim-sort">Tim sort</h4> +<p>Insertion sort + Merge sort</p> +<ul> +<li>Insertion sort는 <code>n이 작을 때</code> (Quick sort보다도) 빠름</li> +<li>전체를 작은 덩어리로 잘라 Insertion sort -&gt; Merge</li> +<li><a class="link" href="https://d2.naver.com/helloworld/0315536" target="_blank" rel="noopener" + >Tim sort에 대해 설명하는 글</a></li> +</ul> +<h4 id="dp-익숙해지기">DP 익숙해지기</h4> +<ul> +<li>knapsack problem 등 문제풀이를 통해 익숙해지기</li> +</ul> +<h2 id="span-stylecolorb0d9b1느낀-점span">❗ <strong><span style="color:#B0D9B1">느낀 점</span></strong></h2> +<p>오늘은 DP(Dynamic Programming)과 DFS&amp;BFS의 개념에 대해 가볍게 배우고, 문제풀이를 위주로 강의가 진행되었다.</p> +<p>아는 알고리즘들이고 어제 강의의 문제가 나에겐 어렵지 않았기 때문에, 해설 강의를 듣기 전에 문제를 먼저 풀어 보았다. 문제를 풀다가 막히는 부분이 있으면 강의를 틀고, 해결되면 멈추고 다시 풀어보곤 했다.<br> +Heap 문제를 제외한 두 문제는 해설 없이 풀었고, Heap 문제도 heapq 라이브러리를 사용해야하는 것을 깨닫고는 금방 풀 수 있었다.</p> +<p>이번주 강의를 듣고 문제를 풀면서 느낀점이 몇개 있다.</p> +<ol> +<li> +<p>나는 알고리즘 자체는 꽤 잘 알고 활용도 잘 하는 편이지만 라이브러리 사용에 있어서 소극적인 면이 있다. 문제를 풀 때 파이썬 표준 라이브러리조차도 잘 import하지 않고 Dictionary나 Set정도만 사용하는 편이었다. <em>(Heap도 자체적으로 구현하거나 list를 사용하곤 했는데 왜 이런 습관이 들었는지는 잘 모르겠다.)</em> <br> +이번 강의를 들으면서 표준 라이브러리에 있는 여러 데이터형을 활용했고 다음에 문제를 풀 때도 적극적으로 활용하면서 더 효과적인 코드를 작성하는데 가까워지려고 한다.</p> +</li> +<li> +<p>나는 CS 용어를 잘 모른다. 아예 모른다는게 아니라, 많이 헷갈리며 정확한 명칭을 찾아보지 않았다는 의미이다. member method, list comprehension 등 용어들은 분명 내가 궁금해서 찾아봤지만 아직도 헷갈리거나 명칭 자체를 몰랐던 것들이다. 강의를 통해 명확해지거나 새롭게 알게 된 용어들이 있어서 좋았고, 이제부터는 모르는 부분에 대해 검색할 때는 아예 용어와 그 정의부터 찾는것부터 시작해야겠다고 다짐했다.</p> +</li> +</ol> +<p>내일은 강의가 없는 날이다. 하지만 해야 할 일들은 있다. 오늘까지 배운걸 복습하고, 배운 자료구조와 알고리즘을 활용하는 문제들을 lv3정도로 풀어 볼 것이다. 내일도 화이팅!!</p> + + + + Day 3 + https://srlee056.github.io/p/day-3/ + Wed, 18 Oct 2023 00:00:00 +0000 + + https://srlee056.github.io/p/day-3/ + <h1 id="span-stylecolor79ac78til---queue-tree--heapspan"><strong><span style="color:#79AC78">TIL - Queue, Tree &amp; Heap</span></strong></h1> +<h2 id="span-stylecolorb0d9b1공부-내용span">📋 <strong><span style="color:#B0D9B1">공부 내용</span></strong></h2> +<h3 id="span-stylecolord0e7d2queuesspan"><span style="color:#D0E7D2">Queues</span></h3> +<ul> +<li> +<p>Queue?</p> +<ul> +<li>FIFO (First In First Out)</li> +<li>operations +<ul> +<li>enqueue</li> +<li>dequeue +<ul> +<li>선형 배열으로 구현: <code>O(n)</code> -&gt; 연결 리스트로 구현하는것이 더 좋음</li> +</ul> +</li> +</ul> +</li> +</ul> +</li> +<li> +<p>Circular Queues</p> +<ul> +<li>배열의 한쪽 끝과 다른쪽 끝이 닿아 있는 모습</li> +<li>원소의 개수가 정해져있음</li> +<li><code>front / rear 포인터</code>를 기억하고, dequeue된 원소 저장소는 재활용</li> +<li>선형 배열으로 구현하는것이 더 좋음</li> +</ul> +</li> +<li> +<p>Priority Queues</p> +<ul> +<li>원소들 사이의 우선순위를 따름</li> +<li>우선순위 구현 +<ul> +<li>원소를 넣을 때 enqueue vs. 원소를 꺼낼 때 dequeue +<ul> +<li>넣을 때(enqueue) 우선순위에 따라 정렬하는것이 조금 더 나은 Time Complexity를 가짐</li> +<li>데이터를 관리하고 활용하는 데에도 더 편리함</li> +</ul> +</li> +</ul> +</li> +</ul> +</li> +</ul> +<h3 id="span-stylecolord0e7d2treesspan"><span style="color:#D0E7D2">Trees</span></h3> +<ul> +<li> +<p><strong>Tree?</strong></p> +<ul> +<li>구성 +<ul> +<li>root node</li> +<li>interner nodes</li> +<li>leaf nodes</li> +</ul> +</li> +<li>특성 +<ul> +<li>parent node / child node</li> +<li>노드의 수준 (level) : root node로부터 거리</li> +<li>노드의 차수 (degree) : 노드의 자식 수</li> +<li>트리의 높이(height) 또는 깊이(depth) : 제일 큰 level + 1</li> +<li>subtree</li> +</ul> +</li> +</ul> +</li> +<li> +<p><strong>Binary Trees</strong></p> +<ul> +<li>모든 node의 degree &lt;= 2</li> +<li>operations +<ul> +<li>size()</li> +<li>depth()</li> +<li>순회 traversal +<ul> +<li>Depth First Traversal : 재귀 호출을 통해 구현 +<ul> +<li>inorder</li> +<li>preorder</li> +<li>postorder</li> +</ul> +</li> +<li>Breadth Tirst Traversal : queue 사용! +<ul> +<li>level이 낮은 노드를 우선으로 방문</li> +<li>같은 level인 경우 부모 노드의 순서를 따름</li> +</ul> +</li> +</ul> +</li> +</ul> +</li> +<li>포화 이진 트리 (full binary trees) +<ul> +<li>모든 node의 degree == 2</li> +</ul> +</li> +<li>완전 이진 트리 (complete binary trees) +<ul> +<li>(depth k) <code>level k-2</code>까지는 full binary tree, <code>level k-1</code>은 왼쪽부터 node 채워짐</li> +</ul> +</li> +</ul> +</li> +<li> +<p><strong>Binary Search Trees</strong></p> +<ul> +<li>모든 노드에 대해 다음 성질을 만족하는 Binary Tree +<ul> +<li>왼쪽 subtree&rsquo;s data &lt; 현재 node&rsquo;s data &lt; 오른쪽 subtree&rsquo;s data</li> +</ul> +</li> +<li>장단점 +<ul> +<li>장점 : 원소의 추가, 삭제가 편함</li> +<li>단점 : 큰 공간을 소요함 (연결 리스트로 구현)</li> +</ul> +</li> +<li>operations +<ul> +<li>insert()</li> +<li>remove()</li> +<li>lookup()</li> +<li>inorder()</li> +<li>min(), max()</li> +</ul> +</li> +</ul> +</li> +</ul> +<h3 id="span-stylecolord0e7d2heapspan"><span style="color:#D0E7D2">Heap</span></h3> +<ul> +<li>Heaps? +<ul> +<li> +<p>Binary Tree의 한 종류 (binary heap)</p> +</li> +<li> +<p>Min / Max heap</p> +<ul> +<li>root node가 항상 최소/최대 값을 가진다</li> +<li>complete binary tree +<ul> +<li><code>n</code> nodes -&gt; depth <code>log(n)+1</code></li> +<li>insert / remove operation의 Time Complexity : <code>O(log(n))</code></li> +</ul> +</li> +<li>subtree 또한 Min / Max heap</li> +</ul> +</li> +<li> +<p>Binary Seacrh Tree vs. Heap?</p> +<table> +<thead> +<tr> +<th></th> +<th>BST</th> +<th>Heap</th> +</tr> +</thead> +<tbody> +<tr> +<td>데이터 정렬</td> +<td>크기순서대로 완전 정렬</td> +<td>완전 정렬 X</td> +</tr> +<tr> +<td>데이터 검색</td> +<td>O</td> +<td>X</td> +</tr> +<tr> +<td>완전 이진 트리</td> +<td>X</td> +<td>O</td> +</tr> +<tr> +<td>연산 시간</td> +<td>(최악의 경우) O(n)</td> +<td>O(log(n))</td> +</tr> +<tr> +<td>선형 배열로 구현</td> +<td>X</td> +<td>O</td> +</tr> +</tbody> +</table> +</li> +<li> +<p>operations</p> +<ul> +<li>insert()</li> +<li>remove()</li> +</ul> +</li> +</ul> +</li> +</ul> +<h2 id="span-stylecolorb0d9b1checkspan">👀 <strong><span style="color:#B0D9B1">CHECK</span></strong></h2> +<h6 id="어렵거나-새롭게-알게-된-것-등-다시-확인할-것들"><em>(어렵거나 새롭게 알게 된 것 등 다시 확인할 것들)</em></h6> +<ul> +<li><strong>노드의 차수(degree) : # of children</strong> +<ul> +<li>binary tree : 모든 노드의 degree가 항상 2이하</li> +<li>leaf nodes : degree 0</li> +</ul> +</li> +<li><strong>단축 평가</strong> +<ul> +<li><a class="link" href="https://pydole.tistory.com/entry/Python-%EB%8B%A8%EC%B6%95%ED%8F%89%EA%B0%80short-circuit-evalution" target="_blank" rel="noopener" + >단축평가에 대해 참고한 블로그</a></li> +<li>2개 이상의 논리 조건식이 있을 경우에, <strong>앞 조건이 계산한 값에 의해 결과가 확실해지면 두번째 조건은 확인하지 않음</strong></li> +<li>False and (), True or () 인 경우 등이 해당됨</li> +</ul> +</li> +</ul> +<h2 id="span-stylecolorb0d9b1느낀-점span">❗ <strong><span style="color:#B0D9B1">느낀 점</span></strong></h2> +<p>어제의 교훈이 있어서 그런지, 오늘은 프로그래밍 과정에 실수가 적었다. +그리고, 자료구조를 구현하는 과정에서 더 나은 방식에 대해 고민하는 상황이 많아졌다.</p> +<p>오늘 주로 고민한 부분은</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span><span class="lnt">5 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-fallback" data-lang="fallback"><span class="line"><span class="cl">코드를 더 직관적으로 적고싶음 +</span></span><span class="line"><span class="cl">- 반복되는 같은 코드를 합칠 수 있는가? +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl">같은 코드 다른 효율? +</span></span><span class="line"><span class="cl">- 같은 기능을 하지만 살짝 다른 두 코드 중 더 나은것은? +</span></span></code></pre></td></tr></table> +</div> +</div><p>정도였다.</p> +<p>전자는 내가 평소 프로그래밍 할 때 자주 하긴 하는데, 항상 고민하는 부분이다. +반복되는 기능을 함수로 빼던가, 적용되는 변수를 리스트로 묶어서 반복하는 등의 방법을 쓰는데, 다른 방법은 뭐가 있을까 고민하고 있다.</p> +<p>후자는 Complexity를 구하는 방법에 대한 의문이 아니다. 실제로 이 operation이 어떻게 구현되고 있는지, 왜 그렇게 구현되었는지가 궁금한 것이다. <br> +실습 문제에서 우선순위 queue를 구현할 때, skeleton code의 dequeue 함수는 마지막 elements를 가져오는 방식으로 되어있었다.(<code>getAt(data.size())</code>) <br> +나는 처음 element를 가져오는 방식으로 생각하고(<code>getAt(1)</code>) 이에 해당하는 enqueue 함수를 작성했기 때문에 잠깐 막혔다가, 결국은 눈치채고 해결했다.<br> +그 코드를 보면서 이렇게 구현하는게 더 나은건지 궁금증이 들었고, 같은 기능을 하지만 결함이 적은(?) 코드를 작성하자는 생각이 들었다.</p> +<p>오늘은 추가 알고리즘 문제들이 있고 아직 풀지 않았는데, 쉬운 문제들이지만 이 두가지를 생각하면서 풀려고 노력해야겠다.</p> + + + + + diff --git a/public/tags/heap/page/1/index.html b/public/tags/heap/page/1/index.html new file mode 100644 index 0000000..9393dd3 --- /dev/null +++ b/public/tags/heap/page/1/index.html @@ -0,0 +1,10 @@ + + + + https://srlee056.github.io/tags/heap/ + + + + + + diff --git a/public/tags/shortcodes/index.html b/public/tags/html-parser/index.html similarity index 79% rename from public/tags/shortcodes/index.html rename to public/tags/html-parser/index.html index 393c035..61dd298 100644 --- a/public/tags/shortcodes/index.html +++ b/public/tags/html-parser/index.html @@ -1,18 +1,20 @@ - + - -Tag: shortcodes - Seorim Log - - - - - - - - - - + +Tag: HTML Parser - 서림록 + + + + + + + + + + + +
@@ -270,10 +268,10 @@

좋은 개발자로 한걸음 더

- - + + - + +

+ + +
+ + + + + + + + + + + + 🤩 + +
+ + + +
+

서림록

+

좋은 개발자로 한걸음 더

+
+
+ + +
+ + +
+
+

+ + Tags + +

+ +
+
+

1 페이지

+

HTTP

+ +
+
+
+ +
+ + + +
+
+ + +
+ Hugo로 만듦
+ JimmyStack 테마 사용 중 +
+
+ + +
+ + + + + + diff --git a/public/tags/http/index.xml b/public/tags/http/index.xml new file mode 100644 index 0000000..627ad62 --- /dev/null +++ b/public/tags/http/index.xml @@ -0,0 +1,192 @@ + + + + HTTP on 서림록 + https://srlee056.github.io/tags/http/ + Recent content in HTTP on 서림록 + Hugo -- gohugo.io + ko + Seorim Lee + Tue, 24 Oct 2023 00:00:00 +0000 + Day 7 + https://srlee056.github.io/p/day-7/ + Tue, 24 Oct 2023 00:00:00 +0000 + + https://srlee056.github.io/p/day-7/ + <h1 id="span-stylecolor79ac78til---httpspan"><span style="color:#79AC78">TIL - HTTP</span></h1> +<h2 id="span-stylecolorb0d9b1공부-내용span">📋 <span style="color:#B0D9B1">공부 내용</span></h2> +<h3 id="span-stylecolord0e7d2웹span"><span style="color:#D0E7D2">웹</span></h3> +<h4 id="span-stylecolorf9b572웹-페이지와-htmlspan"><span style="color:#F9B572">웹 페이지와 HTML</span></h4> +<p>웹 페이지</p> +<ul> +<li>웹 속의 <strong>문서 하나</strong></li> +<li>ex) 네이버 메인 페이지</li> +<li>HTML으로 구성되어있음</li> +</ul> +<p>웹 사이트</p> +<ul> +<li>여러 웹 페이지의 모음</li> +<li>ex) <em>네이버</em>라는 웹 사이트</li> +</ul> +<p>웹 브라우저</p> +<ul> +<li>HTTP요청을 보낸 후, HTTP응답에 담긴 HTML문서를 사용자가 보기 쉽게 화면으로 그려주는 (렌더링) 역할</li> +</ul> +<p><a class="link" href="https://velog.io/@srlee056/%EB%8D%B0%EC%9D%B4%ED%84%B0-%EC%97%94%EC%A7%80%EB%8B%88%EC%96%B4%EB%A7%81-%EB%8D%B0%EB%B8%8C%EC%BD%94%EC%8A%A4-6%EC%9D%BC%EC%B0%A8" target="_blank" rel="noopener" + >HTML(개념 정리 글 링크)</a></p> +<ul> +<li>이전 강의에서 다룬 내용 참고</li> +<li>웹 브라우저마다 지원하는 태그와 속성이 달라짐</li> +</ul> +<h4 id="span-stylecolorf9b572웹-스크래핑--웹-크롤링span"><span style="color:#F9B572">웹 스크래핑 / 웹 크롤링</span></h4> +<p>웹 스크래핑</p> +<ul> +<li>특정 목적에 따라 웹 페이지에서 원하는 데이터를 &ldquo;추출&rdquo;</li> +<li>ex) 날씨 정보 가져오기, 주식 데이터 가져오기, &hellip;</li> +</ul> +<p>웹 크롤링</p> +<ul> +<li>크롤러를 이용해 URL을 타고 이동하며 반복적으로 웹 페이지의 데이터를 가져와 &ldquo;인덱싱&rdquo;(데이터 색인)</li> +<li>구글, 네이버 등 검색 엔진의 웹 크롤러</li> +</ul> +<h4 id="span-stylecolorf9b572올바른-http-requestspan"><span style="color:#F9B572">올바른 HTTP Request</span></h4> +<p>올바른 HTTP Request를 위해선..</p> +<ul> +<li>어떤 목적을 달성하려 하는가?</li> +<li>서버에 영향을 미치는가?</li> +</ul> +<p>로봇 배제 프로토콜(REP)</p> +<ul> +<li>웹 크롤링, 스크래핑은 로봇에 의해 실행 가능</li> +<li>사이트의 모든 정보를 취득하는것이 정당한가? 의문에서 시작</li> +<li>robots.txt +<ul> +<li>각 사이트마다 허용하는 크롤러 정보와 허용범위에 대한 정보를 담고 있음</li> +<li>User-agent, Disallow, Allow</li> +</ul> +</li> +</ul> +<h3 id="span-stylecolord0e7d2httpspan"><span style="color:#D0E7D2">HTTP</span></h3> +<h4 id="span-stylecolorf9b572httpspan"><span style="color:#F9B572">HTTP?</span></h4> +<blockquote> +<p>HyterText Transfer Protocol<br> +웹 상에서 정보를 주고받기 위한 <em>약속</em></p> +</blockquote> +<table> +<thead> +<tr> +<th></th> +<th>HTTP Request</th> +<th>HTTP Response</th> +</tr> +</thead> +<tbody> +<tr> +<td>방향</td> +<td>Client -&gt; Server</td> +<td>Client &lt;- Server</td> +</tr> +<tr> +<td>역할</td> +<td>정보 요청</td> +<td>요청에 대한 내용을 담은 응답</td> +</tr> +<tr> +<td>HEAD</td> +<td>method, path, &hellip;</td> +<td>content-type, date, &hellip;</td> +</tr> +<tr> +<td>BODY</td> +<td></td> +<td>document</td> +</tr> +</tbody> +</table> +<h4 id="span-stylecolorf9b572통신하기span"><span style="color:#F9B572">통신하기</span></h4> +<p><code>requests</code></p> +<ul> +<li>Python으로 HTTP 통신을 진행할 수 있게 해주는 라이브러리</li> +</ul> +<p><code>GET</code></p> +<ul> +<li>naver 메인 페이지를 요청하는 코드</li> +</ul> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">requests</span> +</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">requests</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&#34;https://www.naver.com&#34;</span><span class="p">)</span> <span class="c1"># HTTP Response</span> +</span></span><span class="line"><span class="cl"><span class="n">res</span><span class="o">.</span><span class="n">headers</span> <span class="c1"># Header 확인</span> +</span></span><span class="line"><span class="cl"><span class="n">res</span><span class="o">.</span><span class="n">text</span> <span class="c1"># Body(document) text 형태로 확인</span> +</span></span></code></pre></td></tr></table> +</div> +</div><p><code>POST</code></p> +<ul> +<li><a class="link" href="https://webhook.site" target="_blank" rel="noopener" + >https://webhook.site</a> 를 통해 POST 통신을 진행할 수 있음</li> +</ul> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">payload</span> <span class="o">=</span> <span class="p">{</span><span class="s2">&#34;name&#34;</span><span class="p">:</span> <span class="s2">&#34;Hello&#34;</span><span class="p">,</span> <span class="s2">&#34;age&#34;</span><span class="p">:</span> <span class="mi">13</span><span class="p">}</span> +</span></span><span class="line"><span class="cl"><span class="n">url</span> <span class="o">=</span> <span class="s2">&#34;https://webhook.site/&lt;개인 주소&gt;&#34;</span> +</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">requests</span><span class="o">.</span><span class="n">post</span><span class="p">(</span><span class="n">url</span><span class="p">,</span> <span class="n">payload</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"><span class="n">res</span><span class="o">.</span><span class="n">status_code</span> <span class="c1"># 상태 코드 확인</span> +</span></span></code></pre></td></tr></table> +</div> +</div><h3 id="span-stylecolord0e7d2domspan"><span style="color:#D0E7D2">DOM</span></h3> +<h4 id="span-stylecolorf9b572domspan"><span style="color:#F9B572">DOM?</span></h4> +<blockquote> +<p>Document Object Model<br> +HTML을 파싱하여, 브라우저가 이해하도록 만든 Tree형태의 자료구조</p> +</blockquote> +<ul> +<li> +<p>DOM의 각 노드를 객체로 생각하여, 문서를 편리하게 관리할 수 있음</p> +</li> +<li> +<p>원하는 요소를 동적으로 변경할 수 있음</p> +</li> +<li> +<p>원하는 요소를 쉽게 찾을 수 있음</p> +</li> +<li> +<p>python으로 HTML을 직접 분석하려면 DOM을 생성해주는 브라우저를 거치지 않기 때문에, +직접 HTML을 분석하는 <code>HTML Parser</code>가 필요</p> +</li> +</ul> +<h2 id="span-stylecolorb0d9b1checkspan">👀 <span style="color:#B0D9B1">CHECK</span></h2> +<p><em><span style = "font-size:15px">(어렵거나 새롭게 알게 된 것 등 다시 확인할 것들)</span></em></p> +<ul> +<li> +<p>Jupyter lab</p> +<ul> +<li>Jupyter notebook이나 Colab은 써 봤는데 Jupyter lab은 처음 접해봄</li> +<li>Jupyter notebook과 비슷하지만 더 개선된 버전(?)</li> +</ul> +</li> +<li> +<p>DOM에 대한 설명 및 활용 : 복습 후 다른 예시들을 더 찾아볼 것</p> +</li> +</ul> +<h2 id="span-stylecolorb0d9b1느낀-점span">❗ <span style="color:#B0D9B1">느낀 점</span></h2> +<p>HTML 스크래핑을 해본적이 있어서 이론이나 실습 모두 빠르게 진행했다. 5시간 분량의 강의인데 3시간 내로 끝난 것 같다. TIL을 잘 적고 싶어서 고민을 좀 했고 그 외의 시간은 평소보다는 널널하게 흘려보냈다.</p> +<p>TIL을 적을 때 기존에는 강의 받아쓰기처럼 적는 경향이 있었는데, 나중에 다시 읽어보니 이해하고 쓴 것 같은 느낌이 전혀 들지 않았다. 어제 HTML이론에 대한 TIL은 실습 부분 외에도 직접 사용해보고 하면서 적은거라, &lsquo;내가 직접 써보고 이해한 내용&rsquo;임을 알 수 있었다. 그런데 초반에 적은 TIL을 다시 보니까 그냥 받아적은게 티가 나기도 하고 잘 기억이 나지 않았다.</p> +<p>오늘은 강의를 처음부터 끝까지 들은 후 키워드만 체크해 필기한 다음, TIL을 적으면서 중간중간 다시 듣는 방식을 사용했다. 이 방식으로 더 잘 읽히고 짜임새 있는 구성의 글을 쓰게 되어서 만족스러웠다. TIL 쓰는 시간은 오래 걸리지만 익숙해지면 줄어들 것 같아서 걱정은 되지 않는다.</p> +<p>커리큘럼을 보니 내일부터는 BeautifulSoup를 사용해 스크래핑을 시작하는데, 모르는 부분이 많을 것 같아 벌써부터 기대가 된다. :&gt;</p> + + + + + diff --git a/public/tags/http/page/1/index.html b/public/tags/http/page/1/index.html new file mode 100644 index 0000000..ec6dd98 --- /dev/null +++ b/public/tags/http/page/1/index.html @@ -0,0 +1,10 @@ + + + + https://srlee056.github.io/tags/http/ + + + + + + diff --git a/public/tags/hugo/index.html b/public/tags/hugo/index.html new file mode 100644 index 0000000..995b0e2 --- /dev/null +++ b/public/tags/hugo/index.html @@ -0,0 +1,490 @@ + + + + +Tag: hugo - 서림록 + + + + + + + + + + + + + + + +
+ + + + +
+
+

+ + Tags + +

+ +
+
+

2 페이지

+

hugo

+ +
+
+
+ +
+ + + + + +
+
+ + +
+ Hugo로 만듦
+ JimmyStack 테마 사용 중 +
+
+ + +
+
+ + + + + diff --git a/public/tags/hugo/index.xml b/public/tags/hugo/index.xml new file mode 100644 index 0000000..83f2fc0 --- /dev/null +++ b/public/tags/hugo/index.xml @@ -0,0 +1,266 @@ + + + + hugo on 서림록 + https://srlee056.github.io/tags/hugo/ + Recent content in hugo on 서림록 + Hugo -- gohugo.io + ko + Seorim Lee + Mon, 16 Oct 2023 00:00:00 +0000 + Blog 제작기 #1 + https://srlee056.github.io/blog-1/ + Mon, 16 Oct 2023 00:00:00 +0000 + + https://srlee056.github.io/blog-1/ + <p><a class="link" href="https://srlee056.github.io/p/day-1/" target="_blank" rel="noopener" + >1일차 TIL</a>에서 이어지는 블로그 제작기 입니다. :&gt;</p> +<p><a class="link" href="https://srlee056.github.io/" target="_blank" rel="noopener" + >(아직 제작중인)블로그</a>를 구경하시려면 클릭하세요!</p> +<h2 id="1-로컬에서-휴고-사이트-만들기httpsgohugoiogetting-startedquick-start">1. 로컬에서 <a class="link" href="https://gohugo.io/getting-started/quick-start/" target="_blank" rel="noopener" + >휴고 사이트 만들기</a></h2> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span><span class="lnt">5 +</span><span class="lnt">6 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-fallback" data-lang="fallback"><span class="line"><span class="cl">hugo new site blog +</span></span><span class="line"><span class="cl">cd blog +</span></span><span class="line"><span class="cl">git init +</span></span><span class="line"><span class="cl">git submodule add https://github.com/CaiJimmy/hugo-theme-stack/ themes/hugo-theme-stack +</span></span><span class="line"><span class="cl">echo &#34;theme = &#39;hugo-theme-stack&#39;&#34; &gt;&gt; hugo.toml +</span></span><span class="line"><span class="cl">hugo server +</span></span></code></pre></td></tr></table> +</div> +</div><p>나는 가이드에 적힌 theme과는 다른 <a class="link" href="https://github.com/CaiJimmy/hugo-theme-stack" target="_blank" rel="noopener" + >hugo-theme-stack</a>을 사용했다. +가이드에는 새 post를 만들고 config 파일인 <code>hugo.toml</code>을 수정하는 부분도 나와있지만, 이후에 둘 다 다른 내용으로 덮어써서 넘어가도 되는 과정이었다.</p> +<h2 id="2-theme-커스터마이징하기">2. theme 커스터마이징하기</h2> +<p><code>themes/hugo-theme-stack/exampleSite/config.yaml</code> 파일 내용을 변환하여 제일 상위 폴더의 <code>./hugo.toml</code> 파일에 붙여넣고,<br> +(구글에 &lsquo;yaml to toml&rsquo;로 검색하면 많은 converter를 볼 수 있다.)</p> +<p><code>themes/hugo-theme-stack/exampleSite/contetns/</code> 안의 파일들을 <code>./contetns</code> 에 붙여넣었다.</p> +<p>이 과정에는 <a class="link" href="https://kzeoh.github.io" target="_blank" rel="noopener" + >이 블로그 글</a>을 많이 참고했다. 정말 감사합니다👍🏻</p> +<p><code>hugo.toml</code> 파일에 오류가 좀 있는 것 같지만</p> +<ol> +<li>내가 아직 hugo configuration 관련해서 잘 모르고</li> +<li>오류가 있는데도 서버가 잘 돌아가고 빌드도 돼서 +나중에 고치기로 했다. (🤔 이게 왜 되지?)</li> +</ol> +<h2 id="3-배포하기">3. 배포하기</h2> +<p>(사실 배포가 제일 쉬웠다) +github 사이트에서 <code>&lt;username&gt;.github.io</code> 이름의 레포지토리를 만들고 +<strong>로컬</strong>에서 변경 내용을 모두 commit한 이후,</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-fallback" data-lang="fallback"><span class="line"><span class="cl">git remote add origin https://github.com/&lt;username&gt;/&lt;username&gt;.github.io.git +</span></span></code></pre></td></tr></table> +</div> +</div><p>위 커맨드를 입력해 로컬과 원격 레포지토리를 연결한다. +<br></p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-fallback" data-lang="fallback"><span class="line"><span class="cl">git push -u origin master +</span></span></code></pre></td></tr></table> +</div> +</div><p>그리고 push하면 레포지토리 관련은 끝. (branch 관련 건드린 게 있다면 push하기 전에 master로 옮길것.) ++) 요즘은 master가 아닌 main branch로 바뀌었더라. +<br></p> +<p>빌드와 배포는 git actions기능을 활용했는데, hugo 사이트에 <a class="link" href="https://gohugo.io/hosting-and-deployment/hosting-on-github/" target="_blank" rel="noopener" + >github hosting 가이드라인</a>이 잘 적혀있다.</p> +<p>이 링크의 내용을 요약하자면</p> +<ul> +<li>레포지토리 settings/pages에서 source를 <code>GitHub Actions</code>로 변경</li> +<li>로컬에서 <code>.github/workflows/hugo.yaml</code> 파일 생성 후 내용 붙여넣기 (폴더도 직접 생성해줘야함)</li> +<li>변경사항을 commit, push한 이후 레포지토리의 <code>Actions</code> 탭에 들어가면 <strong>빌드/배포 기능을 하는 Action</strong>이 추가됨</li> +<li>Run Workflow 버튼을 누르면 빌드/배포가 자동으로 진행되며 내 github page에 테마가 적용된 사이트가 잘 올라와 있다.</li> +</ul> +<p><a class="link" href="https://srlee056.github.io/" target="_blank" rel="noopener" + >왜인지 모르겠지만 잘 돌아가는 블로그</a></p> +<p><a class="link" href="https://github.com/srlee056/srlee056.github.io" target="_blank" rel="noopener" + >블로그 github repo.</a></p> +<hr> +<h3 id="느낀점">느낀점</h3> +<p>전체적으로 해결하지 못한 오류도 많고, 이해하지 못한 구조도 많지만 오늘은 배포에 성공한 것에 의의를 두려고 한다.🥲</p> +<h3 id="다음엔">다음엔?</h3> +<ul> +<li>hugo로 포스트 올리기</li> +<li>오류 해결하기 (layout 인식 문제 등)</li> +<li>theme custom 으로 링크 등 UI 추가해보기</li> +</ul> + + + + Day 1 + https://srlee056.github.io/p/day-1/ + Mon, 16 Oct 2023 00:00:00 +0000 + + https://srlee056.github.io/p/day-1/ + <h1 id="span-stylecolor79ac781-자료구조--알고리즘-강의-및-코드-리뷰span"><strong><span style="color:#79AC78">1. 자료구조 &amp; 알고리즘 강의 및 코드 리뷰</span></strong></h1> +<h2 id="span-stylecolorb0d9b1공부-내용span">📋 <strong><span style="color:#B0D9B1">공부 내용</span></strong></h2> +<h3 id="span-stylecolord0e7d2선형-배열---linear-arraysspan"><span style="color:#D0E7D2">선형 배열 - Linear Arrays</span></h3> +<ul> +<li> +<p>배열(array) : 개념적 구조 / 리스트 : python 데이터형</p> +</li> +<li> +<p>리스트 methods</p> +<ul> +<li>time complexity O(1) +<ul> +<li><code>.append()</code></li> +<li><code>.pop()</code></li> +</ul> +</li> +<li>time complexity O(n) +<ul> +<li><code>.insert()</code></li> +<li><code>.del()</code></li> +<li><code>.index()</code></li> +<li><code>.insert()</code></li> +</ul> +</li> +</ul> +</li> +<li> +<p>정렬(sort)</p> +<ul> +<li><code>sorted()</code> : function, 정렬된 새로운 리스트를 반환하며 기존 리스트에는 변화 없음.</li> +<li><code>.sort()</code> : method, 기존 리스트가 정렬됨</li> +<li>숫자가 아닌 문자열 등 데이터형의 정렬 : 사전순이 기본, 문자열의 길이 등 다른 정렬 조건을 사용하고 싶다면 <code>lambda</code> 활용 +<ul> +<li> +<p>문자열을 길이순으로 정렬</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="nb">sorted</span><span class="p">(</span><span class="n">L</span><span class="p">,</span> <span class="n">key</span> <span class="o">=</span> <span class="k">lambda</span> <span class="n">x</span> <span class="p">:</span> <span class="nb">len</span><span class="p">(</span><span class="n">x</span><span class="p">))</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li> +<p>사전 데이터형(dictionary)에 key = ‘name’인 value의 문자열 순서대로 정렬</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">L</span> <span class="o">=</span> <span class="p">[</span> <span class="p">{</span><span class="s1">&#39;name&#39;</span> <span class="p">:</span> <span class="s1">&#39;John&#39;</span><span class="p">,</span> <span class="s1">&#39;score&#39;</span><span class="p">:</span> <span class="mi">90</span><span class="p">},</span> +</span></span><span class="line"><span class="cl"> <span class="p">{</span><span class="s1">&#39;name&#39;</span> <span class="p">:</span> <span class="s1">&#39;Paul&#39;</span><span class="p">,</span> <span class="s1">&#39;score&#39;</span><span class="p">:</span> <span class="mi">80</span><span class="p">}</span> <span class="p">]</span> +</span></span><span class="line"><span class="cl"><span class="nb">sorted</span><span class="p">(</span><span class="n">L</span><span class="p">,</span> <span class="n">key</span> <span class="o">=</span> <span class="k">lambda</span> <span class="n">x</span> <span class="p">:</span> <span class="n">x</span><span class="p">[</span><span class="s1">&#39;name&#39;</span><span class="p">]</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +</ul> +</li> +</ul> +</li> +<li> +<p>탐색(search)</p> +<ul> +<li>선형(linear) 탐색, 순차(sequential) 탐색</li> +<li>이진(binary) 탐색</li> +</ul> +</li> +</ul> +<h3 id="span-stylecolord0e7d2재귀-알고리즘---recursive-algorithmsspan"><span style="color:#D0E7D2">재귀 알고리즘 - recursive algorithms</span></h3> +<ul> +<li><strong>종결 조건(trivial case)</strong> 을 명시해야 함</li> +<li>예시 +<ul> +<li> +<p>1부터 x까지 숫자의 합을 구하는 함수 (sum)</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">recursiveSum</span><span class="p">(</span><span class="n">x</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">x</span> <span class="o">&lt;</span> <span class="mi">1</span> <span class="p">:</span> <span class="k">return</span> <span class="n">x</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">recursiveSum</span><span class="p">(</span><span class="n">x</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="o">+</span> <span class="n">x</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li> +<p>조합의 수 (nCm)</p> +</li> +<li> +<p>하노이의 탑</p> +</li> +<li> +<p>피보나치 순열</p> +</li> +</ul> +</li> +<li>장점 : 알고리즘을 간단하고 이해하기 쉽게 풀어냄</li> +<li>단점 : time complexity 부분에서 비효율적인 경우가 많음</li> +<li>이러한 특성 때문에 tree 자료구조를 이용하는 알고리즘에 활용</li> +</ul> +<h3 id="span-stylecolord0e7d2complexityspan"><span style="color:#D0E7D2">Complexity</span></h3> +<ul> +<li>Time Complexity</li> +<li>Space Complexity</li> +<li>다루는 데이터가 커질수록, 더 효율적인 complexity를 가지는 방식이 필요함 (2^n, n! 등의 complexity <strong>X</strong>)</li> +</ul> +<h2 id="span-stylecolorb0d9b1checkspan">👀 <strong><span style="color:#B0D9B1">CHECK</span></strong></h2> +<h6 id="어렵거나-새롭게-알게-된-것-등-다시-확인할-것들"><em>(어렵거나 새롭게 알게 된 것 등 다시 확인할 것들)</em></h6> +<ul> +<li>코드로 elapsed time을 확인 -&gt; 디버깅이나 time complexity를 직관적으로 확인하는 등에 활용</li> +<li>list method <code>.pop()</code> 과 <code>.remove()</code>의 차이점</li> +<li>big O notation - O of n 으로 읽음</li> +<li>list의 앞과 뒤에 접근하는것은 O(1)의 time complextity를 갖는다.</li> +</ul> +<h2 id="span-stylecolorb0d9b1느낀-점span">‼️ <strong><span style="color:#B0D9B1">느낀 점</span></strong></h2> +<p>아직까지는 전공 과정 복습하는 느낌이고, 쉽다고 느꼈다. 막히는 부분은 없었다. 코드를 작성하면서 조금 더 나은 코드에 대해 생각해보는것 정도. <br> +공부하는 중이나 이후에 바로 TIL을 적는게 제일 좋다고 생각하는데, 블로그 세팅에 정신이 팔려서 나중에 작성하게 된 건 조금 아쉽다. <br> +오늘은 코어타임보다 일찍 강의를 들어버려서 시간 분배가 애매했다. 내일은 코어타임 시작할 때 듣기 시작하고, 그 전에는 전날 내용을 복습하거나, 알고리즘 문제를 풀고 code review를 작성하는 시간을 가져야겠다.</p> +<h1 id="span-stylecolor79ac782-블로그-세팅-과정span"><strong><span style="color:#79AC78">2. 블로그 세팅 과정</span></strong></h1> +<p><img src="https://blog.kakaocdn.net/dn/cKgXTh/btsyuerJaNh/HhtKTmduAbBOsbBmTD8g00/img.png" + + + + loading="lazy" + + alt="https://blog.kakaocdn.net/dn/cKgXTh/btsyuerJaNh/HhtKTmduAbBOsbBmTD8g00/img.png" + + +></p> +<p>노션이나 옵시디언으로 TIL을 적고 깃에 업로드 한 적은 많지만 블로그에 올리는건 처음이라, 어디에 올리지 고민하다가 일단 티스토리 계정과 블로그를 만들었다.<br> +그런데 만들다 보니 <strong>github repo와 연동되는 page를 세팅하고 싶다..!</strong> 라는 욕심이 들기 시작했고, <br> +jekyll 등을 알아보다가 hugo를 활용한 페이지 세팅을 접하게 되어 장장 3시간을 투자했다.</p> +<p>그런데 이 글을 티스토리에 올리는 이유는? 세팅에 실패했기 때문 ㅠㅠ<br> +TIL 작성하고 나서 다시 도전해서 세팅 과정에 대해서도 글을 써 볼 예정이다.</p> +<p>+) 티스토리에서 md로 작성한게 예쁘게 안나와서 벨로그로 옮겼다 😂 훨씬 편한 것 같은데 깃허브랑 연동 전까진 벨로그로 해야겠다 :&gt;</p> +<h2 id="span-stylecolorb0d9b1지금까지-참고한-링크들span"><span style="color:#B0D9B1">(지금까지 참고한 링크들)</span></h2> +<ul> +<li><a class="link" href="https://gohugo.io/getting-started/quick-start/" target="_blank" rel="noopener" + >휴고 사이트 생성 가이드</a></li> +<li><a class="link" href="https://gohugo.io/hosting-and-deployment/hosting-on-github/" target="_blank" rel="noopener" + >휴고 사이트 깃허브 연결 가이드</a></li> +<li><a class="link" href="https://themes.gohugo.io/themes/salinger-theme/#quick-start-" target="_blank" rel="noopener" + >사용 테마1</a></li> +<li><a class="link" href="https://github.com/CaiJimmy/hugo-theme-stack-starter" target="_blank" rel="noopener" + >사용 테마2</a></li> +</ul> + + + + + diff --git a/public/tags/hugo/page/1/index.html b/public/tags/hugo/page/1/index.html new file mode 100644 index 0000000..22abce6 --- /dev/null +++ b/public/tags/hugo/page/1/index.html @@ -0,0 +1,10 @@ + + + + https://srlee056.github.io/tags/hugo/ + + + + + + diff --git a/public/tags/index.html b/public/tags/index.html index 299541d..cd3b0bb 100644 --- a/public/tags/index.html +++ b/public/tags/index.html @@ -1,18 +1,20 @@ - + - + Tags - + - - + + - + + +
@@ -270,10 +268,10 @@

좋은 개발자로 한걸음 더

- - + + - + +

+ + +
+ + + + + + + + + + + + 🤩 + +
+ + + +
+

서림록

+

좋은 개발자로 한걸음 더

+
+
+ + +
+ + +
+
+

+ + Tags + +

+ +
+
+

1 페이지

+

LinkedList

+ +
+
+
+ +
+ + + +
+
+ + +
+ Hugo로 만듦
+ JimmyStack 테마 사용 중 +
+
+ + +
+ + + + + + diff --git a/public/tags/linkedlist/index.xml b/public/tags/linkedlist/index.xml new file mode 100644 index 0000000..46360e6 --- /dev/null +++ b/public/tags/linkedlist/index.xml @@ -0,0 +1,649 @@ + + + + LinkedList on 서림록 + https://srlee056.github.io/tags/linkedlist/ + Recent content in LinkedList on 서림록 + Hugo -- gohugo.io + ko + Seorim Lee + Tue, 17 Oct 2023 00:00:00 +0000 + Day 2 + https://srlee056.github.io/p/day-2/ + Tue, 17 Oct 2023 00:00:00 +0000 + + https://srlee056.github.io/p/day-2/ + <h1 id="span-stylecolor79ac78til---linkedlist--stackspan"><strong><span style="color:#79AC78">TIL - LinkedList &amp; Stack</span></strong></h1> +<h2 id="span-stylecolorb0d9b1공부-내용span">📋 <strong><span style="color:#B0D9B1">공부 내용</span></strong></h2> +<h3 id="span-stylecolord0e7d2연결-리스트-linked-listspan"><span style="color:#D0E7D2">연결 리스트 Linked List</span></h3> +<ul> +<li> +<p><strong>추상적 자료구조 Abstract Data Structures</strong></p> +<ul> +<li>내부 구현에는 신경쓸 필요 없는 구조</li> +<li>data &amp; a set of operations</li> +<li>이 두 가지를 <strong>추상적으로 보여줌</strong></li> +</ul> +</li> +<li> +<p><strong>Linke List?</strong></p> +<ul> +<li>Node가 선형적으로 연결된 구조</li> +</ul> +</li> +<li> +<p><strong>Node &amp; LinkedList 구현</strong></p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"> <span class="k">class</span> <span class="nc">Node</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">item</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="o">=</span> <span class="n">item</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">next</span> <span class="o">=</span> <span class="kc">None</span> <span class="c1"># 다음 노드를 가리킴</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">class</span> <span class="nc">LinkedList</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span> <span class="o">=</span> <span class="mi">0</span> <span class="c1"># 노드의 총 갯수</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">head</span> <span class="o">=</span> <span class="kc">None</span> <span class="c1"># 첫번째 노드</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">tail</span> <span class="o">=</span> <span class="kc">None</span> <span class="c1"># 마지막 노드</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li> +<p><strong>Linked List 연산 (operations)</strong></p> +<p>linked list의 index는 1부터 시작 / 0은 다른 용도로 사용(Dummy node)</p> +<h6 id="실습으로-구현한-코드만-첨부했음">(실습으로 구현한 코드만 첨부했음)</h6> +<ul> +<li> +<p>kth element 참조</p> +</li> +<li> +<p>리스트 순회</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span><span class="lnt">5 +</span><span class="lnt">6 +</span><span class="lnt">7 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"> <span class="k">def</span> <span class="nf">traverse</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">curr</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">head</span> +</span></span><span class="line"><span class="cl"> <span class="n">returnList</span> <span class="o">=</span> <span class="p">[]</span> +</span></span><span class="line"><span class="cl"> <span class="k">while</span> <span class="n">curr</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">returnList</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">curr</span><span class="o">.</span><span class="n">data</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="n">curr</span> <span class="o">=</span> <span class="n">curr</span><span class="o">.</span><span class="n">next</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">returnList</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li> +<p>길이 얻기</p> +</li> +<li> +<p>원소 삽입</p> +<ul> +<li>Time complexity +<ul> +<li>맨 앞에 삽입 : O(1)</li> +<li>중간에 삽입 : O(n)</li> +<li>맨 끝에 삽입 : (Tail pointer가 있기 때문에) O(1)</li> +</ul> +</li> +</ul> +</li> +<li> +<p>원소 삭제</p> +<ul> +<li>Time complexity +<ul> +<li>맨 앞에 삽입 : O(1)</li> +<li>중간에 삽입 : O(n)</li> +<li>맨 끝에 삽입 : O(n) +→ 이 상황을 피하기 위해 이중 연결 리스트를 사용</li> +</ul> +</li> +</ul> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span><span class="lnt">14 +</span><span class="lnt">15 +</span><span class="lnt">16 +</span><span class="lnt">17 +</span><span class="lnt">18 +</span><span class="lnt">19 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"> <span class="c1"># 삭제한 node 데이터를 반환</span> +</span></span><span class="line"><span class="cl"> <span class="k">def</span> <span class="nf">popAt</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">pos</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">pos</span> <span class="o">&lt;</span> <span class="mi">1</span> <span class="ow">or</span> <span class="n">pos</span> <span class="o">&gt;</span> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="k">raise</span> <span class="ne">IndexError</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">pos</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span> <span class="o">=</span> <span class="kc">None</span> +</span></span><span class="line"><span class="cl"> <span class="n">curr</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">head</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">head</span> <span class="o">=</span> <span class="n">curr</span><span class="o">.</span><span class="n">next</span> +</span></span><span class="line"><span class="cl"> <span class="k">else</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">getAt</span><span class="p">(</span><span class="n">pos</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="n">curr</span> <span class="o">=</span> <span class="n">prev</span><span class="o">.</span><span class="n">next</span> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span><span class="o">.</span><span class="n">next</span> <span class="o">=</span> <span class="n">curr</span><span class="o">.</span><span class="n">next</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">pos</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">tail</span> <span class="o">=</span> <span class="n">prev</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span> <span class="o">-=</span> <span class="mi">1</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">curr</span><span class="o">.</span><span class="n">data</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li> +<p>두 리스트 합치기 concat</p> +</li> +</ul> +</li> +<li> +<p><strong>배열 Array vs 연결 리스트 Linked List</strong></p> +<table> +<thead> +<tr> +<th></th> +<th>배열</th> +<th>연결 리스트</th> +</tr> +</thead> +<tbody> +<tr> +<td>저장 공간</td> +<td>연속된 위치</td> +<td>임의의 위치</td> +</tr> +<tr> +<td>특정 원소 참조</td> +<td>매우 간편</td> +<td>선형탐색과 유사</td> +</tr> +<tr> +<td></td> +<td>O(1)</td> +<td>O(n)</td> +</tr> +</tbody> +</table> +<p><em>time complexity에 불리함이 있는데도 사용하는 이유는?</em></p> +</li> +<li> +<p><strong>연결 리스트 Linked List의 힘</strong></p> +<ul> +<li>유연한 삽입 및 삭제</li> +<li>Head, Tail에 dummy node를 추가하여 간편하고 직관적인 설계 가능</li> +<li>추가 구현 operations +<ul> +<li> +<p>insertAfter(prev, node)</p> +</li> +<li> +<p>popAfter(prev) &amp; popAt(pos)</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span><span class="lnt">14 +</span><span class="lnt">15 +</span><span class="lnt">16 +</span><span class="lnt">17 +</span><span class="lnt">18 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">popAfter</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">prev</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">curr</span> <span class="o">=</span> <span class="n">prev</span><span class="o">.</span><span class="n">next</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">curr</span> <span class="ow">is</span> <span class="kc">None</span> <span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="kc">None</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">curr</span><span class="o">.</span><span class="n">next</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">tail</span> <span class="o">=</span> <span class="n">prev</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span><span class="o">.</span><span class="n">next</span> <span class="o">=</span> <span class="n">curr</span><span class="o">.</span><span class="n">next</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span> <span class="o">-=</span> <span class="mi">1</span> <span class="c1"># nodeCount 꼭 체크하기</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">curr</span><span class="o">.</span><span class="n">data</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">popAt</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">pos</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">pos</span> <span class="o">&lt;</span> <span class="mi">1</span> <span class="ow">or</span> <span class="n">pos</span> <span class="o">&gt;</span> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="k">raise</span> <span class="ne">IndexError</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">getAt</span><span class="p">(</span><span class="n">pos</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">popAfter</span><span class="p">(</span><span class="n">prev</span><span class="p">)</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +</ul> +</li> +</ul> +</li> +</ul> +<hr> +<h3 id="span-stylecolord0e7d2양방향--이중-연결-리스트-double-linked-listspan"><span style="color:#D0E7D2">양방향 / 이중 연결 리스트 Double Linked List</span></h3> +<ul> +<li><strong>양쪽</strong>으로 연결된 link +- next node, previous node로 두 방향 모두 진행 가능 +- 메모리 사용량이 늘어나지만, 앞에서뿐만 아니라 뒤에서도 데이터를 찾아갈 수 있다는게 장점 +<ul> +<li>getAt() 함수 또한 pos가 중간값 이상일 때는 뒤에서부터 찾도록 구현할 수 있음</li> +</ul> +</li> +<li><strong>operations</strong> +<ul> +<li> +<p>reverse</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span><span class="lnt">5 +</span><span class="lnt">6 +</span><span class="lnt">7 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">reverse</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">result</span> <span class="o">=</span> <span class="p">[]</span> +</span></span><span class="line"><span class="cl"> <span class="n">curr</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">tail</span> +</span></span><span class="line"><span class="cl"> <span class="k">while</span> <span class="n">curr</span><span class="o">.</span><span class="n">prev</span><span class="o">.</span><span class="n">prev</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">curr</span> <span class="o">=</span> <span class="n">curr</span><span class="o">.</span><span class="n">prev</span> +</span></span><span class="line"><span class="cl"> <span class="n">result</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">curr</span><span class="o">.</span><span class="n">data</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">result</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li> +<p>insertBefore</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span><span class="lnt">5 +</span><span class="lnt">6 +</span><span class="lnt">7 +</span><span class="lnt">8 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">insertBefore</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">next</span><span class="p">,</span> <span class="n">newNode</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span> <span class="o">=</span> <span class="nb">next</span><span class="o">.</span><span class="n">prev</span> +</span></span><span class="line"><span class="cl"> <span class="n">newNode</span><span class="o">.</span><span class="n">next</span> <span class="o">=</span> <span class="nb">next</span> +</span></span><span class="line"><span class="cl"> <span class="n">newNode</span><span class="o">.</span><span class="n">prev</span> <span class="o">=</span> <span class="n">prev</span> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span><span class="o">.</span><span class="n">next</span> <span class="o">=</span> <span class="n">newNode</span> +</span></span><span class="line"><span class="cl"> <span class="nb">next</span><span class="o">.</span><span class="n">prev</span> <span class="o">=</span> <span class="n">newNode</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span> <span class="o">+=</span> <span class="mi">1</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="kc">True</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li> +<p>popAfter, popBefore, popAt</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span><span class="lnt">14 +</span><span class="lnt">15 +</span><span class="lnt">16 +</span><span class="lnt">17 +</span><span class="lnt">18 +</span><span class="lnt">19 +</span><span class="lnt">20 +</span><span class="lnt">21 +</span><span class="lnt">22 +</span><span class="lnt">23 +</span><span class="lnt">24 +</span><span class="lnt">25 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">popAfter</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">prev</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">curr</span> <span class="o">=</span> <span class="n">prev</span><span class="o">.</span><span class="n">next</span> +</span></span><span class="line"><span class="cl"> <span class="nb">next</span> <span class="o">=</span> <span class="n">curr</span><span class="o">.</span><span class="n">next</span> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span><span class="o">.</span><span class="n">next</span> <span class="o">=</span> <span class="nb">next</span> +</span></span><span class="line"><span class="cl"> <span class="nb">next</span><span class="o">.</span><span class="n">prev</span> <span class="o">=</span> <span class="n">prev</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span> <span class="o">-=</span> <span class="mi">1</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">curr</span><span class="o">.</span><span class="n">data</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">popBefore</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">next</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">curr</span> <span class="o">=</span> <span class="nb">next</span><span class="o">.</span><span class="n">prev</span> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span> <span class="o">=</span> <span class="n">curr</span><span class="o">.</span><span class="n">prev</span> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span><span class="o">.</span><span class="n">next</span> <span class="o">=</span> <span class="nb">next</span> +</span></span><span class="line"><span class="cl"> <span class="nb">next</span><span class="o">.</span><span class="n">prev</span> <span class="o">=</span> <span class="n">prev</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span> <span class="o">-=</span> <span class="mi">1</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">curr</span><span class="o">.</span><span class="n">data</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">popAt</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">pos</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">pos</span> <span class="o">&lt;</span> <span class="mi">1</span> <span class="ow">or</span> <span class="n">pos</span> <span class="o">&gt;</span> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="k">raise</span> <span class="ne">IndexError</span> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">getAt</span><span class="p">(</span><span class="n">pos</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">popAfter</span><span class="p">(</span><span class="n">prev</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="c1"># next = self.getAt(pos+1) # getAt 함수가 pos == nodeCount+1 일 때 지원을 하지 않아서 사용은 어려움</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># next = self.getAt(pos).next #로 사용 가능</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># return self.popBefore(next)</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li> +<p>concat(self, L)</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span><span class="lnt">5 +</span><span class="lnt">6 +</span><span class="lnt">7 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">concat</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">L</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">lastNode</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">tail</span><span class="o">.</span><span class="n">prev</span> +</span></span><span class="line"><span class="cl"> <span class="n">firstNode</span> <span class="o">=</span> <span class="n">L</span><span class="o">.</span><span class="n">head</span><span class="o">.</span><span class="n">next</span> +</span></span><span class="line"><span class="cl"> <span class="n">lastNode</span><span class="o">.</span><span class="n">next</span> <span class="o">=</span> <span class="n">firstNode</span> +</span></span><span class="line"><span class="cl"> <span class="n">firstNode</span><span class="o">.</span><span class="n">prev</span> <span class="o">=</span> <span class="n">lastNode</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">tail</span> <span class="o">=</span> <span class="n">L</span><span class="o">.</span><span class="n">tail</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span> <span class="o">+=</span> <span class="n">L</span><span class="o">.</span><span class="n">nodeCount</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +</ul> +</li> +</ul> +<hr> +<h3 id="span-stylecolord0e7d2스택-stackspan"><span style="color:#D0E7D2">스택 Stack</span></h3> +<ul> +<li><strong>data element를 보관할 수 있는 선형 구조 / LIFO</strong></li> +<li><strong>operations</strong> +<ul> +<li>size()</li> +<li>isEmpty()</li> +<li>push(x) +<ul> +<li>꽉 찬 스택에 push(x)로 원소를 더 추가하려고 할 때 <code>stack overflow</code> 발생</li> +</ul> +</li> +<li>pop() +<ul> +<li>비어있는 스택에서 pop()으로 없는 원소를 꺼내려 할 때 <code>stack underflow</code> 발생</li> +</ul> +</li> +<li>peek() +<ul> +<li>데이터 참조, 제거하지는 않음</li> +</ul> +</li> +</ul> +</li> +<li><strong>추상적 자료구조로 구현</strong> +<ul> +<li>Array 또는 LinkedList 이용</li> +<li>만들어져있는 Stack library 를 import 할 수도 있음 +<code>from pythonds.basic.stack import Stack</code></li> +</ul> +</li> +</ul> +<hr> +<ul> +<li> +<p><strong>스택의 응용 1) 후위 표기법으로 변환</strong></p> +<ul> +<li>중위 표기법 (infix notation) : (A+B) * (C+D) +→ 후위 표기법 (postfix notation) : AB+CD+*</li> +<li>알고리즘 설계 +<ul> +<li> +<p>operator 연산자를 스택에 넣는 방식</p> +</li> +<li> +<p>연산자 우선순위 설정</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">prec</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;*&#39;</span><span class="p">:</span><span class="mi">3</span><span class="p">,</span> <span class="s1">&#39;/&#39;</span><span class="p">:</span><span class="mi">3</span><span class="p">,</span> <span class="s1">&#39;+&#39;</span><span class="p">:</span><span class="mi">2</span><span class="p">,</span> <span class="s1">&#39;-&#39;</span><span class="p">:</span><span class="mi">2</span><span class="p">,</span> <span class="s1">&#39;(&#39;</span><span class="p">:</span><span class="mi">1</span><span class="p">}</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li> +<p>구현 코드</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span><span class="lnt">14 +</span><span class="lnt">15 +</span><span class="lnt">16 +</span><span class="lnt">17 +</span><span class="lnt">18 +</span><span class="lnt">19 +</span><span class="lnt">20 +</span><span class="lnt">21 +</span><span class="lnt">22 +</span><span class="lnt">23 +</span><span class="lnt">24 +</span><span class="lnt">25 +</span><span class="lnt">26 +</span><span class="lnt">27 +</span><span class="lnt">28 +</span><span class="lnt">29 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">solution</span><span class="p">(</span><span class="n">S</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">opStack</span> <span class="o">=</span> <span class="n">ArrayStack</span><span class="p">()</span> +</span></span><span class="line"><span class="cl"> <span class="n">charList</span> <span class="o">=</span> <span class="p">[]</span> <span class="c1"># 수식을 리스트 형태로 저장한 후 .join을 통해 문자열로 변환</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">s</span> <span class="ow">in</span> <span class="n">S</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">s</span> <span class="ow">in</span> <span class="n">prec</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span> <span class="c1"># 연산자 + 여는 괄호</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">s</span> <span class="o">==</span> <span class="s2">&#34;(&#34;</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">opStack</span><span class="o">.</span><span class="n">push</span><span class="p">(</span><span class="n">s</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="k">else</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="k">while</span> <span class="ow">not</span> <span class="n">opStack</span><span class="o">.</span><span class="n">isEmpty</span><span class="p">():</span> <span class="c1"># 스택이 비어있는 동안 계속</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">prec</span><span class="p">[</span><span class="n">opStack</span><span class="o">.</span><span class="n">peek</span><span class="p">()]</span> <span class="o">&gt;=</span> <span class="n">prec</span><span class="p">[</span><span class="n">s</span><span class="p">]:</span> <span class="c1"># 스택 맨 위의 우선순위가 높거나 같은 경우에만</span> +</span></span><span class="line"><span class="cl"> <span class="n">charList</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">opStack</span><span class="o">.</span><span class="n">pop</span><span class="p">())</span> <span class="c1"># pop()하여 문자열에 출력</span> +</span></span><span class="line"><span class="cl"> <span class="k">else</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="k">break</span> +</span></span><span class="line"><span class="cl"> <span class="n">opStack</span><span class="o">.</span><span class="n">push</span><span class="p">(</span><span class="n">s</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">elif</span> <span class="n">s</span> <span class="o">==</span> <span class="s2">&#34;)&#34;</span><span class="p">:</span> <span class="c1"># 닫는 괄호</span> +</span></span><span class="line"><span class="cl"> <span class="k">while</span> <span class="n">opStack</span><span class="o">.</span><span class="n">peek</span><span class="p">()</span> <span class="o">!=</span> <span class="s2">&#34;(&#34;</span><span class="p">:</span> <span class="c1"># 여는 괄호가 나올때까지 모든 연산자를 꺼내 출력</span> +</span></span><span class="line"><span class="cl"> <span class="n">charList</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">opStack</span><span class="o">.</span><span class="n">pop</span><span class="p">())</span> +</span></span><span class="line"><span class="cl"> <span class="n">opStack</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> <span class="c1"># pop &#39;(&#39;</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">else</span><span class="p">:</span> <span class="c1"># 피연산자</span> +</span></span><span class="line"><span class="cl"> <span class="n">charList</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">s</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">while</span> <span class="ow">not</span> <span class="n">opStack</span><span class="o">.</span><span class="n">isEmpty</span><span class="p">():</span> <span class="c1"># 스택에 남아있는 연산자들을 모두 출력</span> +</span></span><span class="line"><span class="cl"> <span class="n">charList</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">opStack</span><span class="o">.</span><span class="n">pop</span><span class="p">())</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="n">answer</span> <span class="o">=</span> <span class="s2">&#34;&#34;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">charList</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">answer</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +</ul> +</li> +</ul> +</li> +<li> +<p><strong>스택의 응용 2) 후위 표기법 계산</strong></p> +<ul> +<li>앞에서부터 뒤로 읽어나가면서 먼저 만나는 연산자를 먼저 계산</li> +<li>알고리즘 설계 +<ul> +<li> +<p>operands 피연산자들을 스택에 넣는 방식</p> +</li> +<li> +<p>구현 코드</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span><span class="lnt">14 +</span><span class="lnt">15 +</span><span class="lnt">16 +</span><span class="lnt">17 +</span><span class="lnt">18 +</span><span class="lnt">19 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">postfixEval</span><span class="p">(</span><span class="n">tokenList</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">valStack</span> <span class="o">=</span> <span class="n">ArrayStack</span><span class="p">()</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">t</span> <span class="ow">in</span> <span class="n">tokenList</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="nb">type</span><span class="p">(</span><span class="n">t</span><span class="p">)</span> <span class="ow">is</span> <span class="nb">int</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">valStack</span><span class="o">.</span><span class="n">push</span><span class="p">(</span><span class="n">t</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="k">else</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">b</span> <span class="o">=</span> <span class="n">valStack</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> +</span></span><span class="line"><span class="cl"> <span class="n">a</span> <span class="o">=</span> <span class="n">valStack</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">t</span> <span class="o">==</span> <span class="s1">&#39;*&#39;</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">valStack</span><span class="o">.</span><span class="n">push</span><span class="p">(</span><span class="n">a</span><span class="o">*</span><span class="n">b</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="k">elif</span> <span class="n">t</span> <span class="o">==</span> <span class="s1">&#39;/&#39;</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">valStack</span><span class="o">.</span><span class="n">push</span><span class="p">(</span><span class="n">a</span><span class="o">/</span><span class="n">b</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="k">elif</span> <span class="n">t</span> <span class="o">==</span> <span class="s1">&#39;+&#39;</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">valStack</span><span class="o">.</span><span class="n">push</span><span class="p">(</span><span class="n">a</span><span class="o">+</span><span class="n">b</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="k">elif</span> <span class="n">t</span> <span class="o">==</span> <span class="s1">&#39;-&#39;</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">valStack</span><span class="o">.</span><span class="n">push</span><span class="p">(</span><span class="n">a</span><span class="o">-</span><span class="n">b</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">valStack</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +</ul> +</li> +</ul> +</li> +</ul> +<h2 id="span-stylecolorb0d9b1checkspan">👀 <strong><span style="color:#B0D9B1">CHECK</span></strong></h2> +<h6 id="어렵거나-새롭게-알게-된-것-등-다시-확인할-것들"><em>(어렵거나 새롭게 알게 된 것 등 다시 확인할 것들)</em></h6> +<ul> +<li> +<p>member field, member method</p> +<ul> +<li>용어의 뜻은 알지만 애매해서 다시 정리하기 위해 찾아봄 <br> +<a class="link" href="https://as-i-am-programing.tistory.com/7" target="_blank" rel="noopener" + >정리에 참고한 사이트</a></li> +</ul> +</li> +<li> +<p>추상적 자료구조</p> +<ul> +<li>abstract data type vs. data structure +<ul> +<li>an ADT (Abstract Data Type) is more of a logical description, while a Data Structure is concrete.</li> +</ul> +</li> +<li><a class="link" href="https://velog.io/@hwan2da/%EC%9E%90%EB%A3%8C%EA%B5%AC%EC%A1%B0-%EC%B6%94%EC%83%81%EC%9E%90%EB%A3%8C%ED%98%95" target="_blank" rel="noopener" + >정리에 참고한 사이트 : 추상적 자료형 vs. 자료구조</a></li> +</ul> +</li> +<li> +<p>dummy node를 추가한 구조의 linked list</p> +</li> +<li> +<p>stack underflow</p> +</li> +</ul> +<h2 id="span-stylecolorb0d9b1느낀-점span">‼️ <strong><span style="color:#B0D9B1">느낀 점</span></strong></h2> +<p>오늘은 두 가지 교훈(?) 을 얻었다.</p> +<ol> +<li> +<p>한번에 두가지 일을 하지 않기 +강의를 들으면서 TIL을 적으려고 했는데, 외려 더 정신없고 힘들었다. 강의 듣는 중간에 적다 보니, 그냥 받아쓰기가 되는것도 별로였다. 큰 주제 (오늘 같은 경우 LinkedList / Stack)를 다 듣고 정리하는게 나을 듯!</p> +</li> +<li> +<p>사소한 실수 하지 않고 꼼꼼하게 체크하기 +오늘 연습문제를 풀면서</p> +<blockquote> +</blockquote> +<p>node.data 대신 node 객체를 반환함 +linked list의 nodeCount 증감시키는걸 빼먹음</p> +<p>명시된 조건을 빼먹는 실수를 저질러서 디버깅 한다고 다 합해서 한시간 가까이 소모했다. +몰라서 못 푸는것 보다 이런 부분에서 꼼꼼하지 못해서 못 푸는게 더 싫다. 심지어 원래는 그렇게 자주 하는 실수도 아니어서 자존심이 더 상했다. ㅠㅠ <br> +그래도 이런 날이 있어야 앞으로 안 그럴 수 있으니까 계속 담아두지는 말아야지!</p> +</li> +</ol> +<p>내일은 강의와 실습을 꼼꼼하게 진행하고, 내가 이해한 내용을 토대로 TIL을 잘 적어봐야겠다. :&gt;. +그리고 내일은 github 블로그에 올려봐야지! 🔥 어렵지만 할 만한 가치가 있어보인다 😊</p> + + + + + diff --git a/public/tags/linkedlist/page/1/index.html b/public/tags/linkedlist/page/1/index.html new file mode 100644 index 0000000..c07112d --- /dev/null +++ b/public/tags/linkedlist/page/1/index.html @@ -0,0 +1,10 @@ + + + + https://srlee056.github.io/tags/linkedlist/ + + + + + + diff --git a/public/tags/markdown/index.xml b/public/tags/markdown/index.xml deleted file mode 100644 index 988466c..0000000 --- a/public/tags/markdown/index.xml +++ /dev/null @@ -1,273 +0,0 @@ - - - - markdown on Seorim Log - https://srlee056.github.io/tags/markdown/ - Recent content in markdown on Seorim Log - Hugo -- gohugo.io - en - Seorim Lee - Mon, 11 Mar 2019 00:00:00 +0000 - Markdown Syntax Guide - https://srlee056.github.io/p/markdown-syntax-guide/ - Mon, 11 Mar 2019 00:00:00 +0000 - - https://srlee056.github.io/p/markdown-syntax-guide/ - <img src="https://srlee056.github.io/p/markdown-syntax-guide/pawel-czerwinski-8uZPynIu-rQ-unsplash.jpg" alt="Featured image of post Markdown Syntax Guide" /><p>This article offers a sample of basic Markdown syntax that can be used in Hugo content files, also it shows whether basic HTML elements are decorated with CSS in a Hugo theme.</p> -<h2 id="headings">Headings</h2> -<p>The following HTML <code>&lt;h1&gt;</code>—<code>&lt;h6&gt;</code> elements represent six levels of section headings. <code>&lt;h1&gt;</code> is the highest section level while <code>&lt;h6&gt;</code> is the lowest.</p> -<h1 id="h1">H1</h1> -<h2 id="h2">H2</h2> -<h3 id="h3">H3</h3> -<h4 id="h4">H4</h4> -<h5 id="h5">H5</h5> -<h6 id="h6">H6</h6> -<h2 id="paragraph">Paragraph</h2> -<p>Xerum, quo qui aut unt expliquam qui dolut labo. Aque venitatiusda cum, voluptionse latur sitiae dolessi aut parist aut dollo enim qui voluptate ma dolestendit peritin re plis aut quas inctum laceat est volestemque commosa as cus endigna tectur, offic to cor sequas etum rerum idem sintibus eiur? Quianimin porecus evelectur, cum que nis nust voloribus ratem aut omnimi, sitatur? Quiatem. Nam, omnis sum am facea corem alique molestrunt et eos evelece arcillit ut aut eos eos nus, sin conecerem erum fuga. Ri oditatquam, ad quibus unda veliamenimin cusam et facea ipsamus es exerum sitate dolores editium rerore eost, temped molorro ratiae volorro te reribus dolorer sperchicium faceata tiustia prat.</p> -<p>Itatur? Quiatae cullecum rem ent aut odis in re eossequodi nonsequ idebis ne sapicia is sinveli squiatum, core et que aut hariosam ex eat.</p> -<h2 id="blockquotes">Blockquotes</h2> -<p>The blockquote element represents content that is quoted from another source, optionally with a citation which must be within a <code>footer</code> or <code>cite</code> element, and optionally with in-line changes such as annotations and abbreviations.</p> -<h4 id="blockquote-without-attribution">Blockquote without attribution</h4> -<blockquote> -<p>Tiam, ad mint andaepu dandae nostion secatur sequo quae. -<strong>Note</strong> that you can use <em>Markdown syntax</em> within a blockquote.</p> -</blockquote> -<h4 id="blockquote-with-attribution">Blockquote with attribution</h4> -<blockquote> -<p>Don&rsquo;t communicate by sharing memory, share memory by communicating.<br> -— <cite>Rob Pike<sup id="fnref:1"><a href="#fn:1" class="footnote-ref" role="doc-noteref">1</a></sup></cite></p> -</blockquote> -<h2 id="tables">Tables</h2> -<p>Tables aren&rsquo;t part of the core Markdown spec, but Hugo supports supports them out-of-the-box.</p> -<table> -<thead> -<tr> -<th>Name</th> -<th>Age</th> -</tr> -</thead> -<tbody> -<tr> -<td>Bob</td> -<td>27</td> -</tr> -<tr> -<td>Alice</td> -<td>23</td> -</tr> -</tbody> -</table> -<h4 id="inline-markdown-within-tables">Inline Markdown within tables</h4> -<table> -<thead> -<tr> -<th>Italics</th> -<th>Bold</th> -<th>Code</th> -</tr> -</thead> -<tbody> -<tr> -<td><em>italics</em></td> -<td><strong>bold</strong></td> -<td><code>code</code></td> -</tr> -</tbody> -</table> -<table> -<thead> -<tr> -<th>A</th> -<th>B</th> -<th>C</th> -<th>D</th> -<th>E</th> -<th>F</th> -</tr> -</thead> -<tbody> -<tr> -<td>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</td> -<td>Phasellus ultricies, sapien non euismod aliquam, dui ligula tincidunt odio, at accumsan nulla sapien eget ex.</td> -<td>Proin eleifend dictum ipsum, non euismod ipsum pulvinar et. Vivamus sollicitudin, quam in pulvinar aliquam, metus elit pretium purus</td> -<td>Proin sit amet velit nec enim imperdiet vehicula.</td> -<td>Ut bibendum vestibulum quam, eu egestas turpis gravida nec</td> -<td>Sed scelerisque nec turpis vel viverra. Vivamus vitae pretium sapien</td> -</tr> -</tbody> -</table> -<h2 id="code-blocks">Code Blocks</h2> -<h4 id="code-block-with-backticks">Code block with backticks</h4> -<div class="highlight"><div class="chroma"> -<table class="lntable"><tr><td class="lntd"> -<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 -</span><span class="lnt"> 2 -</span><span class="lnt"> 3 -</span><span class="lnt"> 4 -</span><span class="lnt"> 5 -</span><span class="lnt"> 6 -</span><span class="lnt"> 7 -</span><span class="lnt"> 8 -</span><span class="lnt"> 9 -</span><span class="lnt">10 -</span></code></pre></td> -<td class="lntd"> -<pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl"><span class="cp">&lt;!doctype html&gt;</span> -</span></span><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">html</span> <span class="na">lang</span><span class="o">=</span><span class="s">&#34;en&#34;</span><span class="p">&gt;</span> -</span></span><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">head</span><span class="p">&gt;</span> -</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">meta</span> <span class="na">charset</span><span class="o">=</span><span class="s">&#34;utf-8&#34;</span><span class="p">&gt;</span> -</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">title</span><span class="p">&gt;</span>Example HTML5 Document<span class="p">&lt;/</span><span class="nt">title</span><span class="p">&gt;</span> -</span></span><span class="line"><span class="cl"><span class="p">&lt;/</span><span class="nt">head</span><span class="p">&gt;</span> -</span></span><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">body</span><span class="p">&gt;</span> -</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">p</span><span class="p">&gt;</span>Test<span class="p">&lt;/</span><span class="nt">p</span><span class="p">&gt;</span> -</span></span><span class="line"><span class="cl"><span class="p">&lt;/</span><span class="nt">body</span><span class="p">&gt;</span> -</span></span><span class="line"><span class="cl"><span class="p">&lt;/</span><span class="nt">html</span><span class="p">&gt;</span> -</span></span></code></pre></td></tr></table> -</div> -</div><h4 id="code-block-indented-with-four-spaces">Code block indented with four spaces</h4> -<pre><code>&lt;!doctype html&gt; -&lt;html lang=&quot;en&quot;&gt; -&lt;head&gt; - &lt;meta charset=&quot;utf-8&quot;&gt; - &lt;title&gt;Example HTML5 Document&lt;/title&gt; -&lt;/head&gt; -&lt;body&gt; - &lt;p&gt;Test&lt;/p&gt; -&lt;/body&gt; -&lt;/html&gt; -</code></pre> -<h4 id="code-block-with-hugos-internal-highlight-shortcode">Code block with Hugo&rsquo;s internal highlight shortcode</h4> -<div class="highlight"><div class="chroma"> -<table class="lntable"><tr><td class="lntd"> -<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 -</span><span class="lnt"> 2 -</span><span class="lnt"> 3 -</span><span class="lnt"> 4 -</span><span class="lnt"> 5 -</span><span class="lnt"> 6 -</span><span class="lnt"> 7 -</span><span class="lnt"> 8 -</span><span class="lnt"> 9 -</span><span class="lnt">10 -</span></code></pre></td> -<td class="lntd"> -<pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl"><span class="cp">&lt;!doctype html&gt;</span> -</span></span><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">html</span> <span class="na">lang</span><span class="o">=</span><span class="s">&#34;en&#34;</span><span class="p">&gt;</span> -</span></span><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">head</span><span class="p">&gt;</span> -</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">meta</span> <span class="na">charset</span><span class="o">=</span><span class="s">&#34;utf-8&#34;</span><span class="p">&gt;</span> -</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">title</span><span class="p">&gt;</span>Example HTML5 Document<span class="p">&lt;/</span><span class="nt">title</span><span class="p">&gt;</span> -</span></span><span class="line"><span class="cl"><span class="p">&lt;/</span><span class="nt">head</span><span class="p">&gt;</span> -</span></span><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">body</span><span class="p">&gt;</span> -</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">p</span><span class="p">&gt;</span>Test<span class="p">&lt;/</span><span class="nt">p</span><span class="p">&gt;</span> -</span></span><span class="line"><span class="cl"><span class="p">&lt;/</span><span class="nt">body</span><span class="p">&gt;</span> -</span></span><span class="line"><span class="cl"><span class="p">&lt;/</span><span class="nt">html</span><span class="p">&gt;</span></span></span></code></pre></td></tr></table> -</div> -</div> -<h4 id="diff-code-block">Diff code block</h4> -<div class="highlight"><div class="chroma"> -<table class="lntable"><tr><td class="lntd"> -<pre tabindex="0" class="chroma"><code><span class="lnt">1 -</span><span class="lnt">2 -</span><span class="lnt">3 -</span><span class="lnt">4 -</span><span class="lnt">5 -</span></code></pre></td> -<td class="lntd"> -<pre tabindex="0" class="chroma"><code class="language-diff" data-lang="diff"><span class="line"><span class="cl">[dependencies.bevy] -</span></span><span class="line"><span class="cl">git = &#34;https://github.com/bevyengine/bevy&#34; -</span></span><span class="line"><span class="cl">rev = &#34;11f52b8c72fc3a568e8bb4a4cd1f3eb025ac2e13&#34; -</span></span><span class="line"><span class="cl"><span class="gd">- features = [&#34;dynamic&#34;] -</span></span></span><span class="line"><span class="cl"><span class="gd"></span><span class="gi">+ features = [&#34;jpeg&#34;, &#34;dynamic&#34;] -</span></span></span></code></pre></td></tr></table> -</div> -</div><h2 id="list-types">List Types</h2> -<h4 id="ordered-list">Ordered List</h4> -<ol> -<li>First item</li> -<li>Second item</li> -<li>Third item</li> -</ol> -<h4 id="unordered-list">Unordered List</h4> -<ul> -<li>List item</li> -<li>Another item</li> -<li>And another item</li> -</ul> -<h4 id="nested-list">Nested list</h4> -<ul> -<li>Fruit -<ul> -<li>Apple</li> -<li>Orange</li> -<li>Banana</li> -</ul> -</li> -<li>Dairy -<ul> -<li>Milk</li> -<li>Cheese</li> -</ul> -</li> -</ul> -<h2 id="other-elements--abbr-sub-sup-kbd-mark">Other Elements — abbr, sub, sup, kbd, mark</h2> -<p><abbr title="Graphics Interchange Format">GIF</abbr> is a bitmap image format.</p> -<p>H<sub>2</sub>O</p> -<p>X<sup>n</sup> + Y<sup>n</sup> = Z<sup>n</sup></p> -<p>Press <kbd>CTRL</kbd> + <kbd>ALT</kbd> + <kbd>Delete</kbd> to end the session.</p> -<p>Most <mark>salamanders</mark> are nocturnal, and hunt for insects, worms, and other small creatures.</p> -<h2 id="hyperlinked-image">Hyperlinked image</h2> -<p><a class="link" href="https://google.com" target="_blank" rel="noopener" - ><img src="https://www.google.com/images/branding/googlelogo/1x/googlelogo_light_color_272x92dp.png" - - - - loading="lazy" - - alt="Google" - - -></a></p> -<div class="footnotes" role="doc-endnotes"> -<hr> -<ol> -<li id="fn:1"> -<p>The above quote is excerpted from Rob Pike&rsquo;s <a class="link" href="https://www.youtube.com/watch?v=PAAkCSZUG1c" target="_blank" rel="noopener" - >talk</a> during Gopherfest, November 18, 2015.&#160;<a href="#fnref:1" class="footnote-backref" role="doc-backlink">&#x21a9;&#xfe0e;</a></p> -</li> -</ol> -</div> - - - Placeholder Text - https://srlee056.github.io/p/placeholder-text/ - Sat, 09 Mar 2019 00:00:00 +0000 - - https://srlee056.github.io/p/placeholder-text/ - <img src="https://srlee056.github.io/p/placeholder-text/matt-le-SJSpo9hQf7s-unsplash.jpg" alt="Featured image of post Placeholder Text" /><p>Lorem est tota propiore conpellat pectoribus de pectora summo.</p> -<p>Redit teque digerit hominumque toris verebor lumina non cervice subde tollit usus habet Arctonque, furores quas nec ferunt. Quoque montibus nunc caluere tempus inhospita parcite confusaque translucet patri vestro qui optatis lumine cognoscere flos nubis! Fronde ipsamque patulos Dryopen deorum.</p> -<ol> -<li>Exierant elisi ambit vivere dedere</li> -<li>Duce pollice</li> -<li>Eris modo</li> -<li>Spargitque ferrea quos palude</li> -</ol> -<p>Rursus nulli murmur; hastile inridet ut ab gravi sententia! Nomine potitus silentia flumen, sustinet placuit petis in dilapsa erat sunt. Atria tractus malis.</p> -<ol> -<li>Comas hunc haec pietate fetum procerum dixit</li> -<li>Post torum vates letum Tiresia</li> -<li>Flumen querellas</li> -<li>Arcanaque montibus omnes</li> -<li>Quidem et</li> -</ol> -<h1 id="vagus-elidunt">Vagus elidunt</h1> -<p><svg class="canon" xmlns="http://www.w3.org/2000/svg" overflow="visible" viewBox="0 0 496 373" height="373" width="496"><g fill="none"><path stroke="#000" stroke-width=".75" d="M.599 372.348L495.263 1.206M.312.633l494.95 370.853M.312 372.633L247.643.92M248.502.92l246.76 370.566M330.828 123.869V1.134M330.396 1.134L165.104 124.515"></path><path stroke="#ED1C24" stroke-width=".75" d="M275.73 41.616h166.224v249.05H275.73zM54.478 41.616h166.225v249.052H54.478z"></path><path stroke="#000" stroke-width=".75" d="M.479.375h495v372h-495zM247.979.875v372"></path><ellipse cx="498.729" cy="177.625" rx=".75" ry="1.25"></ellipse><ellipse cx="247.229" cy="377.375" rx=".75" ry="1.25"></ellipse></g></svg></p> -<p><a class="link" href="https://en.wikipedia.org/wiki/Canons_of_page_construction#Van_de_Graaf_canon" target="_blank" rel="noopener" - >The Van de Graaf Canon</a></p> -<h2 id="mane-refeci-capiebant-unda-mulcebat">Mane refeci capiebant unda mulcebat</h2> -<p>Victa caducifer, malo vulnere contra dicere aurato, ludit regale, voca! Retorsit colit est profanae esse virescere furit nec; iaculi matertera et visa est, viribus. Divesque creatis, tecta novat collumque vulnus est, parvas. <strong>Faces illo pepulere</strong> tempus adest. Tendit flamma, ab opes virum sustinet, sidus sequendo urbis.</p> -<p>Iubar proles corpore raptos vero auctor imperium; sed et huic: manus caeli Lelegas tu lux. Verbis obstitit intus oblectamina fixis linguisque ausus sperare Echionides cornuaque tenent clausit possit. Omnia putatur. Praeteritae refert ausus; ferebant e primus lora nutat, vici quae mea ipse. Et iter nil spectatae vulnus haerentia iuste et exercebat, sui et.</p> -<p>Eurytus Hector, materna ipsumque ut Politen, nec, nate, ignari, vernum cohaesit sequitur. Vel <strong>mitis temploque</strong> vocatus, inque alis, <em>oculos nomen</em> non silvis corpore coniunx ne displicet illa. Crescunt non unus, vidit visa quantum inmiti flumina mortis facto sic: undique a alios vincula sunt iactata abdita! Suspenderat ego fuit tendit: luna, ante urbem Propoetides <strong>parte</strong>.</p> - - - - diff --git a/public/tags/page/1/index.html b/public/tags/page/1/index.html index 0adee57..7a7631e 100644 --- a/public/tags/page/1/index.html +++ b/public/tags/page/1/index.html @@ -1,5 +1,5 @@ - + https://srlee056.github.io/tags/ diff --git a/public/tags/page/2/index.html b/public/tags/page/2/index.html index 0aa016a..bf47f2b 100644 --- a/public/tags/page/2/index.html +++ b/public/tags/page/2/index.html @@ -1,18 +1,20 @@ - + - + Tags - + - - + + - + + +
@@ -270,10 +268,10 @@

좋은 개발자로 한걸음 더

- - + + - + +

+ + +
+ + + + + + + + + + + + 🤩 + +
+ + + +
+

서림록

+

좋은 개발자로 한걸음 더

+
+
+ + +
+ + +
+
+

+ + 섹션 + +

+ +
+
+

22 페이지

+

Tags

+ +
+
+
+ + +
+ + + + + + + + + + + +
+ + +
+ + +
+ Hugo로 만듦
+ JimmyStack 테마 사용 중 +
+
+ + +
+ + + + + + diff --git a/public/tags/page/4/index.html b/public/tags/page/4/index.html new file mode 100644 index 0000000..e32502e --- /dev/null +++ b/public/tags/page/4/index.html @@ -0,0 +1,554 @@ + + + + +Tags + + + + + + + + + + + + + + + +
+ + + + +
+
+

+ + 섹션 + +

+ +
+
+

22 페이지

+

Tags

+ +
+
+
+ + +
+ + + + + + + + + + + +
+ + +
+ + +
+ Hugo로 만듦
+ JimmyStack 테마 사용 중 +
+
+ + +
+
+ + + + + diff --git a/public/tags/themes/index.html b/public/tags/page/5/index.html similarity index 77% rename from public/tags/themes/index.html rename to public/tags/page/5/index.html index 3c0f54d..1bbf575 100644 --- a/public/tags/themes/index.html +++ b/public/tags/page/5/index.html @@ -1,18 +1,20 @@ - + - -Tag: themes - Seorim Log - - - - - - - - - - + +Tags + + + + + + + + + + + +
@@ -270,10 +268,10 @@

좋은 개발자로 한걸음 더

- - + + - + +

+ + +
+ + + + + + + + + + + + 🤩 + +
+ + + +
+

서림록

+

좋은 개발자로 한걸음 더

+
+
+ + +
+ + +
+
+

+ + Tags + +

+ +
+
+

1 페이지

+

Queue

+ +
+
+
+ +
+ + + +
+
+ + +
+ Hugo로 만듦
+ JimmyStack 테마 사용 중 +
+
+ + +
+ + + + + + diff --git a/public/tags/queue/index.xml b/public/tags/queue/index.xml new file mode 100644 index 0000000..0367570 --- /dev/null +++ b/public/tags/queue/index.xml @@ -0,0 +1,269 @@ + + + + Queue on 서림록 + https://srlee056.github.io/tags/queue/ + Recent content in Queue on 서림록 + Hugo -- gohugo.io + ko + Seorim Lee + Wed, 18 Oct 2023 00:00:00 +0000 + Day 3 + https://srlee056.github.io/p/day-3/ + Wed, 18 Oct 2023 00:00:00 +0000 + + https://srlee056.github.io/p/day-3/ + <h1 id="span-stylecolor79ac78til---queue-tree--heapspan"><strong><span style="color:#79AC78">TIL - Queue, Tree &amp; Heap</span></strong></h1> +<h2 id="span-stylecolorb0d9b1공부-내용span">📋 <strong><span style="color:#B0D9B1">공부 내용</span></strong></h2> +<h3 id="span-stylecolord0e7d2queuesspan"><span style="color:#D0E7D2">Queues</span></h3> +<ul> +<li> +<p>Queue?</p> +<ul> +<li>FIFO (First In First Out)</li> +<li>operations +<ul> +<li>enqueue</li> +<li>dequeue +<ul> +<li>선형 배열으로 구현: <code>O(n)</code> -&gt; 연결 리스트로 구현하는것이 더 좋음</li> +</ul> +</li> +</ul> +</li> +</ul> +</li> +<li> +<p>Circular Queues</p> +<ul> +<li>배열의 한쪽 끝과 다른쪽 끝이 닿아 있는 모습</li> +<li>원소의 개수가 정해져있음</li> +<li><code>front / rear 포인터</code>를 기억하고, dequeue된 원소 저장소는 재활용</li> +<li>선형 배열으로 구현하는것이 더 좋음</li> +</ul> +</li> +<li> +<p>Priority Queues</p> +<ul> +<li>원소들 사이의 우선순위를 따름</li> +<li>우선순위 구현 +<ul> +<li>원소를 넣을 때 enqueue vs. 원소를 꺼낼 때 dequeue +<ul> +<li>넣을 때(enqueue) 우선순위에 따라 정렬하는것이 조금 더 나은 Time Complexity를 가짐</li> +<li>데이터를 관리하고 활용하는 데에도 더 편리함</li> +</ul> +</li> +</ul> +</li> +</ul> +</li> +</ul> +<h3 id="span-stylecolord0e7d2treesspan"><span style="color:#D0E7D2">Trees</span></h3> +<ul> +<li> +<p><strong>Tree?</strong></p> +<ul> +<li>구성 +<ul> +<li>root node</li> +<li>interner nodes</li> +<li>leaf nodes</li> +</ul> +</li> +<li>특성 +<ul> +<li>parent node / child node</li> +<li>노드의 수준 (level) : root node로부터 거리</li> +<li>노드의 차수 (degree) : 노드의 자식 수</li> +<li>트리의 높이(height) 또는 깊이(depth) : 제일 큰 level + 1</li> +<li>subtree</li> +</ul> +</li> +</ul> +</li> +<li> +<p><strong>Binary Trees</strong></p> +<ul> +<li>모든 node의 degree &lt;= 2</li> +<li>operations +<ul> +<li>size()</li> +<li>depth()</li> +<li>순회 traversal +<ul> +<li>Depth First Traversal : 재귀 호출을 통해 구현 +<ul> +<li>inorder</li> +<li>preorder</li> +<li>postorder</li> +</ul> +</li> +<li>Breadth Tirst Traversal : queue 사용! +<ul> +<li>level이 낮은 노드를 우선으로 방문</li> +<li>같은 level인 경우 부모 노드의 순서를 따름</li> +</ul> +</li> +</ul> +</li> +</ul> +</li> +<li>포화 이진 트리 (full binary trees) +<ul> +<li>모든 node의 degree == 2</li> +</ul> +</li> +<li>완전 이진 트리 (complete binary trees) +<ul> +<li>(depth k) <code>level k-2</code>까지는 full binary tree, <code>level k-1</code>은 왼쪽부터 node 채워짐</li> +</ul> +</li> +</ul> +</li> +<li> +<p><strong>Binary Search Trees</strong></p> +<ul> +<li>모든 노드에 대해 다음 성질을 만족하는 Binary Tree +<ul> +<li>왼쪽 subtree&rsquo;s data &lt; 현재 node&rsquo;s data &lt; 오른쪽 subtree&rsquo;s data</li> +</ul> +</li> +<li>장단점 +<ul> +<li>장점 : 원소의 추가, 삭제가 편함</li> +<li>단점 : 큰 공간을 소요함 (연결 리스트로 구현)</li> +</ul> +</li> +<li>operations +<ul> +<li>insert()</li> +<li>remove()</li> +<li>lookup()</li> +<li>inorder()</li> +<li>min(), max()</li> +</ul> +</li> +</ul> +</li> +</ul> +<h3 id="span-stylecolord0e7d2heapspan"><span style="color:#D0E7D2">Heap</span></h3> +<ul> +<li>Heaps? +<ul> +<li> +<p>Binary Tree의 한 종류 (binary heap)</p> +</li> +<li> +<p>Min / Max heap</p> +<ul> +<li>root node가 항상 최소/최대 값을 가진다</li> +<li>complete binary tree +<ul> +<li><code>n</code> nodes -&gt; depth <code>log(n)+1</code></li> +<li>insert / remove operation의 Time Complexity : <code>O(log(n))</code></li> +</ul> +</li> +<li>subtree 또한 Min / Max heap</li> +</ul> +</li> +<li> +<p>Binary Seacrh Tree vs. Heap?</p> +<table> +<thead> +<tr> +<th></th> +<th>BST</th> +<th>Heap</th> +</tr> +</thead> +<tbody> +<tr> +<td>데이터 정렬</td> +<td>크기순서대로 완전 정렬</td> +<td>완전 정렬 X</td> +</tr> +<tr> +<td>데이터 검색</td> +<td>O</td> +<td>X</td> +</tr> +<tr> +<td>완전 이진 트리</td> +<td>X</td> +<td>O</td> +</tr> +<tr> +<td>연산 시간</td> +<td>(최악의 경우) O(n)</td> +<td>O(log(n))</td> +</tr> +<tr> +<td>선형 배열로 구현</td> +<td>X</td> +<td>O</td> +</tr> +</tbody> +</table> +</li> +<li> +<p>operations</p> +<ul> +<li>insert()</li> +<li>remove()</li> +</ul> +</li> +</ul> +</li> +</ul> +<h2 id="span-stylecolorb0d9b1checkspan">👀 <strong><span style="color:#B0D9B1">CHECK</span></strong></h2> +<h6 id="어렵거나-새롭게-알게-된-것-등-다시-확인할-것들"><em>(어렵거나 새롭게 알게 된 것 등 다시 확인할 것들)</em></h6> +<ul> +<li><strong>노드의 차수(degree) : # of children</strong> +<ul> +<li>binary tree : 모든 노드의 degree가 항상 2이하</li> +<li>leaf nodes : degree 0</li> +</ul> +</li> +<li><strong>단축 평가</strong> +<ul> +<li><a class="link" href="https://pydole.tistory.com/entry/Python-%EB%8B%A8%EC%B6%95%ED%8F%89%EA%B0%80short-circuit-evalution" target="_blank" rel="noopener" + >단축평가에 대해 참고한 블로그</a></li> +<li>2개 이상의 논리 조건식이 있을 경우에, <strong>앞 조건이 계산한 값에 의해 결과가 확실해지면 두번째 조건은 확인하지 않음</strong></li> +<li>False and (), True or () 인 경우 등이 해당됨</li> +</ul> +</li> +</ul> +<h2 id="span-stylecolorb0d9b1느낀-점span">❗ <strong><span style="color:#B0D9B1">느낀 점</span></strong></h2> +<p>어제의 교훈이 있어서 그런지, 오늘은 프로그래밍 과정에 실수가 적었다. +그리고, 자료구조를 구현하는 과정에서 더 나은 방식에 대해 고민하는 상황이 많아졌다.</p> +<p>오늘 주로 고민한 부분은</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span><span class="lnt">5 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-fallback" data-lang="fallback"><span class="line"><span class="cl">코드를 더 직관적으로 적고싶음 +</span></span><span class="line"><span class="cl">- 반복되는 같은 코드를 합칠 수 있는가? +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl">같은 코드 다른 효율? +</span></span><span class="line"><span class="cl">- 같은 기능을 하지만 살짝 다른 두 코드 중 더 나은것은? +</span></span></code></pre></td></tr></table> +</div> +</div><p>정도였다.</p> +<p>전자는 내가 평소 프로그래밍 할 때 자주 하긴 하는데, 항상 고민하는 부분이다. +반복되는 기능을 함수로 빼던가, 적용되는 변수를 리스트로 묶어서 반복하는 등의 방법을 쓰는데, 다른 방법은 뭐가 있을까 고민하고 있다.</p> +<p>후자는 Complexity를 구하는 방법에 대한 의문이 아니다. 실제로 이 operation이 어떻게 구현되고 있는지, 왜 그렇게 구현되었는지가 궁금한 것이다. <br> +실습 문제에서 우선순위 queue를 구현할 때, skeleton code의 dequeue 함수는 마지막 elements를 가져오는 방식으로 되어있었다.(<code>getAt(data.size())</code>) <br> +나는 처음 element를 가져오는 방식으로 생각하고(<code>getAt(1)</code>) 이에 해당하는 enqueue 함수를 작성했기 때문에 잠깐 막혔다가, 결국은 눈치채고 해결했다.<br> +그 코드를 보면서 이렇게 구현하는게 더 나은건지 궁금증이 들었고, 같은 기능을 하지만 결함이 적은(?) 코드를 작성하자는 생각이 들었다.</p> +<p>오늘은 추가 알고리즘 문제들이 있고 아직 풀지 않았는데, 쉬운 문제들이지만 이 두가지를 생각하면서 풀려고 노력해야겠다.</p> + + + + + diff --git a/public/tags/queue/page/1/index.html b/public/tags/queue/page/1/index.html new file mode 100644 index 0000000..8c81008 --- /dev/null +++ b/public/tags/queue/page/1/index.html @@ -0,0 +1,10 @@ + + + + https://srlee056.github.io/tags/queue/ + + + + + + diff --git a/public/tags/requests/index.html b/public/tags/requests/index.html new file mode 100644 index 0000000..7a3ba8a --- /dev/null +++ b/public/tags/requests/index.html @@ -0,0 +1,479 @@ + + + + +Tag: requests - 서림록 + + + + + + + + + + + + + + + +
+ + + + +
+
+

+ + Tags + +

+ +
+
+

1 페이지

+

requests

+ +
+
+
+ +
+ + + +
+
+ + +
+ Hugo로 만듦
+ JimmyStack 테마 사용 중 +
+
+ + +
+
+ + + + + diff --git a/public/tags/requests/index.xml b/public/tags/requests/index.xml new file mode 100644 index 0000000..66d89dc --- /dev/null +++ b/public/tags/requests/index.xml @@ -0,0 +1,192 @@ + + + + requests on 서림록 + https://srlee056.github.io/tags/requests/ + Recent content in requests on 서림록 + Hugo -- gohugo.io + ko + Seorim Lee + Tue, 24 Oct 2023 00:00:00 +0000 + Day 7 + https://srlee056.github.io/p/day-7/ + Tue, 24 Oct 2023 00:00:00 +0000 + + https://srlee056.github.io/p/day-7/ + <h1 id="span-stylecolor79ac78til---httpspan"><span style="color:#79AC78">TIL - HTTP</span></h1> +<h2 id="span-stylecolorb0d9b1공부-내용span">📋 <span style="color:#B0D9B1">공부 내용</span></h2> +<h3 id="span-stylecolord0e7d2웹span"><span style="color:#D0E7D2">웹</span></h3> +<h4 id="span-stylecolorf9b572웹-페이지와-htmlspan"><span style="color:#F9B572">웹 페이지와 HTML</span></h4> +<p>웹 페이지</p> +<ul> +<li>웹 속의 <strong>문서 하나</strong></li> +<li>ex) 네이버 메인 페이지</li> +<li>HTML으로 구성되어있음</li> +</ul> +<p>웹 사이트</p> +<ul> +<li>여러 웹 페이지의 모음</li> +<li>ex) <em>네이버</em>라는 웹 사이트</li> +</ul> +<p>웹 브라우저</p> +<ul> +<li>HTTP요청을 보낸 후, HTTP응답에 담긴 HTML문서를 사용자가 보기 쉽게 화면으로 그려주는 (렌더링) 역할</li> +</ul> +<p><a class="link" href="https://velog.io/@srlee056/%EB%8D%B0%EC%9D%B4%ED%84%B0-%EC%97%94%EC%A7%80%EB%8B%88%EC%96%B4%EB%A7%81-%EB%8D%B0%EB%B8%8C%EC%BD%94%EC%8A%A4-6%EC%9D%BC%EC%B0%A8" target="_blank" rel="noopener" + >HTML(개념 정리 글 링크)</a></p> +<ul> +<li>이전 강의에서 다룬 내용 참고</li> +<li>웹 브라우저마다 지원하는 태그와 속성이 달라짐</li> +</ul> +<h4 id="span-stylecolorf9b572웹-스크래핑--웹-크롤링span"><span style="color:#F9B572">웹 스크래핑 / 웹 크롤링</span></h4> +<p>웹 스크래핑</p> +<ul> +<li>특정 목적에 따라 웹 페이지에서 원하는 데이터를 &ldquo;추출&rdquo;</li> +<li>ex) 날씨 정보 가져오기, 주식 데이터 가져오기, &hellip;</li> +</ul> +<p>웹 크롤링</p> +<ul> +<li>크롤러를 이용해 URL을 타고 이동하며 반복적으로 웹 페이지의 데이터를 가져와 &ldquo;인덱싱&rdquo;(데이터 색인)</li> +<li>구글, 네이버 등 검색 엔진의 웹 크롤러</li> +</ul> +<h4 id="span-stylecolorf9b572올바른-http-requestspan"><span style="color:#F9B572">올바른 HTTP Request</span></h4> +<p>올바른 HTTP Request를 위해선..</p> +<ul> +<li>어떤 목적을 달성하려 하는가?</li> +<li>서버에 영향을 미치는가?</li> +</ul> +<p>로봇 배제 프로토콜(REP)</p> +<ul> +<li>웹 크롤링, 스크래핑은 로봇에 의해 실행 가능</li> +<li>사이트의 모든 정보를 취득하는것이 정당한가? 의문에서 시작</li> +<li>robots.txt +<ul> +<li>각 사이트마다 허용하는 크롤러 정보와 허용범위에 대한 정보를 담고 있음</li> +<li>User-agent, Disallow, Allow</li> +</ul> +</li> +</ul> +<h3 id="span-stylecolord0e7d2httpspan"><span style="color:#D0E7D2">HTTP</span></h3> +<h4 id="span-stylecolorf9b572httpspan"><span style="color:#F9B572">HTTP?</span></h4> +<blockquote> +<p>HyterText Transfer Protocol<br> +웹 상에서 정보를 주고받기 위한 <em>약속</em></p> +</blockquote> +<table> +<thead> +<tr> +<th></th> +<th>HTTP Request</th> +<th>HTTP Response</th> +</tr> +</thead> +<tbody> +<tr> +<td>방향</td> +<td>Client -&gt; Server</td> +<td>Client &lt;- Server</td> +</tr> +<tr> +<td>역할</td> +<td>정보 요청</td> +<td>요청에 대한 내용을 담은 응답</td> +</tr> +<tr> +<td>HEAD</td> +<td>method, path, &hellip;</td> +<td>content-type, date, &hellip;</td> +</tr> +<tr> +<td>BODY</td> +<td></td> +<td>document</td> +</tr> +</tbody> +</table> +<h4 id="span-stylecolorf9b572통신하기span"><span style="color:#F9B572">통신하기</span></h4> +<p><code>requests</code></p> +<ul> +<li>Python으로 HTTP 통신을 진행할 수 있게 해주는 라이브러리</li> +</ul> +<p><code>GET</code></p> +<ul> +<li>naver 메인 페이지를 요청하는 코드</li> +</ul> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">requests</span> +</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">requests</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&#34;https://www.naver.com&#34;</span><span class="p">)</span> <span class="c1"># HTTP Response</span> +</span></span><span class="line"><span class="cl"><span class="n">res</span><span class="o">.</span><span class="n">headers</span> <span class="c1"># Header 확인</span> +</span></span><span class="line"><span class="cl"><span class="n">res</span><span class="o">.</span><span class="n">text</span> <span class="c1"># Body(document) text 형태로 확인</span> +</span></span></code></pre></td></tr></table> +</div> +</div><p><code>POST</code></p> +<ul> +<li><a class="link" href="https://webhook.site" target="_blank" rel="noopener" + >https://webhook.site</a> 를 통해 POST 통신을 진행할 수 있음</li> +</ul> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">payload</span> <span class="o">=</span> <span class="p">{</span><span class="s2">&#34;name&#34;</span><span class="p">:</span> <span class="s2">&#34;Hello&#34;</span><span class="p">,</span> <span class="s2">&#34;age&#34;</span><span class="p">:</span> <span class="mi">13</span><span class="p">}</span> +</span></span><span class="line"><span class="cl"><span class="n">url</span> <span class="o">=</span> <span class="s2">&#34;https://webhook.site/&lt;개인 주소&gt;&#34;</span> +</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">requests</span><span class="o">.</span><span class="n">post</span><span class="p">(</span><span class="n">url</span><span class="p">,</span> <span class="n">payload</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"><span class="n">res</span><span class="o">.</span><span class="n">status_code</span> <span class="c1"># 상태 코드 확인</span> +</span></span></code></pre></td></tr></table> +</div> +</div><h3 id="span-stylecolord0e7d2domspan"><span style="color:#D0E7D2">DOM</span></h3> +<h4 id="span-stylecolorf9b572domspan"><span style="color:#F9B572">DOM?</span></h4> +<blockquote> +<p>Document Object Model<br> +HTML을 파싱하여, 브라우저가 이해하도록 만든 Tree형태의 자료구조</p> +</blockquote> +<ul> +<li> +<p>DOM의 각 노드를 객체로 생각하여, 문서를 편리하게 관리할 수 있음</p> +</li> +<li> +<p>원하는 요소를 동적으로 변경할 수 있음</p> +</li> +<li> +<p>원하는 요소를 쉽게 찾을 수 있음</p> +</li> +<li> +<p>python으로 HTML을 직접 분석하려면 DOM을 생성해주는 브라우저를 거치지 않기 때문에, +직접 HTML을 분석하는 <code>HTML Parser</code>가 필요</p> +</li> +</ul> +<h2 id="span-stylecolorb0d9b1checkspan">👀 <span style="color:#B0D9B1">CHECK</span></h2> +<p><em><span style = "font-size:15px">(어렵거나 새롭게 알게 된 것 등 다시 확인할 것들)</span></em></p> +<ul> +<li> +<p>Jupyter lab</p> +<ul> +<li>Jupyter notebook이나 Colab은 써 봤는데 Jupyter lab은 처음 접해봄</li> +<li>Jupyter notebook과 비슷하지만 더 개선된 버전(?)</li> +</ul> +</li> +<li> +<p>DOM에 대한 설명 및 활용 : 복습 후 다른 예시들을 더 찾아볼 것</p> +</li> +</ul> +<h2 id="span-stylecolorb0d9b1느낀-점span">❗ <span style="color:#B0D9B1">느낀 점</span></h2> +<p>HTML 스크래핑을 해본적이 있어서 이론이나 실습 모두 빠르게 진행했다. 5시간 분량의 강의인데 3시간 내로 끝난 것 같다. TIL을 잘 적고 싶어서 고민을 좀 했고 그 외의 시간은 평소보다는 널널하게 흘려보냈다.</p> +<p>TIL을 적을 때 기존에는 강의 받아쓰기처럼 적는 경향이 있었는데, 나중에 다시 읽어보니 이해하고 쓴 것 같은 느낌이 전혀 들지 않았다. 어제 HTML이론에 대한 TIL은 실습 부분 외에도 직접 사용해보고 하면서 적은거라, &lsquo;내가 직접 써보고 이해한 내용&rsquo;임을 알 수 있었다. 그런데 초반에 적은 TIL을 다시 보니까 그냥 받아적은게 티가 나기도 하고 잘 기억이 나지 않았다.</p> +<p>오늘은 강의를 처음부터 끝까지 들은 후 키워드만 체크해 필기한 다음, TIL을 적으면서 중간중간 다시 듣는 방식을 사용했다. 이 방식으로 더 잘 읽히고 짜임새 있는 구성의 글을 쓰게 되어서 만족스러웠다. TIL 쓰는 시간은 오래 걸리지만 익숙해지면 줄어들 것 같아서 걱정은 되지 않는다.</p> +<p>커리큘럼을 보니 내일부터는 BeautifulSoup를 사용해 스크래핑을 시작하는데, 모르는 부분이 많을 것 같아 벌써부터 기대가 된다. :&gt;</p> + + + + + diff --git a/public/tags/markdown/page/1/index.html b/public/tags/requests/page/1/index.html similarity index 67% rename from public/tags/markdown/page/1/index.html rename to public/tags/requests/page/1/index.html index a881bea..4b98a30 100644 --- a/public/tags/markdown/page/1/index.html +++ b/public/tags/requests/page/1/index.html @@ -1,10 +1,10 @@ - + - https://srlee056.github.io/tags/markdown/ - + https://srlee056.github.io/tags/requests/ + - + diff --git a/public/tags/shortcodes/index.xml b/public/tags/shortcodes/index.xml deleted file mode 100644 index 4063710..0000000 --- a/public/tags/shortcodes/index.xml +++ /dev/null @@ -1,135 +0,0 @@ - - - - shortcodes on Seorim Log - https://srlee056.github.io/tags/shortcodes/ - Recent content in shortcodes on Seorim Log - Hugo -- gohugo.io - en - Seorim Lee - Sun, 10 Mar 2019 00:00:00 +0000 - Rich Content - https://srlee056.github.io/p/rich-content/ - Sun, 10 Mar 2019 00:00:00 +0000 - - https://srlee056.github.io/p/rich-content/ - <p>Hugo ships with several <a class="link" href="https://gohugo.io/content-management/shortcodes/#use-hugo-s-built-in-shortcodes" target="_blank" rel="noopener" - >Built-in Shortcodes</a> for rich content, along with a <a class="link" href="https://gohugo.io/about/hugo-and-gdpr/" target="_blank" rel="noopener" - >Privacy Config</a> and a set of Simple Shortcodes that enable static and no-JS versions of various social media embeds.</p> -<hr> -<h2 id="youtube-privacy-enhanced-shortcode">YouTube Privacy Enhanced Shortcode</h2> -<div class="video-wrapper"> - <iframe loading="lazy" - src="https://www.youtube.com/embed/ZJthWmvUzzc" - allowfullscreen - title="YouTube Video" - > - </iframe> -</div> - -<br> -<hr> -<h2 id="twitter-simple-shortcode">Twitter Simple Shortcode</h2> - - <style type="text/css"> - .twitter-tweet { - font: 14px/1.45 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif; - border-left: 4px solid #2b7bb9; - padding-left: 1.5em; - color: #555; - } - .twitter-tweet a { - color: #2b7bb9; - text-decoration: none; - } - blockquote.twitter-tweet a:hover, - blockquote.twitter-tweet a:focus { - text-decoration: underline; - } - </style> - <blockquote class="twitter-tweet"><p lang="en" dir="ltr">“In addition to being more logical, asymmetry has the advantage that its complete appearance is far more optically effective than symmetry.”<br>— Jan Tschichold <a href="https://t.co/gcv7SrhvJb">pic.twitter.com/gcv7SrhvJb</a></p>&mdash; Graphic Design History (@DesignReviewed) <a href="https://twitter.com/DesignReviewed/status/1085870671291310081?ref_src=twsrc%5Etfw">January 17, 2019</a></blockquote> - -<br> -<hr> -<h2 id="vimeo-simple-shortcode">Vimeo Simple Shortcode</h2> - - - - - - -<style> -.__h_video { - position: relative; - padding-bottom: 56.23%; - height: 0; - overflow: hidden; - width: 100%; - background: #000; -} -.__h_video img { - width: 100%; - height: auto; - color: #000; -} -.__h_video .play { - height: 72px; - width: 72px; - left: 50%; - top: 50%; - margin-left: -36px; - margin-top: -36px; - position: absolute; - cursor: pointer; -} -</style> - - -<div class="s_video_simple __h_video"> -<a href="https://vimeo.com/4.8912912e&#43;07" rel="noopener" target="_blank"> - - -<img src="https://i.vimeocdn.com/video/337401969-979f0cc9f55fdf305fb8984e90d92639ec9d7ecc4c9dfbc6536e28edb43784ce-d_640" srcset="https://i.vimeocdn.com/video/337401969-979f0cc9f55fdf305fb8984e90d92639ec9d7ecc4c9dfbc6536e28edb43784ce-d_640 1x, https://i.vimeocdn.com/video/337401969-979f0cc9f55fdf305fb8984e90d92639ec9d7ecc4c9dfbc6536e28edb43784ce-d_640 2x" alt="Sing Jan Swing - Kinetic Type"> -<div class="play"><svg version="1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 61 61"><circle cx="30.5" cy="30.5" r="30.5" opacity=".8" fill="#000"></circle><path d="M25.3 19.2c-2.1-1.2-3.8-.2-3.8 2.2v18.1c0 2.4 1.7 3.4 3.8 2.2l16.6-9.1c2.1-1.2 2.1-3.2 0-4.4l-16.6-9z" fill="#fff"></path></svg></div></a></div> -<h2 id="bilibilibi-shortcode">bilibilibi Shortcode</h2> - - - - - - - - - -<div class="video-wrapper"> - <iframe src="https://player.bilibili.com/player.html?as_wide=1&amp;high_quality=1&amp;page=1&aid=498363026" - scrolling="no" - frameborder="no" - framespacing="0" - allowfullscreen="true" - > - </iframe> -</div> - -<h2 id="gist-shortcode">Gist Shortcode</h2> -<script type="application/javascript" src="https://gist.github.com/spf13/7896402.js"></script> - -<h2 id="gitlab-snippets-shortcode">Gitlab Snippets Shortcode</h2> -<script - type="application/javascript" - src="https://gitlab.com/-/snippets/2349278.js" -></script> -<h2 id="quote-shortcode">Quote Shortcode</h2> -<p>Stack adds a <code>quote</code> shortcode. For example:</p> -<blockquote> - <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p><span class="cite"><span>― </span><span>A famous person, </span><a href="https://en.wikipedia.org/wiki/Book"><cite>The book they wrote</cite></a></span></blockquote> -<blockquote> - <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p><span class="cite"><span>― </span><a href="https://en.wikipedia.org/wiki/Book"><cite>Anonymous book</cite></a></span></blockquote> -<blockquote> - <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p><span class="cite"><span>― </span><cite>Some book</cite></span></blockquote> -<blockquote> - <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p><span class="cite"><span>― </span><span>Somebody</span><cite></cite></span></blockquote> - - - - diff --git a/public/tags/shortcodes/page/1/index.html b/public/tags/shortcodes/page/1/index.html deleted file mode 100644 index 7f7a8ad..0000000 --- a/public/tags/shortcodes/page/1/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - https://srlee056.github.io/tags/shortcodes/ - - - - - - diff --git a/public/tags/sort/index.html b/public/tags/sort/index.html new file mode 100644 index 0000000..a03aa19 --- /dev/null +++ b/public/tags/sort/index.html @@ -0,0 +1,479 @@ + + + + +Tag: Sort - 서림록 + + + + + + + + + + + + + + + +
+ + + + +
+
+

+ + Tags + +

+ +
+
+

1 페이지

+

Sort

+ +
+
+
+ +
+ + + +
+
+ + +
+ Hugo로 만듦
+ JimmyStack 테마 사용 중 +
+
+ + +
+
+ + + + + diff --git a/public/tags/sort/index.xml b/public/tags/sort/index.xml new file mode 100644 index 0000000..f4d8204 --- /dev/null +++ b/public/tags/sort/index.xml @@ -0,0 +1,206 @@ + + + + Sort on 서림록 + https://srlee056.github.io/tags/sort/ + Recent content in Sort on 서림록 + Hugo -- gohugo.io + ko + Seorim Lee + Thu, 19 Oct 2023 00:00:00 +0000 + Day 4 + https://srlee056.github.io/p/day-4/ + Thu, 19 Oct 2023 00:00:00 +0000 + + https://srlee056.github.io/p/day-4/ + <h1 id="span-stylecolor79ac78til---hash--greedy--sort-문제풀이-위주span"><strong><span style="color:#79AC78">TIL - Hash / Greedy &amp; Sort (문제풀이 위주)</span></strong></h1> +<h2 id="span-stylecolorb0d9b1공부-내용span">📋 <strong><span style="color:#B0D9B1">공부 내용</span></strong></h2> +<h3 id="span-stylecolord0e7d2hashspan"><span style="color:#D0E7D2">Hash</span></h3> +<ul> +<li> +<p>Hash?<br> +개념 정리가 필요하다고 느껴서 글을 따로 발행했다.</p> +<ul> +<li> +<p><a class="link" href="https://www.baeldung.com/cs/hash-tables" target="_blank" rel="noopener" + >Understanding Hash Table</a></p> +</li> +<li> +<p><a class="link" href="https://velog.io/@srlee056/Hash-Table-%EC%9D%B4%ED%95%B4%ED%95%98%EA%B8%B0" target="_blank" rel="noopener" + >(번역 및 정리)Hash Table 이해하기</a></p> +</li> +</ul> +</li> +<li> +<p><code>완주하지 못한 선수</code> 문제풀이</p> +<ul> +<li>python dictionary 를 활용하여 hasing 구현</li> +</ul> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">solution</span><span class="p">(</span><span class="n">participant</span><span class="p">,</span> <span class="n">completion</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">answer</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span> +</span></span><span class="line"><span class="cl"> <span class="n">pDict</span> <span class="o">=</span> <span class="p">{}</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># 참가자/ 완주자 정보가 주어질 때, 이름을 key로 활용하여 dictionary 형태에 넣고 빼는 방식으로</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># (동명이인이 있을 때에도) 어떤 이름을 가진 사람이 완주를 하지 못했는지 확인할 수 있다. </span> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">participant</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">pDict</span><span class="p">[</span><span class="n">p</span><span class="p">]</span> <span class="o">=</span> <span class="n">pDict</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> <span class="o">+</span> <span class="mi">1</span> <span class="c1">#.get()을 통해 default 값을 세팅하는 한 방법</span> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">completion</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">pDict</span><span class="p">[</span><span class="n">p</span><span class="p">]</span> <span class="o">-=</span> <span class="mi">1</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="n">incompletion</span> <span class="o">=</span> <span class="p">[</span><span class="n">k</span> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">pDict</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> <span class="k">if</span> <span class="n">v</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">]</span> +</span></span><span class="line"><span class="cl"> <span class="n">answer</span> <span class="o">=</span> <span class="n">incompletion</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">answer</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +</ul> +<h3 id="span-stylecolord0e7d2greedy-algorithmspan"><span style="color:#D0E7D2">Greedy Algorithm</span></h3> +<ul> +<li> +<p>탐욕법(greedy algorithm)</p> +<ul> +<li>알고리즘의 각 단계에서 <strong>그 순간의 최적의 선택</strong>을 함</li> +<li>탐욕법으로 최적해를 찾을 수 있는 문제<br> += 현재 선택이 마지막 답의 최적성을 해치지 않는 문제</li> +</ul> +</li> +<li> +<p><code>체육복</code> 문제풀이</p> +<ul> +<li>비슷해보이는 조건문이라해도 그 순서에 따라 전혀 다른 결과가 나올 수 있음</li> +<li>작은 번호부터 큰 번호로 순회하기 때문에, 작은 번호가 조건을 만족하는지 먼저 고려함</li> +</ul> +</li> +<li> +<p><code>큰 수 만들기</code> 문제풀이</p> +<ul> +<li>매 단계마다 작은 숫자를 지우는 탐욕법을 사용하며, 이 방식은 마지막에 최적성을 충족하게 됨</li> +</ul> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span><span class="lnt">14 +</span><span class="lnt">15 +</span><span class="lnt">16 +</span><span class="lnt">17 +</span><span class="lnt">18 +</span><span class="lnt">19 +</span><span class="lnt">20 +</span><span class="lnt">21 +</span><span class="lnt">22 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">solution</span><span class="p">(</span><span class="n">number</span><span class="p">,</span> <span class="n">k</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">collected</span> <span class="o">=</span> <span class="p">[]</span> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">num</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">number</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># collected에 미리 들어간 원소가 있을 것</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># 제일 마지막으로 들어간 원소는 현재 num 값보다 작을 것</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># (제거해야 하는 숫자의 개수) k가 0보다 클 것</span> +</span></span><span class="line"><span class="cl"> <span class="k">while</span> <span class="nb">len</span><span class="p">(</span><span class="n">collected</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="ow">and</span> <span class="n">collected</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">&lt;</span> <span class="n">num</span> <span class="ow">and</span> <span class="n">k</span> <span class="o">&gt;</span><span class="mi">0</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">collected</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> +</span></span><span class="line"><span class="cl"> <span class="n">k</span> <span class="o">-=</span><span class="mi">1</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">k</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">collected</span> <span class="o">+=</span> <span class="nb">list</span><span class="p">(</span><span class="n">number</span><span class="p">[</span><span class="n">i</span><span class="p">:])</span> +</span></span><span class="line"><span class="cl"> <span class="k">break</span> +</span></span><span class="line"><span class="cl"> <span class="n">collected</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">num</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="c1"># 제거해야 하는 숫자의 개수가 남아있을 때 </span> +</span></span><span class="line"><span class="cl"> <span class="c1"># (코드가 너무 직관적이고 예뻤다. :&gt;)</span> +</span></span><span class="line"><span class="cl"> <span class="n">collected</span> <span class="o">=</span> <span class="n">collected</span><span class="p">[:</span><span class="o">-</span><span class="n">k</span><span class="p">]</span> <span class="k">if</span> <span class="n">k</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="k">else</span> <span class="n">collected</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="n">answer</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">collected</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">answer</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +</ul> +<h3 id="span-stylecolord0e7d2sortspan"><span style="color:#D0E7D2">Sort</span></h3> +<ul> +<li><code>가장 큰 수</code> 문제풀이 +<ul> +<li>자릿수가 다른 숫자들을 문자열처럼 나열하여 더 큰 숫자를 만들 때, 숫자들의 우선순위를 정하는 방법은?</li> +</ul> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span><span class="lnt">5 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">sortedNumbers</span> <span class="o">=</span> <span class="nb">sorted</span><span class="p">(</span><span class="nb">map</span><span class="p">(</span><span class="nb">str</span><span class="p">,</span> <span class="n">numbers</span><span class="p">),</span> <span class="n">key</span> <span class="o">=</span> <span class="k">lambda</span> <span class="n">x</span> <span class="p">:</span> <span class="p">(</span><span class="n">x</span> <span class="o">*</span> <span class="mi">4</span><span class="p">)[:</span><span class="mi">4</span><span class="p">],</span> <span class="n">reverse</span> <span class="o">=</span> <span class="kc">True</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"><span class="c1"># map(str, numbers) : numbers 정수 리스트를 문자열 리스트로 변환</span> +</span></span><span class="line"><span class="cl"><span class="c1"># sorted(..., reverse = True) : 주어진 조건으로 정렬하며, 내림차순으로 반환</span> +</span></span><span class="line"><span class="cl"><span class="c1"># lambda x : (x*4)[:4] : 네 자리 수까지 주어지므로 4번 반복 후 네번째자리까지 끊음</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +</ul> +<h2 id="span-stylecolorb0d9b1checkspan">👀 <strong><span style="color:#B0D9B1">CHECK</span></strong></h2> +<h6 id="어렵거나-새롭게-알게-된-것-등-다시-확인할-것들"><em>(어렵거나 새롭게 알게 된 것 등 다시 확인할 것들)</em></h6> +<ul> +<li> +<p>Hash</p> +<ul> +<li>가볍게 정리했지만 더 자세하게 찾아보고 싶음 (활용되는 곳, 특성을 구현하는 법, hashing function, collision 등)</li> +</ul> +</li> +<li> +<p>list comprehension</p> +<ul> +<li>한 줄에 반복문 할당 배열생성 등이 한번에 일어남</li> +<li><a class="link" href="https://shoark7.github.io/programming/python/about-list-comprehension-python" target="_blank" rel="noopener" + >list comprehension 설명 블로그 글</a></li> +<li>쓸 줄 아는 방식이지만 용어를 처음 알게 됨 (예전에 배우고 까먹은 게 분명)</li> +</ul> +</li> +<li> +<p>list slicing 에 바로 대입하여 직관적으로 코드 작성 가능</p> +<ul> +<li>EX) list[1:3] = [1, 2]</li> +</ul> +</li> +</ul> +<h2 id="span-stylecolorb0d9b1느낀-점span">❗ <strong><span style="color:#B0D9B1">느낀 점</span></strong></h2> +<p>어제 더 나은 코드를 위해 어떤점을 고려해야하는지 많은 고민을 했는데, 오늘 강의에서 그 부분을 짚어줘서 좋았다.</p> +<p>오늘은 각 알고리즘이나 자료구조에 대한 설명보다는 문제 풀이와 해설을 위주로 강의가 진행되었는데, 그래서 나 스스로 그 개념에 대해 찾아보고 정리하는 시간이 필요했다. greedy나 sort는 이미 잘 알고 있는 부분이지만 hash는 헷갈리는 부분이 있어서 블로그와 document를 읽어보면서 글로 정리하는 시간을 가졌다.</p> +<p>깊이가 정해져있지 않다 보니 원하는 만큼 궁금해하고 파헤칠 수 있었지만, 내가 그 내용을 받아들이고 정리할 수 있는가는 별개의 문제임을 깨달았다. hash를 설명하는 블로그 글에 연결된 링크를 타고 여러 글을 읽어가다 보니, 어느새 encoding&amp;decoding, scheduling에 대한 글을 읽고 있었다. 이런 글들을 읽고 어느정도 이해할 수는 있었지만, 글로 정리하거나 그 사이의 관계를 명확하게 아는것은 큰 차이가 있었고, 머리속이 혼란스러웠다. 어떤 주제와 관련된 내용을 잘 찾고 정리하는것도 많은 노력이 필요하다는 걸 새삼 느끼는 순간이었다.</p> +<p>오늘처럼 깊이가 없는 공부를 해야하는 순간은 계속 있을것이고(있어왔고), 정해진 주제에 대해 찾아본 내용들을 글로 정리하면서 나만의 기준을 정립해야겠다는 결론을 내렸다.</p> +<p>+) 퇴고하기 위해 글을 읽어보는데 두서없고 추상적이라 맘에 들지 않음..(ㅠㅠ) 문장력을 키우고 싶은데 온라인으로도 필사할 수 있는지 찾아봐야겠다.</p> + + + + + diff --git a/public/tags/sort/page/1/index.html b/public/tags/sort/page/1/index.html new file mode 100644 index 0000000..2e9a28a --- /dev/null +++ b/public/tags/sort/page/1/index.html @@ -0,0 +1,10 @@ + + + + https://srlee056.github.io/tags/sort/ + + + + + + diff --git a/public/tags/stack/index.html b/public/tags/stack/index.html new file mode 100644 index 0000000..2693e35 --- /dev/null +++ b/public/tags/stack/index.html @@ -0,0 +1,479 @@ + + + + +Tag: Stack - 서림록 + + + + + + + + + + + + + + + +
+ + + + +
+
+

+ + Tags + +

+ +
+
+

1 페이지

+

Stack

+ +
+
+
+ +
+ + + +
+
+ + +
+ Hugo로 만듦
+ JimmyStack 테마 사용 중 +
+
+ + +
+
+ + + + + diff --git a/public/tags/stack/index.xml b/public/tags/stack/index.xml new file mode 100644 index 0000000..c9cd0e0 --- /dev/null +++ b/public/tags/stack/index.xml @@ -0,0 +1,649 @@ + + + + Stack on 서림록 + https://srlee056.github.io/tags/stack/ + Recent content in Stack on 서림록 + Hugo -- gohugo.io + ko + Seorim Lee + Tue, 17 Oct 2023 00:00:00 +0000 + Day 2 + https://srlee056.github.io/p/day-2/ + Tue, 17 Oct 2023 00:00:00 +0000 + + https://srlee056.github.io/p/day-2/ + <h1 id="span-stylecolor79ac78til---linkedlist--stackspan"><strong><span style="color:#79AC78">TIL - LinkedList &amp; Stack</span></strong></h1> +<h2 id="span-stylecolorb0d9b1공부-내용span">📋 <strong><span style="color:#B0D9B1">공부 내용</span></strong></h2> +<h3 id="span-stylecolord0e7d2연결-리스트-linked-listspan"><span style="color:#D0E7D2">연결 리스트 Linked List</span></h3> +<ul> +<li> +<p><strong>추상적 자료구조 Abstract Data Structures</strong></p> +<ul> +<li>내부 구현에는 신경쓸 필요 없는 구조</li> +<li>data &amp; a set of operations</li> +<li>이 두 가지를 <strong>추상적으로 보여줌</strong></li> +</ul> +</li> +<li> +<p><strong>Linke List?</strong></p> +<ul> +<li>Node가 선형적으로 연결된 구조</li> +</ul> +</li> +<li> +<p><strong>Node &amp; LinkedList 구현</strong></p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"> <span class="k">class</span> <span class="nc">Node</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">item</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="o">=</span> <span class="n">item</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">next</span> <span class="o">=</span> <span class="kc">None</span> <span class="c1"># 다음 노드를 가리킴</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">class</span> <span class="nc">LinkedList</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span> <span class="o">=</span> <span class="mi">0</span> <span class="c1"># 노드의 총 갯수</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">head</span> <span class="o">=</span> <span class="kc">None</span> <span class="c1"># 첫번째 노드</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">tail</span> <span class="o">=</span> <span class="kc">None</span> <span class="c1"># 마지막 노드</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li> +<p><strong>Linked List 연산 (operations)</strong></p> +<p>linked list의 index는 1부터 시작 / 0은 다른 용도로 사용(Dummy node)</p> +<h6 id="실습으로-구현한-코드만-첨부했음">(실습으로 구현한 코드만 첨부했음)</h6> +<ul> +<li> +<p>kth element 참조</p> +</li> +<li> +<p>리스트 순회</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span><span class="lnt">5 +</span><span class="lnt">6 +</span><span class="lnt">7 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"> <span class="k">def</span> <span class="nf">traverse</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">curr</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">head</span> +</span></span><span class="line"><span class="cl"> <span class="n">returnList</span> <span class="o">=</span> <span class="p">[]</span> +</span></span><span class="line"><span class="cl"> <span class="k">while</span> <span class="n">curr</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">returnList</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">curr</span><span class="o">.</span><span class="n">data</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="n">curr</span> <span class="o">=</span> <span class="n">curr</span><span class="o">.</span><span class="n">next</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">returnList</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li> +<p>길이 얻기</p> +</li> +<li> +<p>원소 삽입</p> +<ul> +<li>Time complexity +<ul> +<li>맨 앞에 삽입 : O(1)</li> +<li>중간에 삽입 : O(n)</li> +<li>맨 끝에 삽입 : (Tail pointer가 있기 때문에) O(1)</li> +</ul> +</li> +</ul> +</li> +<li> +<p>원소 삭제</p> +<ul> +<li>Time complexity +<ul> +<li>맨 앞에 삽입 : O(1)</li> +<li>중간에 삽입 : O(n)</li> +<li>맨 끝에 삽입 : O(n) +→ 이 상황을 피하기 위해 이중 연결 리스트를 사용</li> +</ul> +</li> +</ul> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span><span class="lnt">14 +</span><span class="lnt">15 +</span><span class="lnt">16 +</span><span class="lnt">17 +</span><span class="lnt">18 +</span><span class="lnt">19 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"> <span class="c1"># 삭제한 node 데이터를 반환</span> +</span></span><span class="line"><span class="cl"> <span class="k">def</span> <span class="nf">popAt</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">pos</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">pos</span> <span class="o">&lt;</span> <span class="mi">1</span> <span class="ow">or</span> <span class="n">pos</span> <span class="o">&gt;</span> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="k">raise</span> <span class="ne">IndexError</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">pos</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span> <span class="o">=</span> <span class="kc">None</span> +</span></span><span class="line"><span class="cl"> <span class="n">curr</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">head</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">head</span> <span class="o">=</span> <span class="n">curr</span><span class="o">.</span><span class="n">next</span> +</span></span><span class="line"><span class="cl"> <span class="k">else</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">getAt</span><span class="p">(</span><span class="n">pos</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="n">curr</span> <span class="o">=</span> <span class="n">prev</span><span class="o">.</span><span class="n">next</span> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span><span class="o">.</span><span class="n">next</span> <span class="o">=</span> <span class="n">curr</span><span class="o">.</span><span class="n">next</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">pos</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">tail</span> <span class="o">=</span> <span class="n">prev</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span> <span class="o">-=</span> <span class="mi">1</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">curr</span><span class="o">.</span><span class="n">data</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li> +<p>두 리스트 합치기 concat</p> +</li> +</ul> +</li> +<li> +<p><strong>배열 Array vs 연결 리스트 Linked List</strong></p> +<table> +<thead> +<tr> +<th></th> +<th>배열</th> +<th>연결 리스트</th> +</tr> +</thead> +<tbody> +<tr> +<td>저장 공간</td> +<td>연속된 위치</td> +<td>임의의 위치</td> +</tr> +<tr> +<td>특정 원소 참조</td> +<td>매우 간편</td> +<td>선형탐색과 유사</td> +</tr> +<tr> +<td></td> +<td>O(1)</td> +<td>O(n)</td> +</tr> +</tbody> +</table> +<p><em>time complexity에 불리함이 있는데도 사용하는 이유는?</em></p> +</li> +<li> +<p><strong>연결 리스트 Linked List의 힘</strong></p> +<ul> +<li>유연한 삽입 및 삭제</li> +<li>Head, Tail에 dummy node를 추가하여 간편하고 직관적인 설계 가능</li> +<li>추가 구현 operations +<ul> +<li> +<p>insertAfter(prev, node)</p> +</li> +<li> +<p>popAfter(prev) &amp; popAt(pos)</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span><span class="lnt">14 +</span><span class="lnt">15 +</span><span class="lnt">16 +</span><span class="lnt">17 +</span><span class="lnt">18 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">popAfter</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">prev</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">curr</span> <span class="o">=</span> <span class="n">prev</span><span class="o">.</span><span class="n">next</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">curr</span> <span class="ow">is</span> <span class="kc">None</span> <span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="kc">None</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">curr</span><span class="o">.</span><span class="n">next</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">tail</span> <span class="o">=</span> <span class="n">prev</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span><span class="o">.</span><span class="n">next</span> <span class="o">=</span> <span class="n">curr</span><span class="o">.</span><span class="n">next</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span> <span class="o">-=</span> <span class="mi">1</span> <span class="c1"># nodeCount 꼭 체크하기</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">curr</span><span class="o">.</span><span class="n">data</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">popAt</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">pos</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">pos</span> <span class="o">&lt;</span> <span class="mi">1</span> <span class="ow">or</span> <span class="n">pos</span> <span class="o">&gt;</span> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="k">raise</span> <span class="ne">IndexError</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">getAt</span><span class="p">(</span><span class="n">pos</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">popAfter</span><span class="p">(</span><span class="n">prev</span><span class="p">)</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +</ul> +</li> +</ul> +</li> +</ul> +<hr> +<h3 id="span-stylecolord0e7d2양방향--이중-연결-리스트-double-linked-listspan"><span style="color:#D0E7D2">양방향 / 이중 연결 리스트 Double Linked List</span></h3> +<ul> +<li><strong>양쪽</strong>으로 연결된 link +- next node, previous node로 두 방향 모두 진행 가능 +- 메모리 사용량이 늘어나지만, 앞에서뿐만 아니라 뒤에서도 데이터를 찾아갈 수 있다는게 장점 +<ul> +<li>getAt() 함수 또한 pos가 중간값 이상일 때는 뒤에서부터 찾도록 구현할 수 있음</li> +</ul> +</li> +<li><strong>operations</strong> +<ul> +<li> +<p>reverse</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span><span class="lnt">5 +</span><span class="lnt">6 +</span><span class="lnt">7 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">reverse</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">result</span> <span class="o">=</span> <span class="p">[]</span> +</span></span><span class="line"><span class="cl"> <span class="n">curr</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">tail</span> +</span></span><span class="line"><span class="cl"> <span class="k">while</span> <span class="n">curr</span><span class="o">.</span><span class="n">prev</span><span class="o">.</span><span class="n">prev</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">curr</span> <span class="o">=</span> <span class="n">curr</span><span class="o">.</span><span class="n">prev</span> +</span></span><span class="line"><span class="cl"> <span class="n">result</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">curr</span><span class="o">.</span><span class="n">data</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">result</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li> +<p>insertBefore</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span><span class="lnt">5 +</span><span class="lnt">6 +</span><span class="lnt">7 +</span><span class="lnt">8 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">insertBefore</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">next</span><span class="p">,</span> <span class="n">newNode</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span> <span class="o">=</span> <span class="nb">next</span><span class="o">.</span><span class="n">prev</span> +</span></span><span class="line"><span class="cl"> <span class="n">newNode</span><span class="o">.</span><span class="n">next</span> <span class="o">=</span> <span class="nb">next</span> +</span></span><span class="line"><span class="cl"> <span class="n">newNode</span><span class="o">.</span><span class="n">prev</span> <span class="o">=</span> <span class="n">prev</span> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span><span class="o">.</span><span class="n">next</span> <span class="o">=</span> <span class="n">newNode</span> +</span></span><span class="line"><span class="cl"> <span class="nb">next</span><span class="o">.</span><span class="n">prev</span> <span class="o">=</span> <span class="n">newNode</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span> <span class="o">+=</span> <span class="mi">1</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="kc">True</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li> +<p>popAfter, popBefore, popAt</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span><span class="lnt">14 +</span><span class="lnt">15 +</span><span class="lnt">16 +</span><span class="lnt">17 +</span><span class="lnt">18 +</span><span class="lnt">19 +</span><span class="lnt">20 +</span><span class="lnt">21 +</span><span class="lnt">22 +</span><span class="lnt">23 +</span><span class="lnt">24 +</span><span class="lnt">25 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">popAfter</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">prev</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">curr</span> <span class="o">=</span> <span class="n">prev</span><span class="o">.</span><span class="n">next</span> +</span></span><span class="line"><span class="cl"> <span class="nb">next</span> <span class="o">=</span> <span class="n">curr</span><span class="o">.</span><span class="n">next</span> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span><span class="o">.</span><span class="n">next</span> <span class="o">=</span> <span class="nb">next</span> +</span></span><span class="line"><span class="cl"> <span class="nb">next</span><span class="o">.</span><span class="n">prev</span> <span class="o">=</span> <span class="n">prev</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span> <span class="o">-=</span> <span class="mi">1</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">curr</span><span class="o">.</span><span class="n">data</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">popBefore</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">next</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">curr</span> <span class="o">=</span> <span class="nb">next</span><span class="o">.</span><span class="n">prev</span> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span> <span class="o">=</span> <span class="n">curr</span><span class="o">.</span><span class="n">prev</span> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span><span class="o">.</span><span class="n">next</span> <span class="o">=</span> <span class="nb">next</span> +</span></span><span class="line"><span class="cl"> <span class="nb">next</span><span class="o">.</span><span class="n">prev</span> <span class="o">=</span> <span class="n">prev</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span> <span class="o">-=</span> <span class="mi">1</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">curr</span><span class="o">.</span><span class="n">data</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">popAt</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">pos</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">pos</span> <span class="o">&lt;</span> <span class="mi">1</span> <span class="ow">or</span> <span class="n">pos</span> <span class="o">&gt;</span> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="k">raise</span> <span class="ne">IndexError</span> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">getAt</span><span class="p">(</span><span class="n">pos</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">popAfter</span><span class="p">(</span><span class="n">prev</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="c1"># next = self.getAt(pos+1) # getAt 함수가 pos == nodeCount+1 일 때 지원을 하지 않아서 사용은 어려움</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># next = self.getAt(pos).next #로 사용 가능</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># return self.popBefore(next)</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li> +<p>concat(self, L)</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span><span class="lnt">5 +</span><span class="lnt">6 +</span><span class="lnt">7 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">concat</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">L</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">lastNode</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">tail</span><span class="o">.</span><span class="n">prev</span> +</span></span><span class="line"><span class="cl"> <span class="n">firstNode</span> <span class="o">=</span> <span class="n">L</span><span class="o">.</span><span class="n">head</span><span class="o">.</span><span class="n">next</span> +</span></span><span class="line"><span class="cl"> <span class="n">lastNode</span><span class="o">.</span><span class="n">next</span> <span class="o">=</span> <span class="n">firstNode</span> +</span></span><span class="line"><span class="cl"> <span class="n">firstNode</span><span class="o">.</span><span class="n">prev</span> <span class="o">=</span> <span class="n">lastNode</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">tail</span> <span class="o">=</span> <span class="n">L</span><span class="o">.</span><span class="n">tail</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span> <span class="o">+=</span> <span class="n">L</span><span class="o">.</span><span class="n">nodeCount</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +</ul> +</li> +</ul> +<hr> +<h3 id="span-stylecolord0e7d2스택-stackspan"><span style="color:#D0E7D2">스택 Stack</span></h3> +<ul> +<li><strong>data element를 보관할 수 있는 선형 구조 / LIFO</strong></li> +<li><strong>operations</strong> +<ul> +<li>size()</li> +<li>isEmpty()</li> +<li>push(x) +<ul> +<li>꽉 찬 스택에 push(x)로 원소를 더 추가하려고 할 때 <code>stack overflow</code> 발생</li> +</ul> +</li> +<li>pop() +<ul> +<li>비어있는 스택에서 pop()으로 없는 원소를 꺼내려 할 때 <code>stack underflow</code> 발생</li> +</ul> +</li> +<li>peek() +<ul> +<li>데이터 참조, 제거하지는 않음</li> +</ul> +</li> +</ul> +</li> +<li><strong>추상적 자료구조로 구현</strong> +<ul> +<li>Array 또는 LinkedList 이용</li> +<li>만들어져있는 Stack library 를 import 할 수도 있음 +<code>from pythonds.basic.stack import Stack</code></li> +</ul> +</li> +</ul> +<hr> +<ul> +<li> +<p><strong>스택의 응용 1) 후위 표기법으로 변환</strong></p> +<ul> +<li>중위 표기법 (infix notation) : (A+B) * (C+D) +→ 후위 표기법 (postfix notation) : AB+CD+*</li> +<li>알고리즘 설계 +<ul> +<li> +<p>operator 연산자를 스택에 넣는 방식</p> +</li> +<li> +<p>연산자 우선순위 설정</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">prec</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;*&#39;</span><span class="p">:</span><span class="mi">3</span><span class="p">,</span> <span class="s1">&#39;/&#39;</span><span class="p">:</span><span class="mi">3</span><span class="p">,</span> <span class="s1">&#39;+&#39;</span><span class="p">:</span><span class="mi">2</span><span class="p">,</span> <span class="s1">&#39;-&#39;</span><span class="p">:</span><span class="mi">2</span><span class="p">,</span> <span class="s1">&#39;(&#39;</span><span class="p">:</span><span class="mi">1</span><span class="p">}</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li> +<p>구현 코드</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span><span class="lnt">14 +</span><span class="lnt">15 +</span><span class="lnt">16 +</span><span class="lnt">17 +</span><span class="lnt">18 +</span><span class="lnt">19 +</span><span class="lnt">20 +</span><span class="lnt">21 +</span><span class="lnt">22 +</span><span class="lnt">23 +</span><span class="lnt">24 +</span><span class="lnt">25 +</span><span class="lnt">26 +</span><span class="lnt">27 +</span><span class="lnt">28 +</span><span class="lnt">29 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">solution</span><span class="p">(</span><span class="n">S</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">opStack</span> <span class="o">=</span> <span class="n">ArrayStack</span><span class="p">()</span> +</span></span><span class="line"><span class="cl"> <span class="n">charList</span> <span class="o">=</span> <span class="p">[]</span> <span class="c1"># 수식을 리스트 형태로 저장한 후 .join을 통해 문자열로 변환</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">s</span> <span class="ow">in</span> <span class="n">S</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">s</span> <span class="ow">in</span> <span class="n">prec</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span> <span class="c1"># 연산자 + 여는 괄호</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">s</span> <span class="o">==</span> <span class="s2">&#34;(&#34;</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">opStack</span><span class="o">.</span><span class="n">push</span><span class="p">(</span><span class="n">s</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="k">else</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="k">while</span> <span class="ow">not</span> <span class="n">opStack</span><span class="o">.</span><span class="n">isEmpty</span><span class="p">():</span> <span class="c1"># 스택이 비어있는 동안 계속</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">prec</span><span class="p">[</span><span class="n">opStack</span><span class="o">.</span><span class="n">peek</span><span class="p">()]</span> <span class="o">&gt;=</span> <span class="n">prec</span><span class="p">[</span><span class="n">s</span><span class="p">]:</span> <span class="c1"># 스택 맨 위의 우선순위가 높거나 같은 경우에만</span> +</span></span><span class="line"><span class="cl"> <span class="n">charList</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">opStack</span><span class="o">.</span><span class="n">pop</span><span class="p">())</span> <span class="c1"># pop()하여 문자열에 출력</span> +</span></span><span class="line"><span class="cl"> <span class="k">else</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="k">break</span> +</span></span><span class="line"><span class="cl"> <span class="n">opStack</span><span class="o">.</span><span class="n">push</span><span class="p">(</span><span class="n">s</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">elif</span> <span class="n">s</span> <span class="o">==</span> <span class="s2">&#34;)&#34;</span><span class="p">:</span> <span class="c1"># 닫는 괄호</span> +</span></span><span class="line"><span class="cl"> <span class="k">while</span> <span class="n">opStack</span><span class="o">.</span><span class="n">peek</span><span class="p">()</span> <span class="o">!=</span> <span class="s2">&#34;(&#34;</span><span class="p">:</span> <span class="c1"># 여는 괄호가 나올때까지 모든 연산자를 꺼내 출력</span> +</span></span><span class="line"><span class="cl"> <span class="n">charList</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">opStack</span><span class="o">.</span><span class="n">pop</span><span class="p">())</span> +</span></span><span class="line"><span class="cl"> <span class="n">opStack</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> <span class="c1"># pop &#39;(&#39;</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">else</span><span class="p">:</span> <span class="c1"># 피연산자</span> +</span></span><span class="line"><span class="cl"> <span class="n">charList</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">s</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">while</span> <span class="ow">not</span> <span class="n">opStack</span><span class="o">.</span><span class="n">isEmpty</span><span class="p">():</span> <span class="c1"># 스택에 남아있는 연산자들을 모두 출력</span> +</span></span><span class="line"><span class="cl"> <span class="n">charList</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">opStack</span><span class="o">.</span><span class="n">pop</span><span class="p">())</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="n">answer</span> <span class="o">=</span> <span class="s2">&#34;&#34;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">charList</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">answer</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +</ul> +</li> +</ul> +</li> +<li> +<p><strong>스택의 응용 2) 후위 표기법 계산</strong></p> +<ul> +<li>앞에서부터 뒤로 읽어나가면서 먼저 만나는 연산자를 먼저 계산</li> +<li>알고리즘 설계 +<ul> +<li> +<p>operands 피연산자들을 스택에 넣는 방식</p> +</li> +<li> +<p>구현 코드</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span><span class="lnt">14 +</span><span class="lnt">15 +</span><span class="lnt">16 +</span><span class="lnt">17 +</span><span class="lnt">18 +</span><span class="lnt">19 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">postfixEval</span><span class="p">(</span><span class="n">tokenList</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">valStack</span> <span class="o">=</span> <span class="n">ArrayStack</span><span class="p">()</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">t</span> <span class="ow">in</span> <span class="n">tokenList</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="nb">type</span><span class="p">(</span><span class="n">t</span><span class="p">)</span> <span class="ow">is</span> <span class="nb">int</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">valStack</span><span class="o">.</span><span class="n">push</span><span class="p">(</span><span class="n">t</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="k">else</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">b</span> <span class="o">=</span> <span class="n">valStack</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> +</span></span><span class="line"><span class="cl"> <span class="n">a</span> <span class="o">=</span> <span class="n">valStack</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">t</span> <span class="o">==</span> <span class="s1">&#39;*&#39;</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">valStack</span><span class="o">.</span><span class="n">push</span><span class="p">(</span><span class="n">a</span><span class="o">*</span><span class="n">b</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="k">elif</span> <span class="n">t</span> <span class="o">==</span> <span class="s1">&#39;/&#39;</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">valStack</span><span class="o">.</span><span class="n">push</span><span class="p">(</span><span class="n">a</span><span class="o">/</span><span class="n">b</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="k">elif</span> <span class="n">t</span> <span class="o">==</span> <span class="s1">&#39;+&#39;</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">valStack</span><span class="o">.</span><span class="n">push</span><span class="p">(</span><span class="n">a</span><span class="o">+</span><span class="n">b</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="k">elif</span> <span class="n">t</span> <span class="o">==</span> <span class="s1">&#39;-&#39;</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">valStack</span><span class="o">.</span><span class="n">push</span><span class="p">(</span><span class="n">a</span><span class="o">-</span><span class="n">b</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">valStack</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +</ul> +</li> +</ul> +</li> +</ul> +<h2 id="span-stylecolorb0d9b1checkspan">👀 <strong><span style="color:#B0D9B1">CHECK</span></strong></h2> +<h6 id="어렵거나-새롭게-알게-된-것-등-다시-확인할-것들"><em>(어렵거나 새롭게 알게 된 것 등 다시 확인할 것들)</em></h6> +<ul> +<li> +<p>member field, member method</p> +<ul> +<li>용어의 뜻은 알지만 애매해서 다시 정리하기 위해 찾아봄 <br> +<a class="link" href="https://as-i-am-programing.tistory.com/7" target="_blank" rel="noopener" + >정리에 참고한 사이트</a></li> +</ul> +</li> +<li> +<p>추상적 자료구조</p> +<ul> +<li>abstract data type vs. data structure +<ul> +<li>an ADT (Abstract Data Type) is more of a logical description, while a Data Structure is concrete.</li> +</ul> +</li> +<li><a class="link" href="https://velog.io/@hwan2da/%EC%9E%90%EB%A3%8C%EA%B5%AC%EC%A1%B0-%EC%B6%94%EC%83%81%EC%9E%90%EB%A3%8C%ED%98%95" target="_blank" rel="noopener" + >정리에 참고한 사이트 : 추상적 자료형 vs. 자료구조</a></li> +</ul> +</li> +<li> +<p>dummy node를 추가한 구조의 linked list</p> +</li> +<li> +<p>stack underflow</p> +</li> +</ul> +<h2 id="span-stylecolorb0d9b1느낀-점span">‼️ <strong><span style="color:#B0D9B1">느낀 점</span></strong></h2> +<p>오늘은 두 가지 교훈(?) 을 얻었다.</p> +<ol> +<li> +<p>한번에 두가지 일을 하지 않기 +강의를 들으면서 TIL을 적으려고 했는데, 외려 더 정신없고 힘들었다. 강의 듣는 중간에 적다 보니, 그냥 받아쓰기가 되는것도 별로였다. 큰 주제 (오늘 같은 경우 LinkedList / Stack)를 다 듣고 정리하는게 나을 듯!</p> +</li> +<li> +<p>사소한 실수 하지 않고 꼼꼼하게 체크하기 +오늘 연습문제를 풀면서</p> +<blockquote> +</blockquote> +<p>node.data 대신 node 객체를 반환함 +linked list의 nodeCount 증감시키는걸 빼먹음</p> +<p>명시된 조건을 빼먹는 실수를 저질러서 디버깅 한다고 다 합해서 한시간 가까이 소모했다. +몰라서 못 푸는것 보다 이런 부분에서 꼼꼼하지 못해서 못 푸는게 더 싫다. 심지어 원래는 그렇게 자주 하는 실수도 아니어서 자존심이 더 상했다. ㅠㅠ <br> +그래도 이런 날이 있어야 앞으로 안 그럴 수 있으니까 계속 담아두지는 말아야지!</p> +</li> +</ol> +<p>내일은 강의와 실습을 꼼꼼하게 진행하고, 내가 이해한 내용을 토대로 TIL을 잘 적어봐야겠다. :&gt;. +그리고 내일은 github 블로그에 올려봐야지! 🔥 어렵지만 할 만한 가치가 있어보인다 😊</p> + + + + + diff --git a/public/tags/stack/page/1/index.html b/public/tags/stack/page/1/index.html new file mode 100644 index 0000000..4c3ff28 --- /dev/null +++ b/public/tags/stack/page/1/index.html @@ -0,0 +1,10 @@ + + + + https://srlee056.github.io/tags/stack/ + + + + + + diff --git a/public/tags/tag-with-whitespaces/index.html b/public/tags/tag-with-whitespaces/index.html deleted file mode 100644 index c156fb1..0000000 --- a/public/tags/tag-with-whitespaces/index.html +++ /dev/null @@ -1,494 +0,0 @@ - - - - -Tag: tag with whitespaces - Seorim Log - - - - - - - - - - - - - -
- - - - -
-
-

- - Tags - -

- -
-
-

1 page

-

tag with whitespaces

- -
-
-
- -
- - - -
-
- - -
- Built with Hugo
- Theme Stack designed by Jimmy -
-
- - -
-
- - - - - diff --git a/public/tags/tag-with-whitespaces/index.xml b/public/tags/tag-with-whitespaces/index.xml deleted file mode 100644 index 6aa0a67..0000000 --- a/public/tags/tag-with-whitespaces/index.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - tag with whitespaces on Seorim Log - https://srlee056.github.io/tags/tag-with-whitespaces/ - Recent content in tag with whitespaces on Seorim Log - Hugo -- gohugo.io - en - Seorim Lee - Sat, 09 Mar 2019 00:00:00 +0000 - Placeholder Text - https://srlee056.github.io/p/placeholder-text/ - Sat, 09 Mar 2019 00:00:00 +0000 - - https://srlee056.github.io/p/placeholder-text/ - <img src="https://srlee056.github.io/p/placeholder-text/matt-le-SJSpo9hQf7s-unsplash.jpg" alt="Featured image of post Placeholder Text" /><p>Lorem est tota propiore conpellat pectoribus de pectora summo.</p> -<p>Redit teque digerit hominumque toris verebor lumina non cervice subde tollit usus habet Arctonque, furores quas nec ferunt. Quoque montibus nunc caluere tempus inhospita parcite confusaque translucet patri vestro qui optatis lumine cognoscere flos nubis! Fronde ipsamque patulos Dryopen deorum.</p> -<ol> -<li>Exierant elisi ambit vivere dedere</li> -<li>Duce pollice</li> -<li>Eris modo</li> -<li>Spargitque ferrea quos palude</li> -</ol> -<p>Rursus nulli murmur; hastile inridet ut ab gravi sententia! Nomine potitus silentia flumen, sustinet placuit petis in dilapsa erat sunt. Atria tractus malis.</p> -<ol> -<li>Comas hunc haec pietate fetum procerum dixit</li> -<li>Post torum vates letum Tiresia</li> -<li>Flumen querellas</li> -<li>Arcanaque montibus omnes</li> -<li>Quidem et</li> -</ol> -<h1 id="vagus-elidunt">Vagus elidunt</h1> -<p><svg class="canon" xmlns="http://www.w3.org/2000/svg" overflow="visible" viewBox="0 0 496 373" height="373" width="496"><g fill="none"><path stroke="#000" stroke-width=".75" d="M.599 372.348L495.263 1.206M.312.633l494.95 370.853M.312 372.633L247.643.92M248.502.92l246.76 370.566M330.828 123.869V1.134M330.396 1.134L165.104 124.515"></path><path stroke="#ED1C24" stroke-width=".75" d="M275.73 41.616h166.224v249.05H275.73zM54.478 41.616h166.225v249.052H54.478z"></path><path stroke="#000" stroke-width=".75" d="M.479.375h495v372h-495zM247.979.875v372"></path><ellipse cx="498.729" cy="177.625" rx=".75" ry="1.25"></ellipse><ellipse cx="247.229" cy="377.375" rx=".75" ry="1.25"></ellipse></g></svg></p> -<p><a class="link" href="https://en.wikipedia.org/wiki/Canons_of_page_construction#Van_de_Graaf_canon" target="_blank" rel="noopener" - >The Van de Graaf Canon</a></p> -<h2 id="mane-refeci-capiebant-unda-mulcebat">Mane refeci capiebant unda mulcebat</h2> -<p>Victa caducifer, malo vulnere contra dicere aurato, ludit regale, voca! Retorsit colit est profanae esse virescere furit nec; iaculi matertera et visa est, viribus. Divesque creatis, tecta novat collumque vulnus est, parvas. <strong>Faces illo pepulere</strong> tempus adest. Tendit flamma, ab opes virum sustinet, sidus sequendo urbis.</p> -<p>Iubar proles corpore raptos vero auctor imperium; sed et huic: manus caeli Lelegas tu lux. Verbis obstitit intus oblectamina fixis linguisque ausus sperare Echionides cornuaque tenent clausit possit. Omnia putatur. Praeteritae refert ausus; ferebant e primus lora nutat, vici quae mea ipse. Et iter nil spectatae vulnus haerentia iuste et exercebat, sui et.</p> -<p>Eurytus Hector, materna ipsumque ut Politen, nec, nate, ignari, vernum cohaesit sequitur. Vel <strong>mitis temploque</strong> vocatus, inque alis, <em>oculos nomen</em> non silvis corpore coniunx ne displicet illa. Crescunt non unus, vidit visa quantum inmiti flumina mortis facto sic: undique a alios vincula sunt iactata abdita! Suspenderat ego fuit tendit: luna, ante urbem Propoetides <strong>parte</strong>.</p> - - - - diff --git a/public/tags/tag-with-whitespaces/page/1/index.html b/public/tags/tag-with-whitespaces/page/1/index.html deleted file mode 100644 index eda3a5d..0000000 --- a/public/tags/tag-with-whitespaces/page/1/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - https://srlee056.github.io/tags/tag-with-whitespaces/ - - - - - - diff --git a/public/tags/text/index.xml b/public/tags/text/index.xml deleted file mode 100644 index 7178d3e..0000000 --- a/public/tags/text/index.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - text on Seorim Log - https://srlee056.github.io/tags/text/ - Recent content in text on Seorim Log - Hugo -- gohugo.io - en - Seorim Lee - Sat, 09 Mar 2019 00:00:00 +0000 - Placeholder Text - https://srlee056.github.io/p/placeholder-text/ - Sat, 09 Mar 2019 00:00:00 +0000 - - https://srlee056.github.io/p/placeholder-text/ - <img src="https://srlee056.github.io/p/placeholder-text/matt-le-SJSpo9hQf7s-unsplash.jpg" alt="Featured image of post Placeholder Text" /><p>Lorem est tota propiore conpellat pectoribus de pectora summo.</p> -<p>Redit teque digerit hominumque toris verebor lumina non cervice subde tollit usus habet Arctonque, furores quas nec ferunt. Quoque montibus nunc caluere tempus inhospita parcite confusaque translucet patri vestro qui optatis lumine cognoscere flos nubis! Fronde ipsamque patulos Dryopen deorum.</p> -<ol> -<li>Exierant elisi ambit vivere dedere</li> -<li>Duce pollice</li> -<li>Eris modo</li> -<li>Spargitque ferrea quos palude</li> -</ol> -<p>Rursus nulli murmur; hastile inridet ut ab gravi sententia! Nomine potitus silentia flumen, sustinet placuit petis in dilapsa erat sunt. Atria tractus malis.</p> -<ol> -<li>Comas hunc haec pietate fetum procerum dixit</li> -<li>Post torum vates letum Tiresia</li> -<li>Flumen querellas</li> -<li>Arcanaque montibus omnes</li> -<li>Quidem et</li> -</ol> -<h1 id="vagus-elidunt">Vagus elidunt</h1> -<p><svg class="canon" xmlns="http://www.w3.org/2000/svg" overflow="visible" viewBox="0 0 496 373" height="373" width="496"><g fill="none"><path stroke="#000" stroke-width=".75" d="M.599 372.348L495.263 1.206M.312.633l494.95 370.853M.312 372.633L247.643.92M248.502.92l246.76 370.566M330.828 123.869V1.134M330.396 1.134L165.104 124.515"></path><path stroke="#ED1C24" stroke-width=".75" d="M275.73 41.616h166.224v249.05H275.73zM54.478 41.616h166.225v249.052H54.478z"></path><path stroke="#000" stroke-width=".75" d="M.479.375h495v372h-495zM247.979.875v372"></path><ellipse cx="498.729" cy="177.625" rx=".75" ry="1.25"></ellipse><ellipse cx="247.229" cy="377.375" rx=".75" ry="1.25"></ellipse></g></svg></p> -<p><a class="link" href="https://en.wikipedia.org/wiki/Canons_of_page_construction#Van_de_Graaf_canon" target="_blank" rel="noopener" - >The Van de Graaf Canon</a></p> -<h2 id="mane-refeci-capiebant-unda-mulcebat">Mane refeci capiebant unda mulcebat</h2> -<p>Victa caducifer, malo vulnere contra dicere aurato, ludit regale, voca! Retorsit colit est profanae esse virescere furit nec; iaculi matertera et visa est, viribus. Divesque creatis, tecta novat collumque vulnus est, parvas. <strong>Faces illo pepulere</strong> tempus adest. Tendit flamma, ab opes virum sustinet, sidus sequendo urbis.</p> -<p>Iubar proles corpore raptos vero auctor imperium; sed et huic: manus caeli Lelegas tu lux. Verbis obstitit intus oblectamina fixis linguisque ausus sperare Echionides cornuaque tenent clausit possit. Omnia putatur. Praeteritae refert ausus; ferebant e primus lora nutat, vici quae mea ipse. Et iter nil spectatae vulnus haerentia iuste et exercebat, sui et.</p> -<p>Eurytus Hector, materna ipsumque ut Politen, nec, nate, ignari, vernum cohaesit sequitur. Vel <strong>mitis temploque</strong> vocatus, inque alis, <em>oculos nomen</em> non silvis corpore coniunx ne displicet illa. Crescunt non unus, vidit visa quantum inmiti flumina mortis facto sic: undique a alios vincula sunt iactata abdita! Suspenderat ego fuit tendit: luna, ante urbem Propoetides <strong>parte</strong>.</p> - - - - diff --git a/public/tags/themes/index.xml b/public/tags/themes/index.xml deleted file mode 100644 index 9c638fd..0000000 --- a/public/tags/themes/index.xml +++ /dev/null @@ -1,242 +0,0 @@ - - - - themes on Seorim Log - https://srlee056.github.io/tags/themes/ - Recent content in themes on Seorim Log - Hugo -- gohugo.io - en - Seorim Lee - Mon, 11 Mar 2019 00:00:00 +0000 - Markdown Syntax Guide - https://srlee056.github.io/p/markdown-syntax-guide/ - Mon, 11 Mar 2019 00:00:00 +0000 - - https://srlee056.github.io/p/markdown-syntax-guide/ - <img src="https://srlee056.github.io/p/markdown-syntax-guide/pawel-czerwinski-8uZPynIu-rQ-unsplash.jpg" alt="Featured image of post Markdown Syntax Guide" /><p>This article offers a sample of basic Markdown syntax that can be used in Hugo content files, also it shows whether basic HTML elements are decorated with CSS in a Hugo theme.</p> -<h2 id="headings">Headings</h2> -<p>The following HTML <code>&lt;h1&gt;</code>—<code>&lt;h6&gt;</code> elements represent six levels of section headings. <code>&lt;h1&gt;</code> is the highest section level while <code>&lt;h6&gt;</code> is the lowest.</p> -<h1 id="h1">H1</h1> -<h2 id="h2">H2</h2> -<h3 id="h3">H3</h3> -<h4 id="h4">H4</h4> -<h5 id="h5">H5</h5> -<h6 id="h6">H6</h6> -<h2 id="paragraph">Paragraph</h2> -<p>Xerum, quo qui aut unt expliquam qui dolut labo. Aque venitatiusda cum, voluptionse latur sitiae dolessi aut parist aut dollo enim qui voluptate ma dolestendit peritin re plis aut quas inctum laceat est volestemque commosa as cus endigna tectur, offic to cor sequas etum rerum idem sintibus eiur? Quianimin porecus evelectur, cum que nis nust voloribus ratem aut omnimi, sitatur? Quiatem. Nam, omnis sum am facea corem alique molestrunt et eos evelece arcillit ut aut eos eos nus, sin conecerem erum fuga. Ri oditatquam, ad quibus unda veliamenimin cusam et facea ipsamus es exerum sitate dolores editium rerore eost, temped molorro ratiae volorro te reribus dolorer sperchicium faceata tiustia prat.</p> -<p>Itatur? Quiatae cullecum rem ent aut odis in re eossequodi nonsequ idebis ne sapicia is sinveli squiatum, core et que aut hariosam ex eat.</p> -<h2 id="blockquotes">Blockquotes</h2> -<p>The blockquote element represents content that is quoted from another source, optionally with a citation which must be within a <code>footer</code> or <code>cite</code> element, and optionally with in-line changes such as annotations and abbreviations.</p> -<h4 id="blockquote-without-attribution">Blockquote without attribution</h4> -<blockquote> -<p>Tiam, ad mint andaepu dandae nostion secatur sequo quae. -<strong>Note</strong> that you can use <em>Markdown syntax</em> within a blockquote.</p> -</blockquote> -<h4 id="blockquote-with-attribution">Blockquote with attribution</h4> -<blockquote> -<p>Don&rsquo;t communicate by sharing memory, share memory by communicating.<br> -— <cite>Rob Pike<sup id="fnref:1"><a href="#fn:1" class="footnote-ref" role="doc-noteref">1</a></sup></cite></p> -</blockquote> -<h2 id="tables">Tables</h2> -<p>Tables aren&rsquo;t part of the core Markdown spec, but Hugo supports supports them out-of-the-box.</p> -<table> -<thead> -<tr> -<th>Name</th> -<th>Age</th> -</tr> -</thead> -<tbody> -<tr> -<td>Bob</td> -<td>27</td> -</tr> -<tr> -<td>Alice</td> -<td>23</td> -</tr> -</tbody> -</table> -<h4 id="inline-markdown-within-tables">Inline Markdown within tables</h4> -<table> -<thead> -<tr> -<th>Italics</th> -<th>Bold</th> -<th>Code</th> -</tr> -</thead> -<tbody> -<tr> -<td><em>italics</em></td> -<td><strong>bold</strong></td> -<td><code>code</code></td> -</tr> -</tbody> -</table> -<table> -<thead> -<tr> -<th>A</th> -<th>B</th> -<th>C</th> -<th>D</th> -<th>E</th> -<th>F</th> -</tr> -</thead> -<tbody> -<tr> -<td>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</td> -<td>Phasellus ultricies, sapien non euismod aliquam, dui ligula tincidunt odio, at accumsan nulla sapien eget ex.</td> -<td>Proin eleifend dictum ipsum, non euismod ipsum pulvinar et. Vivamus sollicitudin, quam in pulvinar aliquam, metus elit pretium purus</td> -<td>Proin sit amet velit nec enim imperdiet vehicula.</td> -<td>Ut bibendum vestibulum quam, eu egestas turpis gravida nec</td> -<td>Sed scelerisque nec turpis vel viverra. Vivamus vitae pretium sapien</td> -</tr> -</tbody> -</table> -<h2 id="code-blocks">Code Blocks</h2> -<h4 id="code-block-with-backticks">Code block with backticks</h4> -<div class="highlight"><div class="chroma"> -<table class="lntable"><tr><td class="lntd"> -<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 -</span><span class="lnt"> 2 -</span><span class="lnt"> 3 -</span><span class="lnt"> 4 -</span><span class="lnt"> 5 -</span><span class="lnt"> 6 -</span><span class="lnt"> 7 -</span><span class="lnt"> 8 -</span><span class="lnt"> 9 -</span><span class="lnt">10 -</span></code></pre></td> -<td class="lntd"> -<pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl"><span class="cp">&lt;!doctype html&gt;</span> -</span></span><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">html</span> <span class="na">lang</span><span class="o">=</span><span class="s">&#34;en&#34;</span><span class="p">&gt;</span> -</span></span><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">head</span><span class="p">&gt;</span> -</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">meta</span> <span class="na">charset</span><span class="o">=</span><span class="s">&#34;utf-8&#34;</span><span class="p">&gt;</span> -</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">title</span><span class="p">&gt;</span>Example HTML5 Document<span class="p">&lt;/</span><span class="nt">title</span><span class="p">&gt;</span> -</span></span><span class="line"><span class="cl"><span class="p">&lt;/</span><span class="nt">head</span><span class="p">&gt;</span> -</span></span><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">body</span><span class="p">&gt;</span> -</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">p</span><span class="p">&gt;</span>Test<span class="p">&lt;/</span><span class="nt">p</span><span class="p">&gt;</span> -</span></span><span class="line"><span class="cl"><span class="p">&lt;/</span><span class="nt">body</span><span class="p">&gt;</span> -</span></span><span class="line"><span class="cl"><span class="p">&lt;/</span><span class="nt">html</span><span class="p">&gt;</span> -</span></span></code></pre></td></tr></table> -</div> -</div><h4 id="code-block-indented-with-four-spaces">Code block indented with four spaces</h4> -<pre><code>&lt;!doctype html&gt; -&lt;html lang=&quot;en&quot;&gt; -&lt;head&gt; - &lt;meta charset=&quot;utf-8&quot;&gt; - &lt;title&gt;Example HTML5 Document&lt;/title&gt; -&lt;/head&gt; -&lt;body&gt; - &lt;p&gt;Test&lt;/p&gt; -&lt;/body&gt; -&lt;/html&gt; -</code></pre> -<h4 id="code-block-with-hugos-internal-highlight-shortcode">Code block with Hugo&rsquo;s internal highlight shortcode</h4> -<div class="highlight"><div class="chroma"> -<table class="lntable"><tr><td class="lntd"> -<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 -</span><span class="lnt"> 2 -</span><span class="lnt"> 3 -</span><span class="lnt"> 4 -</span><span class="lnt"> 5 -</span><span class="lnt"> 6 -</span><span class="lnt"> 7 -</span><span class="lnt"> 8 -</span><span class="lnt"> 9 -</span><span class="lnt">10 -</span></code></pre></td> -<td class="lntd"> -<pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl"><span class="cp">&lt;!doctype html&gt;</span> -</span></span><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">html</span> <span class="na">lang</span><span class="o">=</span><span class="s">&#34;en&#34;</span><span class="p">&gt;</span> -</span></span><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">head</span><span class="p">&gt;</span> -</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">meta</span> <span class="na">charset</span><span class="o">=</span><span class="s">&#34;utf-8&#34;</span><span class="p">&gt;</span> -</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">title</span><span class="p">&gt;</span>Example HTML5 Document<span class="p">&lt;/</span><span class="nt">title</span><span class="p">&gt;</span> -</span></span><span class="line"><span class="cl"><span class="p">&lt;/</span><span class="nt">head</span><span class="p">&gt;</span> -</span></span><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">body</span><span class="p">&gt;</span> -</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">p</span><span class="p">&gt;</span>Test<span class="p">&lt;/</span><span class="nt">p</span><span class="p">&gt;</span> -</span></span><span class="line"><span class="cl"><span class="p">&lt;/</span><span class="nt">body</span><span class="p">&gt;</span> -</span></span><span class="line"><span class="cl"><span class="p">&lt;/</span><span class="nt">html</span><span class="p">&gt;</span></span></span></code></pre></td></tr></table> -</div> -</div> -<h4 id="diff-code-block">Diff code block</h4> -<div class="highlight"><div class="chroma"> -<table class="lntable"><tr><td class="lntd"> -<pre tabindex="0" class="chroma"><code><span class="lnt">1 -</span><span class="lnt">2 -</span><span class="lnt">3 -</span><span class="lnt">4 -</span><span class="lnt">5 -</span></code></pre></td> -<td class="lntd"> -<pre tabindex="0" class="chroma"><code class="language-diff" data-lang="diff"><span class="line"><span class="cl">[dependencies.bevy] -</span></span><span class="line"><span class="cl">git = &#34;https://github.com/bevyengine/bevy&#34; -</span></span><span class="line"><span class="cl">rev = &#34;11f52b8c72fc3a568e8bb4a4cd1f3eb025ac2e13&#34; -</span></span><span class="line"><span class="cl"><span class="gd">- features = [&#34;dynamic&#34;] -</span></span></span><span class="line"><span class="cl"><span class="gd"></span><span class="gi">+ features = [&#34;jpeg&#34;, &#34;dynamic&#34;] -</span></span></span></code></pre></td></tr></table> -</div> -</div><h2 id="list-types">List Types</h2> -<h4 id="ordered-list">Ordered List</h4> -<ol> -<li>First item</li> -<li>Second item</li> -<li>Third item</li> -</ol> -<h4 id="unordered-list">Unordered List</h4> -<ul> -<li>List item</li> -<li>Another item</li> -<li>And another item</li> -</ul> -<h4 id="nested-list">Nested list</h4> -<ul> -<li>Fruit -<ul> -<li>Apple</li> -<li>Orange</li> -<li>Banana</li> -</ul> -</li> -<li>Dairy -<ul> -<li>Milk</li> -<li>Cheese</li> -</ul> -</li> -</ul> -<h2 id="other-elements--abbr-sub-sup-kbd-mark">Other Elements — abbr, sub, sup, kbd, mark</h2> -<p><abbr title="Graphics Interchange Format">GIF</abbr> is a bitmap image format.</p> -<p>H<sub>2</sub>O</p> -<p>X<sup>n</sup> + Y<sup>n</sup> = Z<sup>n</sup></p> -<p>Press <kbd>CTRL</kbd> + <kbd>ALT</kbd> + <kbd>Delete</kbd> to end the session.</p> -<p>Most <mark>salamanders</mark> are nocturnal, and hunt for insects, worms, and other small creatures.</p> -<h2 id="hyperlinked-image">Hyperlinked image</h2> -<p><a class="link" href="https://google.com" target="_blank" rel="noopener" - ><img src="https://www.google.com/images/branding/googlelogo/1x/googlelogo_light_color_272x92dp.png" - - - - loading="lazy" - - alt="Google" - - -></a></p> -<div class="footnotes" role="doc-endnotes"> -<hr> -<ol> -<li id="fn:1"> -<p>The above quote is excerpted from Rob Pike&rsquo;s <a class="link" href="https://www.youtube.com/watch?v=PAAkCSZUG1c" target="_blank" rel="noopener" - >talk</a> during Gopherfest, November 18, 2015.&#160;<a href="#fnref:1" class="footnote-backref" role="doc-backlink">&#x21a9;&#xfe0e;</a></p> -</li> -</ol> -</div> - - - - diff --git a/public/tags/til/index.html b/public/tags/til/index.html new file mode 100644 index 0000000..c944ddf --- /dev/null +++ b/public/tags/til/index.html @@ -0,0 +1,538 @@ + + + + +Tag: TIL - 서림록 + + + + + + + + + + + + + + + +
+ + + + +
+
+

+ + Tags + +

+ +
+
+

8 페이지

+

TIL

+ +
+
+
+ +
+ + + + + + + + + + + +
+ + +
+ + +
+ Hugo로 만듦
+ JimmyStack 테마 사용 중 +
+
+ + +
+
+ + + + + diff --git a/public/tags/til/index.xml b/public/tags/til/index.xml new file mode 100644 index 0000000..b242b53 --- /dev/null +++ b/public/tags/til/index.xml @@ -0,0 +1,3101 @@ + + + + TIL on 서림록 + https://srlee056.github.io/tags/til/ + Recent content in TIL on 서림록 + Hugo -- gohugo.io + ko + Seorim Lee + Wed, 25 Oct 2023 16:23:38 +0900 + Day 8 + https://srlee056.github.io/p/day-8/ + Wed, 25 Oct 2023 16:23:38 +0900 + + https://srlee056.github.io/p/day-8/ + <style> +g1 { color: #79AC78 } +g2 { color: #B0D9B1 } +g3 { color: #D0E7D2 } +g4 { color: #618264 } +o1 { color: #F9B572 } +w1 { color: #FAF8ED } +</style> +<h1 id="span-stylecolor79ac78til---html-분석span"><span style="color:#79AC78">TIL - HTML 분석</span></h1> +<h2 id="span-stylecolorb0d9b1공부-내용span">📋 <span style="color:#B0D9B1">공부 내용</span></h2> +<p><code>requests</code></p> +<ul> +<li>라이브러리를 사용해 웹 브라우저와 같이 웹 페이지를 요청하고 응답을 받아옴</li> +<li>응답 받은 문서 -&gt; <strong>분석 필요!</strong></li> +</ul> +<h3 id="span-stylecolord0e7d2beautifulsoupspan"><span style="color:#D0E7D2">BeautifulSoup</span></h3> +<blockquote> +<p>HTML 코드를 분석 하는 라이브러리 (HTML Parser)</p> +</blockquote> +<h4 id="span-stylecolorf9b572설치-방법span"><span style="color:#F9B572">설치 방법</span></h4> +<p><em>(mac, python3 기준)</em></p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-fallback" data-lang="fallback"><span class="line"><span class="cl">pip install bs4 +</span></span><span class="line"><span class="cl">or +</span></span><span class="line"><span class="cl">pip3 install bs4 +</span></span></code></pre></td></tr></table> +</div> +</div><h4 id="span-stylecolorf9b572html-분석-실습span"><span style="color:#F9B572">HTML 분석 실습</span></h4> +<ul> +<li> +<p>필요 라이브러리 불러오기</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">requests</span> +</span></span><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">bs4</span> <span class="kn">import</span> <span class="n">BeautifulSoup</span> <span class="c1">#import bs library</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li> +<p>사이트를 요청하고 응답받기</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="c1"># requests.get으로 사이트 HTML을 받아 와 저장</span> +</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">requests</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&#34;https://www.example.com&#34;</span><span class="p">)</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li> +<p>응답받은 HTML으로 BeautifulSoup 객체를 만들고 내용을 출력해보기</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span><span class="lnt">5 +</span><span class="lnt">6 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="c1"># bs 객체를 만들고, res.text와 &#34;html.paser&#34;를 인자로 넘겨</span> +</span></span><span class="line"><span class="cl"><span class="c1"># HTML parser 역할을 하게 만듬</span> +</span></span><span class="line"><span class="cl"><span class="n">soup</span> <span class="o">=</span> <span class="n">BeautifulSoup</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">text</span><span class="p">,</span> <span class="s2">&#34;html.parser&#34;</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"><span class="c1"># HTML의 구조를 잘 보여주도록 들여쓰기하여 출력</span> +</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">soup</span><span class="o">.</span><span class="n">prettify</span><span class="p">())</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li> +<p>HTML의 특정 요소 찾기</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="c1"># 해당하는 각 태그의 내용을 보여줌</span> +</span></span><span class="line"><span class="cl"><span class="n">soup</span><span class="o">.</span><span class="n">title</span> +</span></span><span class="line"><span class="cl"><span class="n">soup</span><span class="o">.</span><span class="n">head</span> +</span></span><span class="line"><span class="cl"><span class="n">soup</span><span class="o">.</span><span class="n">body</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"><span class="c1"># h1태그들 중 가장 먼저 나오는것을 찾아 반환</span> +</span></span><span class="line"><span class="cl"><span class="n">h1</span> <span class="o">=</span> <span class="n">soup</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="s2">&#34;h1&#34;</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"><span class="c1"># p태그 모두를 찾아 반환</span> +</span></span><span class="line"><span class="cl"><span class="n">soup</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="s2">&#34;p&#34;</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"><span class="c1"># 태그 이름과 (h1) 태그 안의 내용을 가져옴</span> +</span></span><span class="line"><span class="cl"><span class="n">h1</span><span class="o">.</span><span class="n">name</span> +</span></span><span class="line"><span class="cl"><span class="n">h1</span><span class="o">.</span><span class="n">text</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li> +<p>특정 요소를 찾아 그 안의 원하는 정보만 추려내기</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span><span class="lnt">5 +</span><span class="lnt">6 +</span><span class="lnt">7 +</span><span class="lnt">8 +</span><span class="lnt">9 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="c1"># 책 리스트를 찾아 그 제목만 추출하는 코드</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"><span class="c1"># 직접 사이트를 확인하고 h3태그에 책 이미지, 저자, 제목 등이 있는것을 확인하여 find_all로 가져옴</span> +</span></span><span class="line"><span class="cl"><span class="n">h3_results</span> <span class="o">=</span> <span class="n">soup</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="s1">&#39;h3&#39;</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"><span class="c1"># 객체로 만들게 되면, 내부 태그를 속성처럼 쓸 수 있음</span> +</span></span><span class="line"><span class="cl"><span class="c1"># h3 &gt; a 태그 내에 title 속성 value를 출력하는 함수</span> +</span></span><span class="line"><span class="cl"><span class="k">for</span> <span class="n">book</span> <span class="ow">in</span> <span class="n">h3_results</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="nb">print</span><span class="p">(</span><span class="n">book</span><span class="o">.</span><span class="n">a</span><span class="p">[</span><span class="s1">&#39;title&#39;</span><span class="p">])</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li> +<p><code>id</code>를 이용해 요소 가져오기</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="c1"># .find(&lt;tag_name&gt;, id = &lt;id_name&gt;)</span> +</span></span><span class="line"><span class="cl"><span class="n">soup</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="s2">&#34;div&#34;</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="s2">&#34;bo_list&#34;</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"><span class="n">soup</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="s2">&#34;div&#34;</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="s2">&#34;bo_cate&#34;</span><span class="p">)</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li> +<p><code>class</code>를 이용해 요소 가져오기</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="c1"># .find(&lt;tag_name&gt;, &lt;class_name&gt;)</span> +</span></span><span class="line"><span class="cl"><span class="n">soup</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="s2">&#34;li&#34;</span><span class="p">,</span> <span class="s2">&#34;questions&#34;</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"><span class="n">soup</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="s2">&#34;div&#34;</span><span class="p">,</span> <span class="s2">&#34;question&#34;</span><span class="p">)</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li> +<p><code>user-agent</code> 정보를 넘기면서 요청하기<br> +<a class="link" href="https://www.whatismybrowser.com/detect/what-is-my-user-agent/" target="_blank" rel="noopener" + >user agent 확인 사이트</a></p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span><span class="lnt">5 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">user_agent</span> <span class="o">=</span> <span class="p">{</span><span class="s2">&#34;User-Agent&#34;</span><span class="p">:</span> <span class="o">&lt;</span><span class="n">본인의</span> <span class="n">user</span> <span class="n">agent</span> <span class="n">정보</span><span class="o">&gt;</span><span class="p">}</span> +</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">requests</span> +</span></span><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">bs4</span> <span class="kn">import</span> <span class="n">BeautifulSoup</span> +</span></span><span class="line"><span class="cl"><span class="n">url</span> <span class="o">=</span> <span class="s2">&#34;https://qna.programmers.co.kr/&#34;</span> +</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">requests</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">url</span><span class="p">,</span> <span class="n">user_agent</span><span class="p">)</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li> +<p>페이지네이션 (Pagination)</p> +<blockquote> +<p>정보를 인덱스로 구분하는 기법</p> +</blockquote> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span><span class="lnt">14 +</span><span class="lnt">15 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="c1"># 해당 사이트는 query string으로 구분</span> +</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">time</span> +</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">requests</span> +</span></span><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">bs4</span> <span class="kn">import</span> <span class="n">BeautifulSoup</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"><span class="n">url</span> <span class="o">=</span> <span class="s2">&#34;https://qna.programmers.co.kr/?page=</span><span class="si">{}</span><span class="s2">&#34;</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"><span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">6</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">res</span> <span class="o">=</span> <span class="n">requests</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">url</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">i</span><span class="p">),</span> <span class="n">user_agent</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="n">soup</span> <span class="o">=</span> <span class="n">BeautifulSoup</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">text</span><span class="p">,</span> <span class="s2">&#34;html.parser&#34;</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="n">questions</span> <span class="o">=</span> <span class="n">soup</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="s2">&#34;li&#34;</span><span class="p">,</span> <span class="s2">&#34;question-list-item&#34;</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">question</span> <span class="ow">in</span> <span class="n">questions</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="nb">print</span><span class="p">(</span><span class="n">question</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="s2">&#34;div&#34;</span><span class="p">,</span> <span class="s2">&#34;question&#34;</span><span class="p">)</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="s2">&#34;div&#34;</span><span class="p">,</span> <span class="s2">&#34;top&#34;</span><span class="p">)</span><span class="o">.</span><span class="n">h4</span><span class="o">.</span><span class="n">a</span><span class="o">.</span><span class="n">text</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># 과도한 요청을 방지하기 위해 1초마다 요청</span> +</span></span><span class="line"><span class="cl"> <span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +</ul> +<h3 id="span-stylecolord0e7d2웹-사이트와-스크래핑span"><span style="color:#D0E7D2">웹 사이트와 스크래핑</span></h3> +<h4 id="span-stylecolorf9b572정적-or-동적-웹-사이트span"><span style="color:#F9B572">정적 or 동적 웹 사이트</span></h4> +<ul> +<li>웹 사이트는 <em>정적(Static) 웹 사이트</em> 와 <em>동적(Dynamic) 웹 사이트</em> 로 나눌 수 있다. +<table> +<thead> +<tr> +<th>웹 사이트</th> +<th>Static</th> +<th>Dynamic</th> +</tr> +</thead> +<tbody> +<tr> +<td>HTML 내용</td> +<td>고정</td> +<td>변경</td> +</tr> +<tr> +<td>HTML 데이터 로드</td> +<td>응답 이전에 완료됨</td> +<td>응답 이후에 완료되기도 함</td> +</tr> +</tbody> +</table> +</li> +</ul> +<h4 id="span-stylecolorf9b572동기-or-비동기-처리span"><span style="color:#F9B572">동기 or 비동기 처리</span></h4> +<p>동기 처리 (정적 웹 사이트)</p> +<ul> +<li>렌더링이 완료된 이후에 데이터 처리를 진행</li> +<li>요청에 따른 응답을 기다려야 함</li> +</ul> +<p>비동기 처리 (동적 웹 사이트)</p> +<ul> +<li>렌더링과 데이터 처리가 동시에 진행됨</li> +<li>요청에 따른 응답을 기다리지 않음</li> +<li>상황에 따라 응답 시 받은 HTML 문서의 데이터가 <code>완전하지 않은 경우 발생</code></li> +</ul> +<h4 id="span-stylecolorf9b572스크래핑span"><span style="color:#F9B572">스크래핑</span></h4> +<ul> +<li> +<p>requests 요청의 문제점</p> +<ol> +<li>불완전하고 원하지 않은 내용의 응답을 받게 되어 <strong>동적 웹사이트에 적용이 어려움</strong></li> +<li>키보드, 마우스 입력 등 <strong>UI와 상호작용 하기 어려움</strong></li> +</ol> +</li> +<li> +<p>해결 방법</p> +<ol> +<li>데이터 처리 후 응답을 받아오는 방식 적용</li> +<li>UI Action을 프로그래밍</li> +<li>웹 브라우저 역할을 하는 대신 <strong>웹 브라우저를 조작</strong> -&gt; <code>Selenium</code></li> +</ol> +</li> +</ul> +<h2 id="span-stylecolorb0d9b1checkspan">👀 <span style="color:#B0D9B1">CHECK</span></h2> +<p><em><span style = "font-size:15px">(어렵거나 새롭게 알게 된 것 등 다시 확인할 것들)</span></em></p> +<ul> +<li>Pagination : 정보를 인덱스로 구분하는 기법 +<ul> +<li>Query String</li> +</ul> +</li> +<li>.format method +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="s2">&#34;</span><span class="si">{}</span><span class="s2">&#34;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">a</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="s2">&#34;a&#34;</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li>동기 처리와 비동기 처리의 개념에 대해 한번 더 복습</li> +<li>bs .find 함수 +<ul> +<li>여러 요소를 찾을 때 or을 적용하여 A or B or C class 모두를 찾을 수 있는지 궁금</li> +<li>class A, B / class A 인 요소 두 개가 있을 때 class B를 가진 요소는 배제하고 찾는 방법도 궁금</li> +</ul> +</li> +<li>정적 웹 사이트에는 requests같은 라이브러리를 쓰고 동적 웹 사이트에는 Selenium을 쓰는지 아니면 일괄적으로 Selenium처럼 웹 사이트를 조작하는 형식의 라이브러리만 쓰는지 궁금하다.</li> +<li>중첩된 div 내에 h4가 있는 경우에 (div&gt;div&gt;h4) 가장 바깥 div 내에 h4가 하나뿐이라면 <code>div_container.find(&quot;div&quot;).h4</code> 로 쓰지 않고 <code>div_container.h4</code>로 작성해도 원하는 기능을 하던데 이유가 궁금하다.</li> +</ul> +<h2 id="span-stylecolorb0d9b1느낀-점span">❗ <span style="color:#B0D9B1">느낀 점</span></h2> +<p>오늘은 꽤나 만족스러운 하루를 보냈다.</p> +<p>강의와 실습은 내 기준엔 어렵지 않아 2시간 내로 완료했다. 실습을 하면서 주어진 사이트 외에 다른 사이트도 들어가서 분석하고 배운 함수를 적용해보았다. +실습을 하면서 궁금한 점이 몇개 생겼고 CHECK에도 적어놨는데, TIL을 다 적은 후에 구글링 및 슬랙 채널을 통해서 해결해 볼 생각이다.</p> +<p>그리고 코어타임 중간에 hugo로 만든 블로그에 글을 올려봤는데 내가 생각했던것 보다 더 쉬워서 안심했다. 블로그와 관련해 다음 세 가지 목표를 세웠다.</p> +<ol> +<li>github action 수정해서 push 하면 자동으로 빌드, 배포되게 만들기</li> +<li>hugo new post 템플릿 만들기</li> +<li>한국어 설정하기</li> +</ol> +<p>이렇게 세팅을 완료한 후에, 기존에 작성했던 TIL을 올리고 카테고리 설정까지 하면 완성이다. 나중엔 블로그 메인 페이지 커스텀, 댓글 위젯 설정, SEO 세팅 등을 해보려고 한다.</p> + + + + Day 7 + https://srlee056.github.io/p/day-7/ + Tue, 24 Oct 2023 00:00:00 +0000 + + https://srlee056.github.io/p/day-7/ + <h1 id="span-stylecolor79ac78til---httpspan"><span style="color:#79AC78">TIL - HTTP</span></h1> +<h2 id="span-stylecolorb0d9b1공부-내용span">📋 <span style="color:#B0D9B1">공부 내용</span></h2> +<h3 id="span-stylecolord0e7d2웹span"><span style="color:#D0E7D2">웹</span></h3> +<h4 id="span-stylecolorf9b572웹-페이지와-htmlspan"><span style="color:#F9B572">웹 페이지와 HTML</span></h4> +<p>웹 페이지</p> +<ul> +<li>웹 속의 <strong>문서 하나</strong></li> +<li>ex) 네이버 메인 페이지</li> +<li>HTML으로 구성되어있음</li> +</ul> +<p>웹 사이트</p> +<ul> +<li>여러 웹 페이지의 모음</li> +<li>ex) <em>네이버</em>라는 웹 사이트</li> +</ul> +<p>웹 브라우저</p> +<ul> +<li>HTTP요청을 보낸 후, HTTP응답에 담긴 HTML문서를 사용자가 보기 쉽게 화면으로 그려주는 (렌더링) 역할</li> +</ul> +<p><a class="link" href="https://velog.io/@srlee056/%EB%8D%B0%EC%9D%B4%ED%84%B0-%EC%97%94%EC%A7%80%EB%8B%88%EC%96%B4%EB%A7%81-%EB%8D%B0%EB%B8%8C%EC%BD%94%EC%8A%A4-6%EC%9D%BC%EC%B0%A8" target="_blank" rel="noopener" + >HTML(개념 정리 글 링크)</a></p> +<ul> +<li>이전 강의에서 다룬 내용 참고</li> +<li>웹 브라우저마다 지원하는 태그와 속성이 달라짐</li> +</ul> +<h4 id="span-stylecolorf9b572웹-스크래핑--웹-크롤링span"><span style="color:#F9B572">웹 스크래핑 / 웹 크롤링</span></h4> +<p>웹 스크래핑</p> +<ul> +<li>특정 목적에 따라 웹 페이지에서 원하는 데이터를 &ldquo;추출&rdquo;</li> +<li>ex) 날씨 정보 가져오기, 주식 데이터 가져오기, &hellip;</li> +</ul> +<p>웹 크롤링</p> +<ul> +<li>크롤러를 이용해 URL을 타고 이동하며 반복적으로 웹 페이지의 데이터를 가져와 &ldquo;인덱싱&rdquo;(데이터 색인)</li> +<li>구글, 네이버 등 검색 엔진의 웹 크롤러</li> +</ul> +<h4 id="span-stylecolorf9b572올바른-http-requestspan"><span style="color:#F9B572">올바른 HTTP Request</span></h4> +<p>올바른 HTTP Request를 위해선..</p> +<ul> +<li>어떤 목적을 달성하려 하는가?</li> +<li>서버에 영향을 미치는가?</li> +</ul> +<p>로봇 배제 프로토콜(REP)</p> +<ul> +<li>웹 크롤링, 스크래핑은 로봇에 의해 실행 가능</li> +<li>사이트의 모든 정보를 취득하는것이 정당한가? 의문에서 시작</li> +<li>robots.txt +<ul> +<li>각 사이트마다 허용하는 크롤러 정보와 허용범위에 대한 정보를 담고 있음</li> +<li>User-agent, Disallow, Allow</li> +</ul> +</li> +</ul> +<h3 id="span-stylecolord0e7d2httpspan"><span style="color:#D0E7D2">HTTP</span></h3> +<h4 id="span-stylecolorf9b572httpspan"><span style="color:#F9B572">HTTP?</span></h4> +<blockquote> +<p>HyterText Transfer Protocol<br> +웹 상에서 정보를 주고받기 위한 <em>약속</em></p> +</blockquote> +<table> +<thead> +<tr> +<th></th> +<th>HTTP Request</th> +<th>HTTP Response</th> +</tr> +</thead> +<tbody> +<tr> +<td>방향</td> +<td>Client -&gt; Server</td> +<td>Client &lt;- Server</td> +</tr> +<tr> +<td>역할</td> +<td>정보 요청</td> +<td>요청에 대한 내용을 담은 응답</td> +</tr> +<tr> +<td>HEAD</td> +<td>method, path, &hellip;</td> +<td>content-type, date, &hellip;</td> +</tr> +<tr> +<td>BODY</td> +<td></td> +<td>document</td> +</tr> +</tbody> +</table> +<h4 id="span-stylecolorf9b572통신하기span"><span style="color:#F9B572">통신하기</span></h4> +<p><code>requests</code></p> +<ul> +<li>Python으로 HTTP 통신을 진행할 수 있게 해주는 라이브러리</li> +</ul> +<p><code>GET</code></p> +<ul> +<li>naver 메인 페이지를 요청하는 코드</li> +</ul> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">requests</span> +</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">requests</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&#34;https://www.naver.com&#34;</span><span class="p">)</span> <span class="c1"># HTTP Response</span> +</span></span><span class="line"><span class="cl"><span class="n">res</span><span class="o">.</span><span class="n">headers</span> <span class="c1"># Header 확인</span> +</span></span><span class="line"><span class="cl"><span class="n">res</span><span class="o">.</span><span class="n">text</span> <span class="c1"># Body(document) text 형태로 확인</span> +</span></span></code></pre></td></tr></table> +</div> +</div><p><code>POST</code></p> +<ul> +<li><a class="link" href="https://webhook.site" target="_blank" rel="noopener" + >https://webhook.site</a> 를 통해 POST 통신을 진행할 수 있음</li> +</ul> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">payload</span> <span class="o">=</span> <span class="p">{</span><span class="s2">&#34;name&#34;</span><span class="p">:</span> <span class="s2">&#34;Hello&#34;</span><span class="p">,</span> <span class="s2">&#34;age&#34;</span><span class="p">:</span> <span class="mi">13</span><span class="p">}</span> +</span></span><span class="line"><span class="cl"><span class="n">url</span> <span class="o">=</span> <span class="s2">&#34;https://webhook.site/&lt;개인 주소&gt;&#34;</span> +</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">requests</span><span class="o">.</span><span class="n">post</span><span class="p">(</span><span class="n">url</span><span class="p">,</span> <span class="n">payload</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"><span class="n">res</span><span class="o">.</span><span class="n">status_code</span> <span class="c1"># 상태 코드 확인</span> +</span></span></code></pre></td></tr></table> +</div> +</div><h3 id="span-stylecolord0e7d2domspan"><span style="color:#D0E7D2">DOM</span></h3> +<h4 id="span-stylecolorf9b572domspan"><span style="color:#F9B572">DOM?</span></h4> +<blockquote> +<p>Document Object Model<br> +HTML을 파싱하여, 브라우저가 이해하도록 만든 Tree형태의 자료구조</p> +</blockquote> +<ul> +<li> +<p>DOM의 각 노드를 객체로 생각하여, 문서를 편리하게 관리할 수 있음</p> +</li> +<li> +<p>원하는 요소를 동적으로 변경할 수 있음</p> +</li> +<li> +<p>원하는 요소를 쉽게 찾을 수 있음</p> +</li> +<li> +<p>python으로 HTML을 직접 분석하려면 DOM을 생성해주는 브라우저를 거치지 않기 때문에, +직접 HTML을 분석하는 <code>HTML Parser</code>가 필요</p> +</li> +</ul> +<h2 id="span-stylecolorb0d9b1checkspan">👀 <span style="color:#B0D9B1">CHECK</span></h2> +<p><em><span style = "font-size:15px">(어렵거나 새롭게 알게 된 것 등 다시 확인할 것들)</span></em></p> +<ul> +<li> +<p>Jupyter lab</p> +<ul> +<li>Jupyter notebook이나 Colab은 써 봤는데 Jupyter lab은 처음 접해봄</li> +<li>Jupyter notebook과 비슷하지만 더 개선된 버전(?)</li> +</ul> +</li> +<li> +<p>DOM에 대한 설명 및 활용 : 복습 후 다른 예시들을 더 찾아볼 것</p> +</li> +</ul> +<h2 id="span-stylecolorb0d9b1느낀-점span">❗ <span style="color:#B0D9B1">느낀 점</span></h2> +<p>HTML 스크래핑을 해본적이 있어서 이론이나 실습 모두 빠르게 진행했다. 5시간 분량의 강의인데 3시간 내로 끝난 것 같다. TIL을 잘 적고 싶어서 고민을 좀 했고 그 외의 시간은 평소보다는 널널하게 흘려보냈다.</p> +<p>TIL을 적을 때 기존에는 강의 받아쓰기처럼 적는 경향이 있었는데, 나중에 다시 읽어보니 이해하고 쓴 것 같은 느낌이 전혀 들지 않았다. 어제 HTML이론에 대한 TIL은 실습 부분 외에도 직접 사용해보고 하면서 적은거라, &lsquo;내가 직접 써보고 이해한 내용&rsquo;임을 알 수 있었다. 그런데 초반에 적은 TIL을 다시 보니까 그냥 받아적은게 티가 나기도 하고 잘 기억이 나지 않았다.</p> +<p>오늘은 강의를 처음부터 끝까지 들은 후 키워드만 체크해 필기한 다음, TIL을 적으면서 중간중간 다시 듣는 방식을 사용했다. 이 방식으로 더 잘 읽히고 짜임새 있는 구성의 글을 쓰게 되어서 만족스러웠다. TIL 쓰는 시간은 오래 걸리지만 익숙해지면 줄어들 것 같아서 걱정은 되지 않는다.</p> +<p>커리큘럼을 보니 내일부터는 BeautifulSoup를 사용해 스크래핑을 시작하는데, 모르는 부분이 많을 것 같아 벌써부터 기대가 된다. :&gt;</p> + + + + Day 6 + https://srlee056.github.io/p/day-6/ + Mon, 23 Oct 2023 00:00:00 +0000 + + https://srlee056.github.io/p/day-6/ + <style> +g1 { color: #79AC78 } +g2 { color: #B0D9B1 } +g3 { color: #D0E7D2 } +g4 { color: #618264 } +o1 { color: #F9B572 } +w1 { color: #FAF8ED } +</style> +<h1 id="span-stylecolor79ac78til---htmlspan"><span style="color:#79AC78">TIL - HTML</span></h1> +<h2 id="span-stylecolorb0d9b1공부-내용span">📋 <span style="color:#B0D9B1">공부 내용</span></h2> +<p><strong><span style="color:#FAF8ED">HTML</span></strong></p> +<blockquote> +<p>Hypertext Markup Language<br> +웹 브라우저가 이해할 수 있는 &ldquo;언어&rdquo;</p> +</blockquote> +<p><strong><span style="color:#FAF8ED">CSS</span></strong></p> +<blockquote> +<p>Cascading Style Sheets<br> +문서를 예쁘게 &ldquo;꾸미는&rdquo; 언어</p> +</blockquote> +<p><strong><span style="color:#FAF8ED">JavaScript</span></strong></p> +<blockquote> +<p>JS = JavaScript<br> +문서에 &ldquo;기능&quot;을 만들어주는 언어</p> +</blockquote> +<hr> +<h3 id="span-stylecolord0e7d2html---기본-문법span"><span style="color:#D0E7D2">HTML - 기본 문법</span></h3> +<h4 id="span-stylecolorf9b572태그span"><span style="color:#F9B572">태그</span></h4> +<ul> +<li>컨텐츠를 갖는 태그 / 가지지 않는 태그</li> +<li>열리는 태그 &amp; 닫히는 태그 / 단일 태그 (셀프 클로징)</li> +<li><code>&lt;div&gt; contents &lt;/div&gt; / &lt;br /&gt;</code></li> +</ul> +<h4 id="span-stylecolorf9b572속성과-값span"><span style="color:#F9B572">속성과 값</span></h4> +<ul> +<li><code>&lt;div attributes = value&gt;content&lt;/div&gt;</code></li> +<li><code>&lt;div title = &quot;제목&quot;&gt; ...</code></li> +<li>title : 전역 속성이라 모든 태그에서 사용 가능</li> +<li>속성(Attributes)의 종류는 아주 많고 다양함</li> +</ul> +<h4 id="span-stylecolorf9b572부모요소--자식요소span"><span style="color:#F9B572">부모요소 &amp; 자식요소</span></h4> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-fallback" data-lang="fallback"><span class="line"><span class="cl">html +</span></span><span class="line"><span class="cl">├─ head +</span></span><span class="line"><span class="cl">│ └─ title +</span></span><span class="line"><span class="cl">└─ body +</span></span></code></pre></td></tr></table> +</div> +</div><p>html (부모) - head, body (자식)</p> +<p>부모/자식 구조를 파악하기 좋게, 들여쓰기/내어쓰기 <strong>깊이(depth)를 잘 지켜</strong>서 작성해야 함<br> +탭 잘 쓰라는얘기</p> +<h4 id="span-stylecolorf9b572html-주석span"><span style="color:#F9B572">HTML 주석</span></h4> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-fallback" data-lang="fallback"><span class="line"><span class="cl">&lt;!-- 주석 내용 --&gt; +</span></span></code></pre></td></tr></table> +</div> +</div><div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-fallback" data-lang="fallback"><span class="line"><span class="cl">&lt;!-- +</span></span><span class="line"><span class="cl"> 줄바꿈 가능 +</span></span><span class="line"><span class="cl">--&gt; +</span></span></code></pre></td></tr></table> +</div> +</div><div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl"><span class="c">&lt;!-- +</span></span></span><span class="line"><span class="cl"><span class="c"> &lt;!-- --&gt;</span> +</span></span><span class="line"><span class="cl">--&gt; +</span></span><span class="line"><span class="cl">이처럼 주석 안에 주석을 넣으면 바깥의 여는 태그가 안쪽 닫는 태그를 인식해 주석이 풀리게 된다. 고로 주석 안에 주석은 X +</span></span></code></pre></td></tr></table> +</div> +</div><p>웹 브라우저의 소스보기 등에서 확인 가능하므로 보안이 필요한 정보는 적지 않아야 한다.</p> +<h3 id="span-stylecolord0e7d2headspan"><span style="color:#D0E7D2">HEAD</span></h3> +<blockquote> +<p>사용자에게는 보이지 않지만, 문서의 정보가 담기는 영역</p> +</blockquote> +<h4 id="span-stylecolorf9b572타이틀span"><span style="color:#F9B572">타이틀</span></h4> +<ul> +<li>웹 브라우저 탭이나 창에서 표시되는 <code>문서의 제목</code></li> +</ul> +<h4 id="span-stylecolorf9b572메타-데이터span"><span style="color:#F9B572">메타 데이터</span></h4> +<ul> +<li>인코딩 정보 +<ul> +<li>charset(character set) : 문서에서 허용하는 문자의 집합</li> +<li>영어만 허용하는 규칙(ISO-8859-1)을 사용할 경우, 한글은 제대로 출력이 되지 않음</li> +<li><code>&lt;meta charset = &quot;ISO-8859-1&quot;&gt;</code></li> +<li><code>utf-8</code>(전 세계 언어 지원) 을 기본으로 사용</li> +</ul> +</li> +<li>문서 설명 +<ul> +<li><code>&lt;meta name = &quot;description&quot; content = &quot;이 문서는 실습 문서입니다.&quot;&gt;</code></li> +</ul> +</li> +<li>문서 작성자 +<ul> +<li><code>&lt;meta name = &quot;author content = &quot;srlee&quot;</code></li> +</ul> +</li> +</ul> +<h4 id="span-stylecolorf9b572css-javascriptspan"><span style="color:#F9B572">CSS, Javascript</span></h4> +<blockquote> +<p>문서 외형에 영향을 주는 태그들로 구성</p> +</blockquote> +<ul> +<li> +<p>style</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span><span class="lnt">5 +</span><span class="lnt">6 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl"><span class="c">&lt;!-- 문서 글자색을 blue로 만드는 코드 --&gt;</span> +</span></span><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">style</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="nt">body</span> <span class="p">{</span> +</span></span><span class="line"><span class="cl"> <span class="k">color</span><span class="p">:</span> <span class="kc">blue</span><span class="p">;</span> +</span></span><span class="line"><span class="cl"> <span class="p">}</span> +</span></span><span class="line"><span class="cl"><span class="p">&lt;/</span><span class="nt">style</span><span class="p">&gt;</span> +</span></span></code></pre></td></tr></table> +</div> +</div><p>길이가 너무 길어지면 작성 및 수정이 불편 -&gt; <code>&lt;link&gt;</code></p> +</li> +<li> +<p>link</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl"><span class="c">&lt;!--단일 속성 +</span></span></span><span class="line"><span class="cl"><span class="c"> rel: 링크된 파일의 속성 +</span></span></span><span class="line"><span class="cl"><span class="c"> href: 파일 경로 --&gt;</span> +</span></span><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">link</span> <span class="na">rel </span><span class="o">=</span> <span class="s">&#34;stylesheet&#34;</span> <span class="na">href</span><span class="o">=</span><span class="s">&#34;style.css&#34;</span> <span class="p">/&gt;</span> +</span></span></code></pre></td></tr></table> +</div> +</div><p>별도로 분리된 CSS파일을 링크</p> +</li> +<li> +<p>script</p> +<p><em>콘텐츠 방식</em></p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">script</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="kr">const</span> <span class="nx">hello</span> <span class="o">=</span> <span class="s1">&#39;world&#39;</span><span class="p">;</span> +</span></span><span class="line"><span class="cl"> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">hello</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"><span class="p">&lt;/</span><span class="nt">script</span><span class="p">&gt;</span> +</span></span></code></pre></td></tr></table> +</div> +</div><p><em>링크 방식</em></p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl"><span class="c">&lt;!-- 콘텐츠를 가지지 않지만 단일태그는 아니기 때문에 셀프 클로징 X --&gt;</span> +</span></span><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">script</span> <span class="na">src </span><span class="o">=</span> <span class="s">&#34;script.js&#34;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +</ul> +<h3 id="span-stylecolord0e7d2bodyspan"><span style="color:#D0E7D2">BODY</span></h3> +<blockquote> +<p>사람 눈에 보이는 콘텐츠의 영역</p> +</blockquote> +<h4 id="span-stylecolorf9b572block---블록-레벨-요소span"><span style="color:#F9B572">block - 블록 레벨 요소</span></h4> +<ul> +<li> +<p>블록처럼 차곡차곡 쌓이며 화면 너비가 꽉 참</p> +</li> +<li> +<p>블록의 크기와 내/외부에 여백 지정 가능</p> +</li> +<li> +<p>페이지의 구조적 요소</p> +</li> +<li> +<p>인라인 요소 포함 가능 / 포함 될 수는 없음</p> +</li> +<li> +<p><code>&lt;div&gt;, &lt;article&gt;, &lt;section&gt;, ...</code></p> +</li> +</ul> +<h4 id="span-stylecolorf9b572inline---인라인-레벨-요소span"><span style="color:#F9B572">inline - 인라인 레벨 요소</span></h4> +<ul> +<li> +<p>블록 요소 내에 포함되는 요소 (블록 요소를 포함할 수 없음!)</p> +</li> +<li> +<p>문장, 단어같은 작은 부분에 사용되며, 한 줄에 나열됨</p> +</li> +<li> +<p>좌우 여백만 허용</p> +</li> +<li> +<p><code>&lt;span&gt;, &lt;a&gt;, &lt;strong&gt;, ... </code></p> +</li> +</ul> +<h4 id="span-stylecolorf9b572inline-blockspan"><span style="color:#F9B572">inline-block</span></h4> +<ul> +<li>인라인 요소의 불편함을 해결하기 위한 요소</li> +<li>글자처럼 취급되지만 block태그의 성질을 가짐</li> +<li>크기와 내/외부 여백 지정 가능</li> +<li>CSS로 성질을 바꾼 것이기 때문에 의미상 인라인 레벨 요소</li> +</ul> +<p>활용 예시</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">body</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">span</span><span class="p">&gt;</span>인라인<span class="p">&lt;/</span><span class="nt">span</span><span class="p">&gt;</span> 옆에 글자 +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">div</span><span class="p">&gt;</span>블록<span class="p">&lt;/</span><span class="nt">div</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"><span class="p">&lt;/</span><span class="nt">body</span><span class="p">&gt;</span> +</span></span></code></pre></td></tr></table> +</div> +</div><div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span><span class="lnt">5 +</span><span class="lnt">6 +</span><span class="lnt">7 +</span><span class="lnt">8 +</span><span class="lnt">9 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-css" data-lang="css"><span class="line"><span class="cl"><span class="nt">span</span><span class="p">{</span> +</span></span><span class="line"><span class="cl"> <span class="k">padding-left</span><span class="p">:</span> <span class="mi">100</span><span class="kt">px</span><span class="p">;</span> +</span></span><span class="line"><span class="cl"> <span class="k">padding-top</span><span class="p">:</span> <span class="mi">100</span><span class="kt">px</span><span class="p">;</span> <span class="c">/* 적용 X */</span> +</span></span><span class="line"><span class="cl"><span class="p">}</span> +</span></span><span class="line"><span class="cl"><span class="nt">div</span><span class="p">{</span> +</span></span><span class="line"><span class="cl"> <span class="k">padding-top</span><span class="p">:</span> <span class="mi">50</span><span class="kt">px</span><span class="p">;</span> +</span></span><span class="line"><span class="cl"> <span class="k">padding-bottom</span><span class="p">:</span> <span class="mi">30</span><span class="kt">px</span><span class="p">;</span> +</span></span><span class="line"><span class="cl"> <span class="k">padding-left</span><span class="p">:</span> <span class="mi">100</span><span class="kt">px</span><span class="p">;</span> +</span></span><span class="line"><span class="cl"><span class="p">}</span> +</span></span></code></pre></td></tr></table> +</div> +</div><p><img src="https://velog.velcdn.com/images/srlee056/post/a6ec119a-686c-4695-bf9e-d749c5f41161/image.png" + + + + loading="lazy" + + alt="span" + + +></p> +<p><img src="https://velog.velcdn.com/images/srlee056/post/c8d47ee6-6120-413a-be14-3bee40235710/image.png" + + + + loading="lazy" + + alt="div" + + +></p> +<h3 id="span-stylecolord0e7d2layoutspan"><span style="color:#D0E7D2">Layout</span></h3> +<h4 id="span-stylecolorf9b572layout-tagspan"><span style="color:#F9B572">Layout Tag?</span></h4> +<ul> +<li>html5부터 태그를 의미있게 사용하기 위해 <code>Semantic</code>태그를 사용하기 시작</li> +<li>div만 사용하지 않고 적절한 태그를 사용해 웹 문서가 담은 정보와 구조를 의미 있게 전달</li> +<li>semantic한 markup -&gt; 검색 엔진의 순위에 가산점, 로딩속도 빨라짐 등</li> +</ul> +<h4 id="span-stylecolorf9b572tagsspan"><span style="color:#F9B572">Tags</span></h4> +<ul> +<li>div +<ul> +<li>가장 흔하게 사용</li> +<li>구역을 나누기 위한 태그</li> +</ul> +</li> +<li>header +<ul> +<li>제목, 작성일 등 주요 정보를 담는 태그</li> +</ul> +</li> +<li>footer +<ul> +<li>페이지 바닥줄에 사용, 저작권 정보, 연락처 등 부차적 정보를 담는 태그</li> +</ul> +</li> +<li>main +<ul> +<li>페이지의 가장 큰 부분으로 내용, 즉 주요 콘텐츠를 담는 태그</li> +<li>한 페이지에 한번만 등장해야 함 (header, footer는 여러번 등장 가능) +-section</li> +<li>콘텐츠의 구역을 나누는 태그</li> +</ul> +</li> +<li>article +<ul> +<li>구역 안에서 작성된 정보를 전달하는 독립적인 문서의 역할을 하는 태그</li> +</ul> +</li> +<li>aside +<ul> +<li>문서 내용에 부가적인 갖접정보를 전달하는 태그</li> +<li>예) 쇼핑몰의 &lsquo;오늘 본 상품&rsquo;, 블로그의 &lsquo;위젯&rsquo; 등</li> +</ul> +</li> +</ul> +<p><strong>레이아웃 분석</strong> +<em>(배운 내용을 토대로 해본거라 정확하지 않을 수 있습니다)</em> +<img src="https://velog.velcdn.com/images/srlee056/post/6266f98d-a17e-4902-9633-2592af3db1ff/image.png" + + + + loading="lazy" + + +></p> +<h3 id="span-stylecolord0e7d2contentsspan"><span style="color:#D0E7D2">Contents</span></h3> +<ol> +<li>제목 태그 h1 ~ h6 +<ul> +<li>문서 구획 제목을 나타내는 태그</li> +<li>h1 태그는 페이지 내에 한번만 사용</li> +<li>구획 순서(h1 ~ h6)는 지켜져야 함</li> +</ul> +</li> +<li>문단 태그 p +<ul> +<li>문단을 담당하는 태그</li> +<li>제목태그와 함께 사용되기도 하고 단독으로도 사용</li> +<li>레이아웃태그처럼 사용 X</li> +</ul> +</li> +<li>서식 태그 b/strong, i/em, u, s/del +<ul> +<li>b/strong : 굵은 글씨로 변경. strong - 강조 의미 부여</li> +<li>i/em : 기울기 조절, em - 기울임과 내용에 강조 의미 부여</li> +<li>u : 밑줄을 넣고 주석을 가짐. 단순히 밑줄만 긋는 용도로는 사용 X</li> +<li>s/del : 취소선, del - 문서에서 제거된 텍스트를 나타냄 +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">p</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> 안녕하세요.<span class="p">&lt;</span><span class="nt">br</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">del</span><span class="p">&gt;</span>섦<span class="p">&lt;/</span><span class="nt">del</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">ins</span><span class="p">&gt;</span>서림<span class="p">&lt;/</span><span class="nt">ins</span><span class="p">&gt;</span>입니다. +</span></span><span class="line"><span class="cl"><span class="p">&lt;/</span><span class="nt">p</span><span class="p">&gt;</span> +</span></span></code></pre></td></tr></table> +</div> +</div> <p> + 안녕하세요.<br> + <del>섦</del> <ins>서림</ins>입니다. + </p> +</li> +</ul> +</li> +<li>링크 이동 a +<ul> +<li> +<p>클릭하면 페이지를 이동할 수 있는 링크 요소</p> +</li> +<li> +<p>href 속성으로 이동하려는 파일 / URL 작성</p> +</li> +<li> +<p>target 속성으로 새 창(_blank), 현재창(_self)등 타겟 지정 가능</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">a</span> <span class="na">href </span><span class="o">=</span> <span class="s">&#34;https://velog.io/@srlee056&#34;</span> <span class="na">target </span><span class="o">=</span> <span class="s">&#34;_blank&#34;</span><span class="p">&gt;</span> 새 창에서 블로그 열기<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span> +</span></span></code></pre></td></tr></table> +</div> +</div><p><a href = "https://velog.io/@srlee056" target = "_blank"> 새 창에서 블로그 열기</a></p> +</li> +</ul> +</li> +</ol> +<h4 id="span-stylecolorf9b572멀티미디어span"><span style="color:#F9B572">멀티미디어</span></h4> +<ol> +<li>img</li> +</ol> +<ul> +<li>이미지를 추가하는 태그</li> +<li>src : 이미지의 경로</li> +<li>alt : 로딩에 문제가 발생했을 때 대체 텍스트</li> +<li>alt 태그에 적힌 메세지가 검색엔진에 키워드로 들어감 +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">img</span> <span class="na">src </span><span class="o">=</span> <span class="s">&#34;&#34;</span> <span class="na">alt </span><span class="o">=</span> <span class="s">&#34;잘못된 로고&#34;</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">img</span> <span class="na">src </span><span class="o">=</span> <span class="s">&#34;https://cdn.icon-icons.com/icons2/2699/PNG/512/python_logo_icon_168886.png&#34;</span> <span class="na">alt </span><span class="o">=</span> <span class="s">&#34;파이썬 로고&#34;</span><span class="p">&gt;</span> +</span></span></code></pre></td></tr></table> +</div> +</div> <img src = "" alt = "잘못된 로고"> + <img src = "https://cdn.icon-icons.com/icons2/2699/PNG/512/python_logo_icon_168886.png" alt = "파이썬 로고"> +</li> +</ul> +<ol start="2"> +<li>figure, figcaption</li> +</ol> +<ul> +<li> +<p>태그 안의 내용을 하나의 독립적인 콘텐츠로 분리하고 설명을 넣을 수 있는 태그</p> +</li> +<li> +<p>보통 이미지를 넣으며 인용문, 비디오/오디오 등 문서 흐름에 참조는 되지만 독립적으로 분리되어도 되는 내용을 담는다.</p> +</li> +<li> +<p>이미지 - 인라인 레벨 요소 / 피규어 - 블록 레벨 요소</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">figure</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">img</span> <span class="na">src </span><span class="o">=</span> <span class="s">&#34;https://www.lgtwins.com/images/emblem/01.emblem.jpg&#34;</span> <span class="na">alt </span><span class="o">=</span> <span class="s">&#34;엘지 트윈스 로고&#34;</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">figcaption</span><span class="p">&gt;</span> 엘지 트윈스 우승하자! <span class="p">&lt;/</span><span class="nt">figcaption</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"><span class="p">&lt;/</span><span class="nt">figure</span><span class="p">&gt;</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +</ul> +<figure> + <figcaption> 엘지 트윈스 </figcaption> + <img src = "https://www.lgtwins.com/images/emblem/01.emblem.jpg" alt = "엘지 트윈스 로고"> + <figcaption> 우승하자! </figcaption> +</figure> +<ol start="3"> +<li>video</li> +</ol> +<ul> +<li>문서 내에 영상을 첨부할 수 있는 태그</li> +<li>src : 비디오 파일이나 온라인 링크 연결</li> +<li>poster : 비디오 로드되기 전 포스터를 보여줄 수 있음</li> +<li>&lt;<code>source&gt;</code> 태그로 여러 타입의 비디오 제공 +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span><span class="lnt">5 +</span><span class="lnt">6 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">video</span> <span class="na">src </span><span class="o">=</span> <span class="s">&#34;/video.mp4&#34;</span><span class="p">&gt;&lt;/</span><span class="nt">video</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">video</span> <span class="na">poster </span><span class="o">=</span> <span class="s">&#34;/poster.png&#34;</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">source</span> <span class="na">src </span><span class="o">=</span> <span class="s">&#34;/video.mp4&#34;</span> <span class="na">type </span><span class="o">=</span> <span class="s">&#34;video/mp4&#34;</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">source</span> <span class="na">src </span><span class="o">=</span> <span class="s">&#34;/video.webm&#34;</span> <span class="na">type </span><span class="o">=</span> <span class="s">&#34;video/webm&#34;</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> 비디오 태그가 실행되지 않을 때 보이는 글자 +</span></span><span class="line"><span class="cl"><span class="p">&lt;/</span><span class="nt">video</span><span class="p">&gt;</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +</ul> +<ol start="4"> +<li>audio</li> +</ol> +<ul> +<li> +<p>문서 내에 소리를 첨부할 수 있는 태그</p> +</li> +<li> +<p>src : 음성 파일이나 온라인 링크 연결</p> +</li> +<li> +<p>&lt;<code>source&gt;</code> 태그로 여러 타입의 오디오 제공</p> +</li> +<li> +<p>controls : 재생/정지 버튼 등이 있는 컨트롤러</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span><span class="lnt">5 +</span><span class="lnt">6 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">audio</span> <span class="na">src </span><span class="o">=</span> <span class="s">&#34;/audio.mp3&#34;</span> <span class="na">controls</span><span class="p">&gt;&lt;/</span><span class="nt">audio</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">audio</span> <span class="na">controls</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">source</span> <span class="na">src </span><span class="o">=</span> <span class="s">&#34;/audio.mp3&#34;</span> <span class="na">type </span><span class="o">=</span> <span class="s">&#34;audio/mp3&#34;</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">source</span> <span class="na">src </span><span class="o">=</span> <span class="s">&#34;/audio.ogg&#34;</span> <span class="na">type </span><span class="o">=</span> <span class="s">&#34;audio/ogg&#34;</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> 오디오 태그가 실행되지 않을 때 보이는 글자 +</span></span><span class="line"><span class="cl"><span class="p">&lt;/</span><span class="nt">audio</span><span class="p">&gt;</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +</ul> +<ol start="5"> +<li>svg</li> +</ol> +<blockquote> +<p>Scalable Vector Graphics<br> +그래픽으로 만들어진 이미지</p> +</blockquote> +<ul> +<li> +<p>해상도의 영향을 받지 않아 확대/축소 자유로움</p> +</li> +<li> +<p>크기를 자주 바꾸어야 하는 작은 아이콘 등에 많이 사용</p> +</li> +<li> +<p>최근 기기들은 해상도가 다양하게 변화하고 있어, 아이콘 외에 로고 등 주요 이미지에도 사용</p> +</li> +<li> +<p><code>&lt;img&gt;</code>태그처럼 svg 파일을 불러올수도 있고, 태그를 그대로 사용할수도 있음</p> +</li> +<li> +<p>코드로 이루어져 있어서 스타일을 변경하거나, JS를 사용해 기능 추가도 가능</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span><span class="lnt">5 +</span><span class="lnt">6 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">img</span> <span class="na">src</span><span class="o">=</span><span class="s">&#34;baseball.svg&#34;</span> <span class="na">alt</span><span class="o">=</span><span class="s">&#34;야구공 아이콘&#34;</span> <span class="p">/&gt;</span> +</span></span><span class="line"><span class="cl"><span class="c">&lt;!--또는 .svg 파일의 내용을 가져다가 쓸 수 있음--&gt;</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">svg</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> 파일 내용 +</span></span><span class="line"><span class="cl"><span class="p">&lt;/</span><span class="nt">svg</span><span class="p">&gt;</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li> +<p>svg 파일 출력 결과</p> + <svg width="100px" height="100px" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"> + <path fill="#000000" + d="M195.2 828.8a448 448 0 1 1 633.6-633.6 448 448 0 0 1-633.6 633.6zm45.248-45.248a384 384 0 1 0 543.104-543.104 384 384 0 0 0-543.104 543.104z" /> + <path fill="#000000" + d="M497.472 96.896c22.784 4.672 44.416 9.472 64.896 14.528a256.128 256.128 0 0 0 350.208 350.208c5.056 20.48 9.856 42.112 14.528 64.896A320.128 320.128 0 0 1 497.472 96.896zM108.48 491.904a320.128 320.128 0 0 1 423.616 423.68c-23.04-3.648-44.992-7.424-65.728-11.52a256.128 256.128 0 0 0-346.496-346.432 1736.64 1736.64 0 0 1-11.392-65.728z" /> + </svg> +</li> +</ul> +<h4 id="span-stylecolorf9b572리스트span"><span style="color:#F9B572">리스트</span></h4> +<ol> +<li> +<p><code>&lt;ul&gt;, &lt;li&gt;</code></p> +<blockquote> +<p>순서가 없고 정렬되지 않은 목록</p> +</blockquote> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">ul</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;</span>list 1<span class="p">&lt;/</span><span class="nt">li</span><span class="p">&gt;</span> <span class="c">&lt;!--자식 요소로 li만 와야 함--&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;</span>list 2 +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">ul</span><span class="p">&gt;</span> <span class="c">&lt;!-- ul or ol tag--&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;</span>sub list 1<span class="p">&lt;/</span><span class="nt">li</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;</span>sub list 2<span class="p">&lt;/</span><span class="nt">li</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;/</span><span class="nt">ul</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">ol</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;</span>sub list 3<span class="p">&lt;/</span><span class="nt">li</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;/</span><span class="nt">ol</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;/</span><span class="nt">li</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"><span class="p">&lt;/</span><span class="nt">ul</span><span class="p">&gt;</span> +</span></span></code></pre></td></tr></table> +</div> +</div><p>HTML 출력 결과</p> + <ul> + <li>list 1</li> <!--자식 요소로 li만 와야 함--> + <li>list 2 + <ul> <!-- ul or ol tag--> + <li>sub list 1</li> + <li>sub list 2</li> + </ul> + <ol> + <li>sub list 3</li> + </ol> + </li> + </ul> +</li> +<li> +<p><code>&lt;ol&gt;</code></p> +<blockquote> +<p>순서가 존재하며 정렬된 목록</p> +</blockquote> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">ol</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;</span>list 1<span class="p">&lt;/</span><span class="nt">li</span><span class="p">&gt;</span> <span class="c">&lt;!--자식 요소로 li만 와야 함--&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;</span>list 2 +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">ol</span><span class="p">&gt;</span> <span class="c">&lt;!-- ul or ol tag--&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;</span>sub list 1<span class="p">&lt;/</span><span class="nt">li</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;</span>sub list 2<span class="p">&lt;/</span><span class="nt">li</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;/</span><span class="nt">ol</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">ul</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">li</span><span class="p">&gt;</span>sub list 3<span class="p">&lt;/</span><span class="nt">li</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;/</span><span class="nt">ul</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;/</span><span class="nt">li</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"><span class="p">&lt;/</span><span class="nt">ol</span><span class="p">&gt;</span> +</span></span></code></pre></td></tr></table> +</div> +</div><p>HTML 출력 결과</p> + <ol> + <li>list 1</li> <!--자식 요소로 li만 와야 함--> + <li>list 2 + <ol> <!-- ul or ol tag--> + <li>sub list 1</li> + <li>sub list 2</li> + </ol> + <ul> + <li>sub list 3</li> + </ul> + </li> + </ol> +</li> +<li> +<p><code>&lt;dl&gt;, &lt;dt&gt;, &lt;dd&gt;</code></p> +</li> +</ol> +<ul> +<li>설명 목록 태그</li> +<li><code>&lt;dt&gt;</code>에 작성된 단어 혹은 내용의 설명을 <code>&lt;dd&gt;</code>에 작성</li> +<li>용어사전이나 <code>key-value</code>쌍의 목록을 나타낼 때 사용</li> +<li><code>&lt;dt&gt;</code> 여러개에 하나의 <code>&lt;dd&gt;</code> 가능 / <code>&lt;dt&gt;</code> 하나에 여러개 <code>&lt;dd&gt;</code> 가능 +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span><span class="lnt">5 +</span><span class="lnt">6 +</span><span class="lnt">7 +</span><span class="lnt">8 +</span><span class="lnt">9 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">dl</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">dt</span><span class="p">&gt;</span>Chrome<span class="p">&lt;/</span><span class="nt">dt</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">dd</span><span class="p">&gt;</span>웹 브라우저<span class="p">&lt;</span><span class="nt">dd</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">dd</span><span class="p">&gt;</span>구글에서 제작<span class="p">&lt;/</span><span class="nt">dd</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">br</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">dt</span><span class="p">&gt;</span>Whale<span class="p">&lt;/</span><span class="nt">dt</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">dt</span><span class="p">&gt;</span>Microsoft Edge<span class="p">&lt;/</span><span class="nt">dt</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">dd</span><span class="p">&gt;</span>Web Browser<span class="p">&lt;/</span><span class="nt">dd</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"><span class="p">&lt;/</span><span class="nt">dl</span><span class="p">&gt;</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +</ul> +<h4 id="span-stylecolorf9b572표span"><span style="color:#F9B572">표</span></h4> +<ul> +<li><code>&lt;table&gt;</code> : 표를 만드는 태그</li> +<li><code>&lt;tr&gt;</code> 로 행을, <code>&lt;td&gt;</code>로 열을 나타냄</li> +<li><code>&lt;th&gt;</code> : 열 제목</li> +<li><code>&lt;thead&gt;</code> : 제목 그룹 태그, 한번만 사용</li> +<li><code>&lt;tbody&gt;</code> : 표의 본문 요소 그룹 태그, 역시 한번만 사용</li> +<li><code>&lt;tfoot&gt;</code> : 표 바닥글 요소 태그</li> +<li><code>&lt;caption&gt;</code> : 표 설명 태그 +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span><span class="lnt">14 +</span><span class="lnt">15 +</span><span class="lnt">16 +</span><span class="lnt">17 +</span><span class="lnt">18 +</span><span class="lnt">19 +</span><span class="lnt">20 +</span><span class="lnt">21 +</span><span class="lnt">22 +</span><span class="lnt">23 +</span><span class="lnt">24 +</span><span class="lnt">25 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">table</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">caption</span><span class="p">&gt;</span>sample table<span class="p">&lt;/</span><span class="nt">caption</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">thead</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">tr</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">th</span><span class="p">&gt;</span>col 1<span class="p">&lt;/</span><span class="nt">th</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">th</span><span class="p">&gt;</span>col 2<span class="p">&lt;/</span><span class="nt">th</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;/</span><span class="nt">tr</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;/</span><span class="nt">thead</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">tfoot</span><span class="p">&gt;</span> <span class="c">&lt;!-- HTML4 에선 tbody 앞--&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">tr</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">td</span><span class="p">&gt;</span>footer<span class="p">&lt;/</span><span class="nt">td</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">td</span><span class="p">&gt;</span>footer<span class="p">&lt;/</span><span class="nt">td</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;/</span><span class="nt">tr</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;/</span><span class="nt">tfoot</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">tbody</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">tr</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">td</span><span class="p">&gt;</span> row1 col1 <span class="p">&lt;/</span><span class="nt">td</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">td</span><span class="p">&gt;</span> row1 col2 <span class="p">&lt;/</span><span class="nt">td</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;/</span><span class="nt">tr</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;/</span><span class="nt">tbody</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">tr</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">td</span><span class="p">&gt;</span> row2 col1 <span class="p">&lt;/</span><span class="nt">td</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">td</span><span class="p">&gt;</span> row2 col2 <span class="p">&lt;/</span><span class="nt">td</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;/</span><span class="nt">tr</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"><span class="p">&lt;/</span><span class="nt">table</span><span class="p">&gt;</span> +</span></span></code></pre></td></tr></table> +</div> +</div> <table> + <caption>sample table</caption> + <thead> + <tr> + <th>col 1</th> + <th>col 2</th> + </tr> + </thead> + <tfoot> <!-- HTML4 에선 tbody 앞--> + <tr> + <td>footer</td> + <td>footer</td> + </tr> + </tfoot> + <tbody> + <tr> + <td> row1 col1 </td> + <td> row1 col2 </td> + </tr> + </tbody> + <tr> + <td> row2 col1 </td> + <td> row2 col2 </td> + </tr> + </table> +</li> +</ul> +<h4 id="span-stylecolorf9b572iframespan"><span style="color:#F9B572">iframe</span></h4> +<blockquote> +<p>현재 문서 안에 다른 HTML 페이지를 삽입하는 역할</p> +</blockquote> +<ul> +<li>src 속성에 원하는 HTML 문서나 URL 전달</li> +<li>name 속성을 지정해 <code>&lt;a&gt;</code> target 속성을 사용해 iframe에서 문서나 URL 열리게 가능</li> +<li>불러온 외부 페이지의 영향을 받을 수 있다. +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span><span class="lnt">5 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">iframe</span> <span class="na">src </span><span class="o">=</span> <span class="s">&#34;/sample.html&#34;</span> <span class="na">frameborder </span><span class="o">=</span> <span class="s">&#34;0&#34;</span><span class="p">&gt;&lt;/</span><span class="nt">iframe</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">iframe</span> <span class="na">name</span><span class="o">=</span><span class="s">&#34;sample&#34;</span> <span class="na">frameborder</span><span class="o">=</span><span class="s">&#34;0&#34;</span><span class="p">&gt;&lt;/</span><span class="nt">iframe</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&#34;https://example.com/&#34;</span> <span class="na">target</span><span class="o">=</span><span class="s">&#34;sample&#34;</span><span class="p">&gt;</span>example.com<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"><span class="c">&lt;!--target으로 설정된 iframe에서 외부 페이지가 열림--&gt;</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +</ul> +<h3 id="span-stylecolord0e7d2양식-태그span"><span style="color:#D0E7D2">양식 태그</span></h3> +<h4 id="span-stylecolorf9b572formspan"><span style="color:#F9B572">form</span></h4> +<ul> +<li> +<p>정보를 제출하기 위한 태그</p> +</li> +<li> +<p>정보 입력을 위한 <code>&lt;input&gt;</code>, <code>&lt;selectbox&gt;</code>, <code>&lt;textarea&gt;</code></p> +</li> +<li> +<p>정보 제출을 위한 <code>&lt;button&gt;</code></p> +</li> +<li> +<p>action 속성 : 정보 제출 시 페이지 이동</p> +</li> +<li> +<p>method 속성 : 정보 제출 시 처리 방식 결정</p> +<ul> +<li>get : 검색 엔진 등에 사용</li> +<li>post : 로그인 등 보안이 중요한 방식에 사용</li> +</ul> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">form</span> <span class="na">action</span><span class="o">=</span><span class="s">&#34;form-result.html&#34;</span> <span class="na">method</span><span class="o">=</span><span class="s">&#34;post&#34;</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">input</span> <span class="na">name</span><span class="o">=</span><span class="s">&#34;id&#34;</span> <span class="na">type</span><span class="o">=</span><span class="s">&#34;text&#34;</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">input</span> <span class="na">name</span><span class="o">=</span><span class="s">&#34;password&#34;</span> <span class="na">type</span><span class="o">=</span><span class="s">&#34;password&#34;</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">select</span> <span class="na">name</span><span class="o">=</span><span class="s">&#34;opt&#34;</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">option</span><span class="p">&gt;</span>옵션1<span class="p">&lt;/</span><span class="nt">option</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">option</span><span class="p">&gt;</span>옵션2<span class="p">&lt;/</span><span class="nt">option</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">option</span><span class="p">&gt;</span>옵션3<span class="p">&lt;/</span><span class="nt">option</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;/</span><span class="nt">select</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">button</span> <span class="na">type</span><span class="o">=</span><span class="s">&#34;submit&#34;</span><span class="p">&gt;</span>전송<span class="p">&lt;/</span><span class="nt">button</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"><span class="p">&lt;/</span><span class="nt">form</span><span class="p">&gt;</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +</ul> +<h4 id="span-stylecolorf9b572labelspan"><span style="color:#F9B572">label</span></h4> +<ul> +<li><code>&lt;input&gt;</code>, <code>&lt;selectbox&gt;</code>, <code>&lt;textarea&gt;</code> 의 설명을 작성하는 태그</li> +<li>for 속성 : 연결하려는 태그의 id속성으로 지정하면 label클릭 시 연결된 태그가 선택됨</li> +<li>label 태그 내부에 input 태그를 넣으면, for-&gt;id 연결을 직접 작성하지 않아도 같은 처리를 해 준다.</li> +<li><strong>id 속성값은 절대 중복되면 안됨</strong></li> +</ul> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span><span class="lnt">5 +</span><span class="lnt">6 +</span><span class="lnt">7 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">label</span> <span class="na">for </span><span class="o">=</span><span class="s">&#34;userid&#34;</span><span class="p">&gt;</span>아이디<span class="p">&lt;/</span><span class="nt">label</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">input</span> <span class="na">id </span><span class="o">=</span> <span class="s">&#34;userid&#34;</span> <span class="na">type </span><span class="o">=</span> <span class="s">&#34;text&#34;</span> <span class="na">name </span><span class="o">=</span> <span class="s">&#34;userid&#34;</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">label</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> 비밀번호 +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">input</span> <span class="na">name </span><span class="o">=</span> <span class="s">&#34;password&#34;</span> <span class="na">type </span><span class="o">=</span> <span class="s">&#34;password&#34;</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"><span class="p">&lt;/</span><span class="nt">label</span><span class="p">&gt;</span> +</span></span></code></pre></td></tr></table> +</div> +</div><h4 id="span-stylecolorf9b572inputspan"><span style="color:#F9B572">input</span></h4> +<ul> +<li> +<p>사용자에게 데이터를 입력 받을 수 있는 대화형 태그</p> +</li> +<li> +<p>type 속성 : 받을 수 있는 input 유형을 정함 (기본:text)</p> +</li> +<li> +<p>value 속성 : 기본 내용을 입력해둘 수 있음</p> +</li> +<li> +<p>name : input 이름 지정</p> +</li> +<li> +<p>자주 사용되는 input type</p> +<ul> +<li>checkbox</li> +<li>radio</li> +<li>file</li> +<li>button : input 태그를 버튼역할로 사용해야할 때 활용</li> +<li>hidden : 시각적으로 숨겨지지만 정보 제출 시 value속성에 입력된 값은 전송됨</li> +</ul> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">input</span> <span class="na">type</span><span class="o">=</span><span class="s">&#34;text&#34;</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">input</span> <span class="na">type</span><span class="o">=</span><span class="s">&#34;text&#34;</span> <span class="na">name</span><span class="o">=</span><span class="s">&#34;input-name&#34;</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">input</span> <span class="na">type</span><span class="o">=</span><span class="s">&#34;text&#34;</span> <span class="na">value</span><span class="o">=</span><span class="s">&#34;입력 내용&#34;</span><span class="p">&gt;</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +</ul> +<h4 id="span-stylecolorf9b572selectspan"><span style="color:#F9B572">select</span></h4> +<ul> +<li>select, selectbox</li> +<li>옵션 메뉴를 제공하는 태그</li> +<li>option 태그 : 선택할 옵션들을 정의</li> +<li>value 속성 : 제출 시 선택한 옵션의 value값이 전송됨</li> +<li>value 속성을 선언하지 않은 경우엔 option 태그 콘텐츠가 기본값</li> +<li>placehoder 속성 사용 불가</li> +</ul> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span><span class="lnt">5 +</span><span class="lnt">6 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-html" data-lang="html"><span class="line"><span class="cl"><span class="p">&lt;</span><span class="nt">select</span> <span class="na">name </span><span class="o">=</span> <span class="s">&#34;selectbox&#34;</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">option</span> <span class="na">value</span><span class="o">=</span><span class="s">&#34;&#34;</span><span class="p">&gt;</span>choose<span class="p">&lt;/</span><span class="nt">option</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">option</span> <span class="na">value </span><span class="o">=</span> <span class="s">&#34;opt1&#34;</span><span class="p">&gt;</span>opt1<span class="p">&lt;/</span><span class="nt">option</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">option</span> <span class="na">value </span><span class="o">=</span> <span class="s">&#34;opt2&#34;</span><span class="p">&gt;</span>opt2<span class="p">&lt;/</span><span class="nt">option</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"> <span class="p">&lt;</span><span class="nt">option</span><span class="p">&gt;</span>opt3<span class="p">&lt;/</span><span class="nt">option</span><span class="p">&gt;</span> +</span></span><span class="line"><span class="cl"><span class="p">&lt;/</span><span class="nt">select</span><span class="p">&gt;</span> +</span></span></code></pre></td></tr></table> +</div> +</div><h4 id="span-stylecolorf9b572textareaspan"><span style="color:#F9B572">textarea</span></h4> +<ul> +<li>여러 줄을 입력할 수 있는 대화형 태그</li> +<li>콘텐츠에 내용을 입력할 경우 그 내용이 기본적으로 표시됨</li> +<li>cols/rows 속성 : 기본 너비와 높이를 지정할 수 있으며, 이는 글자 크기 기준으로 정의됨</li> +<li>알아두면 좋은 속성 +<ul> +<li>readonly : 수정 불가능한 읽기 전용</li> +<li>required : form 제출 시 &ldquo;필수 입력 사항&quot;으로 설정 (안내 문구나 행동 등은 브라우저가 자동으로 처리함)</li> +<li>placeholder : input, textarea에 부가설명을 입력해둘 수 있으며, select 에는 사용 불가</li> +<li>disabled : 비활성화되어 제출 시 값이 전송되지 않음</li> +</ul> +</li> +</ul> +<h4 id="span-stylecolorf9b572buttonspan"><span style="color:#F9B572">button</span></h4> +<ul> +<li>클릭가능한 버튼</li> +<li>form tag 내 어디서든 사용 가능</li> +<li>type 속성 +<ul> +<li>submit(기본): 양식 제출</li> +<li>reset: 입력 양식 모두 초기화</li> +</ul> +</li> +<li>콘텐츠에 블록레벨을 제외한 태그 입력 가능</li> +<li>disabled 속성 가능</li> +</ul> +<h2 id="span-stylecolorb0d9b1checkspan">👀 <span style="color:#B0D9B1">CHECK</span></h2> +<h6 id="어렵거나-새롭게-알게-된-것-등-다시-확인할-것들"><em>(어렵거나 새롭게 알게 된 것 등 다시 확인할 것들)</em></h6> +<ul> +<li>vscode -&gt; cmd + , -&gt; folder 검색 -&gt; 계층 구조 관련 옵션 바꿀 수 있음</li> +<li>markup : <a class="link" href="https://zdnet.co.kr/view/?no=00000010047880" target="_blank" rel="noopener" + >설명 블로그</a></li> +<li>맥에서 크롬 개발자 도구 한번에 키는 단축키 : cmd + shift + c</li> +</ul> +<h2 id="span-stylecolorb0d9b1느낀-점span">❗ <span style="color:#B0D9B1">느낀 점</span></h2> +<p>HTML문법이나 태그 등에 대한건 이미 알고 있었지만 이론적으로 정리해본 적은 없었기에 이번 강의를 듣고 정리할 수 있어서 좋았다. 특히 contents 태그와 단일 태그의 존재는 알았지만 그 명칭은 몰랐기 때문에 머리속에서 모호하게 정의된 개념들이 이름을 가지고 명확해져서 좋았다.</p> +<p>강의 내용을 정리하고 직접 실행해보고 궁금한 부분은 따로 찾아보는 등 하다보니 주어진 코어타임보다 훨씬 더 오랜 시간을 붙잡고 있게 되었다. 중간중간 집중력도 떨어지고 체력적으로도 힘든 걸 느끼면서, 이론적인 공부보다는 실제 코드를 작성하는 게 더 재밌다는걸 새삼 체감했다. 그렇지만 이론적인 공부가 전부가 아니더라도 기본적인건 알아야 하니까 재미없다고 등한시 하지는 않아야겠다. :&lt;</p> +<p>이번주는 드디어 웹 크롤링과 분석을 시작하는데, 내가 해봤던 것과 다른점은 무엇이고 어떤걸 배워나가게 될지 벌써부터 기대가 된다. 내일도 열심히 하는 하루를 보내야겠다. :&gt;</p> + + + + Day 5 + https://srlee056.github.io/p/day-5/ + Fri, 20 Oct 2023 00:00:00 +0000 + + https://srlee056.github.io/p/day-5/ + <h1 id="span-stylecolor79ac78til---heap--dynamic-programming--dfsbfs-문제풀이-위주span"><strong><span style="color:#79AC78">TIL - Heap / Dynamic Programming / DFS&amp;BFS (문제풀이 위주)</span></strong></h1> +<h2 id="span-stylecolorb0d9b1공부-내용span">📋 <strong><span style="color:#B0D9B1">공부 내용</span></strong></h2> +<h3 id="span-stylecolord0e7d2heapspan"><span style="color:#D0E7D2">Heap</span></h3> +<hr> +<h4 id="더-맵게-문제-풀이">&lt;더 맵게&gt; 문제 풀이</h4> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span><span class="lnt">14 +</span><span class="lnt">15 +</span><span class="lnt">16 +</span><span class="lnt">17 +</span><span class="lnt">18 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">heapq</span> <span class="c1">#heap 라이브러리 사용</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">solution</span><span class="p">(</span><span class="n">scoville</span><span class="p">,</span> <span class="n">K</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">answer</span> <span class="o">=</span> <span class="mi">0</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># heapify, heappop, heappush 활용</span> +</span></span><span class="line"><span class="cl"> <span class="n">heapq</span><span class="o">.</span><span class="n">heapify</span><span class="p">(</span><span class="n">scoville</span><span class="p">)</span> <span class="c1">#min heap 구성</span> +</span></span><span class="line"><span class="cl"> <span class="k">while</span> <span class="kc">True</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">s1</span> <span class="o">=</span> <span class="n">heapq</span><span class="o">.</span><span class="n">heappop</span><span class="p">(</span><span class="n">scoville</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">s1</span> <span class="o">&gt;=</span> <span class="n">K</span> <span class="p">:</span> <span class="c1">#모든 스코빌 지수가 K이상</span> +</span></span><span class="line"><span class="cl"> <span class="k">break</span> +</span></span><span class="line"><span class="cl"> <span class="k">elif</span> <span class="nb">len</span><span class="p">(</span><span class="n">scoville</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span> <span class="c1"># K이상으로 만들 수 없는 경우</span> +</span></span><span class="line"><span class="cl"> <span class="n">answer</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span> +</span></span><span class="line"><span class="cl"> <span class="k">break</span> +</span></span><span class="line"><span class="cl"> <span class="n">s2</span> <span class="o">=</span> <span class="n">heapq</span><span class="o">.</span><span class="n">heappop</span><span class="p">(</span><span class="n">scoville</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="n">newS</span> <span class="o">=</span> <span class="n">s1</span> <span class="o">+</span> <span class="n">s2</span><span class="o">*</span><span class="mi">2</span> +</span></span><span class="line"><span class="cl"> <span class="n">heapq</span><span class="o">.</span><span class="n">heappush</span><span class="p">(</span><span class="n">scoville</span><span class="p">,</span><span class="n">newS</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="n">answer</span> <span class="o">+=</span> <span class="mi">1</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">answer</span> +</span></span></code></pre></td></tr></table> +</div> +</div><br> +<h3 id="span-stylecolord0e7d2dynamic-programmingspan"><span style="color:#D0E7D2">Dynamic Programming</span></h3> +<hr> +<h4 id="dpdynamic-programming">DP(Dynamic Programming)</h4> +<blockquote> +<p>알고리즘 진행에 따라 <code>탐색해야 할 범위를 동적으로 결정</code>하여 탐색 범위를 한정</p> +</blockquote> +<p><strong>EX1)</strong> <em>피보나치 수열</em></p> +<table> +<thead> +<tr> +<th>Complexity</th> +<th>재귀함수</th> +<th>DP</th> +</tr> +</thead> +<tbody> +<tr> +<td>Time</td> +<td>O(2^n)</td> +<td>O(n)</td> +</tr> +<tr> +<td>Space</td> +<td>O(n)</td> +<td>O(n)</td> +</tr> +</tbody> +</table> +<p>참고 : <a class="link" href="https://towardsdatascience.com/dynamic-programming-i-python-8b20387870f5" target="_blank" rel="noopener" + >Recursion vs Dynamic Programming - Fibonacci</a></p> +<p><strong>EX2)</strong> <em>knapsack problem</em><br> +weight / value를 가진 여러 물건이 있을 때, weight 제한이 있는 베낭에 value의 합이 가장 높도록 물건을 골라 담는 문제</p> +<br> +<h4 id="n으로-표현-문제-풀이">&lt;N으로 표현&gt; 문제 풀이</h4> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span><span class="lnt">14 +</span><span class="lnt">15 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">solution</span><span class="p">(</span><span class="n">N</span><span class="p">,</span> <span class="n">number</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">strN</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">N</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># 직관적인 코드를 위해 다음과 같이 index : 1~8 사용 설정 (index 0은 사용하지 않음)</span> +</span></span><span class="line"><span class="cl"> <span class="n">numberUsed</span> <span class="o">=</span> <span class="p">[{}</span> <span class="k">for</span> <span class="n">_</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">9</span><span class="p">)]</span> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">9</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">numberUsed</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span><span class="nb">int</span><span class="p">(</span><span class="n">strN</span> <span class="o">*</span> <span class="p">(</span><span class="n">i</span><span class="p">))}</span> <span class="c1"># N을 i번 나열한 숫자 ex) 555, 7777, ...</span> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">j</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span> <span class="p">,</span> <span class="n">i</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">n1</span> <span class="ow">in</span> <span class="n">numberUsed</span><span class="p">[</span><span class="n">j</span><span class="p">]:</span> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">n2</span> <span class="ow">in</span> <span class="n">numberUsed</span><span class="p">[</span><span class="n">i</span><span class="o">-</span><span class="n">j</span><span class="p">]:</span> +</span></span><span class="line"><span class="cl"> <span class="n">newNumbers</span> <span class="o">=</span> <span class="p">[</span><span class="n">n1</span><span class="o">*</span><span class="n">n2</span><span class="p">,</span> <span class="n">n1</span><span class="o">+</span><span class="n">n2</span><span class="p">,</span> <span class="n">n1</span><span class="o">-</span><span class="n">n2</span><span class="p">]</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">n2</span> <span class="o">!=</span> <span class="mi">0</span> <span class="p">:</span> <span class="n">newNumbers</span><span class="o">.</span><span class="n">append</span><span class="p">(</span> <span class="n">n1</span><span class="o">//</span><span class="n">n2</span> <span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="n">numberUsed</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">newNumbers</span><span class="p">)</span> <span class="c1">#set1.update(set2) 사용하여 원소 추가. set 아닌 list를 넘겨줄수도 있다.</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">number</span> <span class="ow">in</span> <span class="n">numberUsed</span><span class="p">[</span><span class="n">i</span><span class="p">]:</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">i</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="o">-</span><span class="mi">1</span> +</span></span></code></pre></td></tr></table> +</div> +</div><br> +<h3 id="span-stylecolord0e7d2dfs--bfsspan"><span style="color:#D0E7D2">DFS &amp; BFS</span></h3> +<h4 id="1-depth-first-search">1. Depth First Search</h4> +<blockquote> +<p>한 vertex에서 인접한 모든 vertex를 방문할 때, 인접한 vertex를 기준으로 <code>깊이 우선 탐색</code>을 끝낸 후 다음 vertex로 진행하는 방식<br> +<code>스택</code>을 이용하여 어느 정점에서 DFS를 진행하고 있는지를 기억</p> +</blockquote> +<h4 id="2-breadth-first-search">2. Breadth First Search</h4> +<blockquote> +<p>한 vertex에서 인접한 모든 vertex를 방문하고, 방문한 인접 vertex를 기준으로 <code>너비 우선 탐색</code>을 진행하는 방식</p> +</blockquote> +<h4 id="3-graph">3. Graph</h4> +<blockquote> +<p>-vertex(=node) &amp; edge(=link)<br> +-directed / undirected graph</p> +</blockquote> +<h4 id="여행-경로-문제-풀이">&lt;여행 경로&gt; 문제 풀이</h4> +<p>DFS를 응용한 재귀 한 붓 그리기</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span><span class="lnt">14 +</span><span class="lnt">15 +</span><span class="lnt">16 +</span><span class="lnt">17 +</span><span class="lnt">18 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">solution</span><span class="p">(</span><span class="n">tickets</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">routes</span> <span class="o">=</span> <span class="p">{}</span> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="ow">in</span> <span class="n">tickets</span><span class="p">:</span> <span class="c1">#출발지, 도착지</span> +</span></span><span class="line"><span class="cl"> <span class="n">routes</span><span class="p">[</span><span class="n">a</span><span class="p">]</span> <span class="o">=</span> <span class="n">routes</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="p">[])</span> +</span></span><span class="line"><span class="cl"> <span class="n">routes</span><span class="p">[</span><span class="n">a</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">b</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">r</span> <span class="ow">in</span> <span class="n">routes</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">routes</span><span class="p">[</span><span class="n">r</span><span class="p">]</span><span class="o">.</span><span class="n">sort</span><span class="p">(</span><span class="n">reverse</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># 역순인 이유? 파이썬의 데이터 삭제 과정을 살펴보면 뒤에서 뽑는게 더 효울적이기 때문 </span> +</span></span><span class="line"><span class="cl"> <span class="n">stack</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&#34;ICN&#34;</span><span class="p">]</span> +</span></span><span class="line"><span class="cl"> <span class="n">path</span> <span class="o">=</span> <span class="p">[]</span> +</span></span><span class="line"><span class="cl"> <span class="k">while</span> <span class="mi">0</span> <span class="o">&lt;</span> <span class="nb">len</span><span class="p">(</span><span class="n">stack</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">top</span> <span class="o">=</span> <span class="n">stack</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">top</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">routes</span> <span class="ow">or</span> <span class="nb">len</span><span class="p">(</span><span class="n">routes</span><span class="p">[</span><span class="n">top</span><span class="p">])</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span> <span class="c1"># 이 공항에서 떠나는 티켓이 존재하지 않음</span> +</span></span><span class="line"><span class="cl"> <span class="n">path</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">stack</span><span class="o">.</span><span class="n">pop</span><span class="p">())</span> +</span></span><span class="line"><span class="cl"> <span class="k">else</span> <span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">stack</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">routes</span><span class="p">[</span><span class="n">top</span><span class="p">]</span><span class="o">.</span><span class="n">pop</span><span class="p">())</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">path</span><span class="p">[::</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> +</span></span></code></pre></td></tr></table> +</div> +</div><br> +<h3 id="span-stylecolord0e7d2추가-문제풀이span"><span style="color:#D0E7D2">추가 문제풀이</span></h3> +<details> +<summary>문제 링크 모음(많이 김)</summary> +<!-- summary 아래 한칸 공백 두어야함 --> +<br> +프로그래머스 코딩테스트 문제 링크 (코스에 있는 문제여도 프로그래머스 코테 링크로 적음) +<ul> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/42576" target="_blank" rel="noopener" + >완주하지 못한 사람</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/12909" target="_blank" rel="noopener" + >올바른 괄호</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/49993" target="_blank" rel="noopener" + >스킬트리</a> +<br></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/12978" target="_blank" rel="noopener" + >배달</a> +<br></li> +<li>[세 소수의 합]</li> +<li>[주사위 게임]</li> +<li><a class="link" href="https://school.programmers.co.kr/app/courses/19071/curriculum/lessons/236812" target="_blank" rel="noopener" + >사탕 담기</a> +<br></li> +<li>[빙고]</li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/49994" target="_blank" rel="noopener" + >방문 길이</a></li> +<li>[쇠막대기]</li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/60059" target="_blank" rel="noopener" + >자물쇠와 열쇠</a> +<br></li> +<li>[게임 아이템] +<br></li> +<li><a class="link" href="https://school.programmers.co.kr/app/courses/19071/curriculum/lessons/236806" target="_blank" rel="noopener" + >기능개발</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/42626" target="_blank" rel="noopener" + >더 맵게</a></li> +<li>[배상 비용 최소화]</li> +<li>[문자열 압축 코드] +<br></li> +<li><a class="link" href="https://school.programmers.co.kr/app/courses/19071/curriculum/lessons/236811" target="_blank" rel="noopener" + >카펫</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/12982" target="_blank" rel="noopener" + >예산</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/12952" target="_blank" rel="noopener" + >N-Queen</a></li> +<li>[버스 여행] +<br></li> +<li><a class="link" href="https://school.programmers.co.kr/app/courses/19071/curriculum/lessons/236805" target="_blank" rel="noopener" + >예산_소팅</a></li> +<li><a class="link" href="https://school.programmers.co.kr/app/courses/19071/curriculum/lessons/236808" target="_blank" rel="noopener" + >최솟값 만들기</a></li> +<li><a class="link" href="https://school.programmers.co.kr/app/courses/19071/curriculum/lessons/236807" target="_blank" rel="noopener" + >가장 큰 수</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/42895" target="_blank" rel="noopener" + >N으로 표현</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/12900" target="_blank" rel="noopener" + >2 x n 타일링</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/42898" target="_blank" rel="noopener" + >등굣길</a></li> +<li><a class="link" href="https://school.programmers.co.kr/learn/courses/30/lessons/12904" target="_blank" rel="noopener" + >가장 긴 팰린드롬</a> +<br></li> +</ul> +</details> +<h2 id="span-stylecolorb0d9b1checkspan">👀 <strong><span style="color:#B0D9B1">CHECK</span></strong></h2> +<h6 id="어렵거나-새롭게-알게-된-것-등-다시-확인할-것들"><em>(어렵거나 새롭게 알게 된 것 등 다시 확인할 것들)</em></h6> +<h4 id="pep-8">PEP 8</h4> +<p>파이썬이 추구하는 코드 스타일. 들여쓰기, 공백, 변수명 작성 규칙 등이 포함된다.</p> +<ul> +<li><a class="link" href="https://peps.python.org/pep-0008/" target="_blank" rel="noopener" + >PEP 8 - Style Guide for Python Code(공식 문서)</a></li> +<li><a class="link" href="https://wayhome25.github.io/python/2017/05/04/pep8/" target="_blank" rel="noopener" + >PEP8 스타일 가이드를 설명하는 블로그(한국어)</a></li> +</ul> +<h4 id="tim-sort">Tim sort</h4> +<p>Insertion sort + Merge sort</p> +<ul> +<li>Insertion sort는 <code>n이 작을 때</code> (Quick sort보다도) 빠름</li> +<li>전체를 작은 덩어리로 잘라 Insertion sort -&gt; Merge</li> +<li><a class="link" href="https://d2.naver.com/helloworld/0315536" target="_blank" rel="noopener" + >Tim sort에 대해 설명하는 글</a></li> +</ul> +<h4 id="dp-익숙해지기">DP 익숙해지기</h4> +<ul> +<li>knapsack problem 등 문제풀이를 통해 익숙해지기</li> +</ul> +<h2 id="span-stylecolorb0d9b1느낀-점span">❗ <strong><span style="color:#B0D9B1">느낀 점</span></strong></h2> +<p>오늘은 DP(Dynamic Programming)과 DFS&amp;BFS의 개념에 대해 가볍게 배우고, 문제풀이를 위주로 강의가 진행되었다.</p> +<p>아는 알고리즘들이고 어제 강의의 문제가 나에겐 어렵지 않았기 때문에, 해설 강의를 듣기 전에 문제를 먼저 풀어 보았다. 문제를 풀다가 막히는 부분이 있으면 강의를 틀고, 해결되면 멈추고 다시 풀어보곤 했다.<br> +Heap 문제를 제외한 두 문제는 해설 없이 풀었고, Heap 문제도 heapq 라이브러리를 사용해야하는 것을 깨닫고는 금방 풀 수 있었다.</p> +<p>이번주 강의를 듣고 문제를 풀면서 느낀점이 몇개 있다.</p> +<ol> +<li> +<p>나는 알고리즘 자체는 꽤 잘 알고 활용도 잘 하는 편이지만 라이브러리 사용에 있어서 소극적인 면이 있다. 문제를 풀 때 파이썬 표준 라이브러리조차도 잘 import하지 않고 Dictionary나 Set정도만 사용하는 편이었다. <em>(Heap도 자체적으로 구현하거나 list를 사용하곤 했는데 왜 이런 습관이 들었는지는 잘 모르겠다.)</em> <br> +이번 강의를 들으면서 표준 라이브러리에 있는 여러 데이터형을 활용했고 다음에 문제를 풀 때도 적극적으로 활용하면서 더 효과적인 코드를 작성하는데 가까워지려고 한다.</p> +</li> +<li> +<p>나는 CS 용어를 잘 모른다. 아예 모른다는게 아니라, 많이 헷갈리며 정확한 명칭을 찾아보지 않았다는 의미이다. member method, list comprehension 등 용어들은 분명 내가 궁금해서 찾아봤지만 아직도 헷갈리거나 명칭 자체를 몰랐던 것들이다. 강의를 통해 명확해지거나 새롭게 알게 된 용어들이 있어서 좋았고, 이제부터는 모르는 부분에 대해 검색할 때는 아예 용어와 그 정의부터 찾는것부터 시작해야겠다고 다짐했다.</p> +</li> +</ol> +<p>내일은 강의가 없는 날이다. 하지만 해야 할 일들은 있다. 오늘까지 배운걸 복습하고, 배운 자료구조와 알고리즘을 활용하는 문제들을 lv3정도로 풀어 볼 것이다. 내일도 화이팅!!</p> + + + + Day 4 + https://srlee056.github.io/p/day-4/ + Thu, 19 Oct 2023 00:00:00 +0000 + + https://srlee056.github.io/p/day-4/ + <h1 id="span-stylecolor79ac78til---hash--greedy--sort-문제풀이-위주span"><strong><span style="color:#79AC78">TIL - Hash / Greedy &amp; Sort (문제풀이 위주)</span></strong></h1> +<h2 id="span-stylecolorb0d9b1공부-내용span">📋 <strong><span style="color:#B0D9B1">공부 내용</span></strong></h2> +<h3 id="span-stylecolord0e7d2hashspan"><span style="color:#D0E7D2">Hash</span></h3> +<ul> +<li> +<p>Hash?<br> +개념 정리가 필요하다고 느껴서 글을 따로 발행했다.</p> +<ul> +<li> +<p><a class="link" href="https://www.baeldung.com/cs/hash-tables" target="_blank" rel="noopener" + >Understanding Hash Table</a></p> +</li> +<li> +<p><a class="link" href="https://velog.io/@srlee056/Hash-Table-%EC%9D%B4%ED%95%B4%ED%95%98%EA%B8%B0" target="_blank" rel="noopener" + >(번역 및 정리)Hash Table 이해하기</a></p> +</li> +</ul> +</li> +<li> +<p><code>완주하지 못한 선수</code> 문제풀이</p> +<ul> +<li>python dictionary 를 활용하여 hasing 구현</li> +</ul> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">solution</span><span class="p">(</span><span class="n">participant</span><span class="p">,</span> <span class="n">completion</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">answer</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span> +</span></span><span class="line"><span class="cl"> <span class="n">pDict</span> <span class="o">=</span> <span class="p">{}</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># 참가자/ 완주자 정보가 주어질 때, 이름을 key로 활용하여 dictionary 형태에 넣고 빼는 방식으로</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># (동명이인이 있을 때에도) 어떤 이름을 가진 사람이 완주를 하지 못했는지 확인할 수 있다. </span> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">participant</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">pDict</span><span class="p">[</span><span class="n">p</span><span class="p">]</span> <span class="o">=</span> <span class="n">pDict</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> <span class="o">+</span> <span class="mi">1</span> <span class="c1">#.get()을 통해 default 값을 세팅하는 한 방법</span> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">completion</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">pDict</span><span class="p">[</span><span class="n">p</span><span class="p">]</span> <span class="o">-=</span> <span class="mi">1</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="n">incompletion</span> <span class="o">=</span> <span class="p">[</span><span class="n">k</span> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">pDict</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> <span class="k">if</span> <span class="n">v</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">]</span> +</span></span><span class="line"><span class="cl"> <span class="n">answer</span> <span class="o">=</span> <span class="n">incompletion</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">answer</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +</ul> +<h3 id="span-stylecolord0e7d2greedy-algorithmspan"><span style="color:#D0E7D2">Greedy Algorithm</span></h3> +<ul> +<li> +<p>탐욕법(greedy algorithm)</p> +<ul> +<li>알고리즘의 각 단계에서 <strong>그 순간의 최적의 선택</strong>을 함</li> +<li>탐욕법으로 최적해를 찾을 수 있는 문제<br> += 현재 선택이 마지막 답의 최적성을 해치지 않는 문제</li> +</ul> +</li> +<li> +<p><code>체육복</code> 문제풀이</p> +<ul> +<li>비슷해보이는 조건문이라해도 그 순서에 따라 전혀 다른 결과가 나올 수 있음</li> +<li>작은 번호부터 큰 번호로 순회하기 때문에, 작은 번호가 조건을 만족하는지 먼저 고려함</li> +</ul> +</li> +<li> +<p><code>큰 수 만들기</code> 문제풀이</p> +<ul> +<li>매 단계마다 작은 숫자를 지우는 탐욕법을 사용하며, 이 방식은 마지막에 최적성을 충족하게 됨</li> +</ul> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span><span class="lnt">14 +</span><span class="lnt">15 +</span><span class="lnt">16 +</span><span class="lnt">17 +</span><span class="lnt">18 +</span><span class="lnt">19 +</span><span class="lnt">20 +</span><span class="lnt">21 +</span><span class="lnt">22 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">solution</span><span class="p">(</span><span class="n">number</span><span class="p">,</span> <span class="n">k</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">collected</span> <span class="o">=</span> <span class="p">[]</span> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">num</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">number</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># collected에 미리 들어간 원소가 있을 것</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># 제일 마지막으로 들어간 원소는 현재 num 값보다 작을 것</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># (제거해야 하는 숫자의 개수) k가 0보다 클 것</span> +</span></span><span class="line"><span class="cl"> <span class="k">while</span> <span class="nb">len</span><span class="p">(</span><span class="n">collected</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="ow">and</span> <span class="n">collected</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">&lt;</span> <span class="n">num</span> <span class="ow">and</span> <span class="n">k</span> <span class="o">&gt;</span><span class="mi">0</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">collected</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> +</span></span><span class="line"><span class="cl"> <span class="n">k</span> <span class="o">-=</span><span class="mi">1</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">k</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">collected</span> <span class="o">+=</span> <span class="nb">list</span><span class="p">(</span><span class="n">number</span><span class="p">[</span><span class="n">i</span><span class="p">:])</span> +</span></span><span class="line"><span class="cl"> <span class="k">break</span> +</span></span><span class="line"><span class="cl"> <span class="n">collected</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">num</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="c1"># 제거해야 하는 숫자의 개수가 남아있을 때 </span> +</span></span><span class="line"><span class="cl"> <span class="c1"># (코드가 너무 직관적이고 예뻤다. :&gt;)</span> +</span></span><span class="line"><span class="cl"> <span class="n">collected</span> <span class="o">=</span> <span class="n">collected</span><span class="p">[:</span><span class="o">-</span><span class="n">k</span><span class="p">]</span> <span class="k">if</span> <span class="n">k</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="k">else</span> <span class="n">collected</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="n">answer</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">collected</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">answer</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +</ul> +<h3 id="span-stylecolord0e7d2sortspan"><span style="color:#D0E7D2">Sort</span></h3> +<ul> +<li><code>가장 큰 수</code> 문제풀이 +<ul> +<li>자릿수가 다른 숫자들을 문자열처럼 나열하여 더 큰 숫자를 만들 때, 숫자들의 우선순위를 정하는 방법은?</li> +</ul> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span><span class="lnt">5 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">sortedNumbers</span> <span class="o">=</span> <span class="nb">sorted</span><span class="p">(</span><span class="nb">map</span><span class="p">(</span><span class="nb">str</span><span class="p">,</span> <span class="n">numbers</span><span class="p">),</span> <span class="n">key</span> <span class="o">=</span> <span class="k">lambda</span> <span class="n">x</span> <span class="p">:</span> <span class="p">(</span><span class="n">x</span> <span class="o">*</span> <span class="mi">4</span><span class="p">)[:</span><span class="mi">4</span><span class="p">],</span> <span class="n">reverse</span> <span class="o">=</span> <span class="kc">True</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"><span class="c1"># map(str, numbers) : numbers 정수 리스트를 문자열 리스트로 변환</span> +</span></span><span class="line"><span class="cl"><span class="c1"># sorted(..., reverse = True) : 주어진 조건으로 정렬하며, 내림차순으로 반환</span> +</span></span><span class="line"><span class="cl"><span class="c1"># lambda x : (x*4)[:4] : 네 자리 수까지 주어지므로 4번 반복 후 네번째자리까지 끊음</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +</ul> +<h2 id="span-stylecolorb0d9b1checkspan">👀 <strong><span style="color:#B0D9B1">CHECK</span></strong></h2> +<h6 id="어렵거나-새롭게-알게-된-것-등-다시-확인할-것들"><em>(어렵거나 새롭게 알게 된 것 등 다시 확인할 것들)</em></h6> +<ul> +<li> +<p>Hash</p> +<ul> +<li>가볍게 정리했지만 더 자세하게 찾아보고 싶음 (활용되는 곳, 특성을 구현하는 법, hashing function, collision 등)</li> +</ul> +</li> +<li> +<p>list comprehension</p> +<ul> +<li>한 줄에 반복문 할당 배열생성 등이 한번에 일어남</li> +<li><a class="link" href="https://shoark7.github.io/programming/python/about-list-comprehension-python" target="_blank" rel="noopener" + >list comprehension 설명 블로그 글</a></li> +<li>쓸 줄 아는 방식이지만 용어를 처음 알게 됨 (예전에 배우고 까먹은 게 분명)</li> +</ul> +</li> +<li> +<p>list slicing 에 바로 대입하여 직관적으로 코드 작성 가능</p> +<ul> +<li>EX) list[1:3] = [1, 2]</li> +</ul> +</li> +</ul> +<h2 id="span-stylecolorb0d9b1느낀-점span">❗ <strong><span style="color:#B0D9B1">느낀 점</span></strong></h2> +<p>어제 더 나은 코드를 위해 어떤점을 고려해야하는지 많은 고민을 했는데, 오늘 강의에서 그 부분을 짚어줘서 좋았다.</p> +<p>오늘은 각 알고리즘이나 자료구조에 대한 설명보다는 문제 풀이와 해설을 위주로 강의가 진행되었는데, 그래서 나 스스로 그 개념에 대해 찾아보고 정리하는 시간이 필요했다. greedy나 sort는 이미 잘 알고 있는 부분이지만 hash는 헷갈리는 부분이 있어서 블로그와 document를 읽어보면서 글로 정리하는 시간을 가졌다.</p> +<p>깊이가 정해져있지 않다 보니 원하는 만큼 궁금해하고 파헤칠 수 있었지만, 내가 그 내용을 받아들이고 정리할 수 있는가는 별개의 문제임을 깨달았다. hash를 설명하는 블로그 글에 연결된 링크를 타고 여러 글을 읽어가다 보니, 어느새 encoding&amp;decoding, scheduling에 대한 글을 읽고 있었다. 이런 글들을 읽고 어느정도 이해할 수는 있었지만, 글로 정리하거나 그 사이의 관계를 명확하게 아는것은 큰 차이가 있었고, 머리속이 혼란스러웠다. 어떤 주제와 관련된 내용을 잘 찾고 정리하는것도 많은 노력이 필요하다는 걸 새삼 느끼는 순간이었다.</p> +<p>오늘처럼 깊이가 없는 공부를 해야하는 순간은 계속 있을것이고(있어왔고), 정해진 주제에 대해 찾아본 내용들을 글로 정리하면서 나만의 기준을 정립해야겠다는 결론을 내렸다.</p> +<p>+) 퇴고하기 위해 글을 읽어보는데 두서없고 추상적이라 맘에 들지 않음..(ㅠㅠ) 문장력을 키우고 싶은데 온라인으로도 필사할 수 있는지 찾아봐야겠다.</p> + + + + Day 3 + https://srlee056.github.io/p/day-3/ + Wed, 18 Oct 2023 00:00:00 +0000 + + https://srlee056.github.io/p/day-3/ + <h1 id="span-stylecolor79ac78til---queue-tree--heapspan"><strong><span style="color:#79AC78">TIL - Queue, Tree &amp; Heap</span></strong></h1> +<h2 id="span-stylecolorb0d9b1공부-내용span">📋 <strong><span style="color:#B0D9B1">공부 내용</span></strong></h2> +<h3 id="span-stylecolord0e7d2queuesspan"><span style="color:#D0E7D2">Queues</span></h3> +<ul> +<li> +<p>Queue?</p> +<ul> +<li>FIFO (First In First Out)</li> +<li>operations +<ul> +<li>enqueue</li> +<li>dequeue +<ul> +<li>선형 배열으로 구현: <code>O(n)</code> -&gt; 연결 리스트로 구현하는것이 더 좋음</li> +</ul> +</li> +</ul> +</li> +</ul> +</li> +<li> +<p>Circular Queues</p> +<ul> +<li>배열의 한쪽 끝과 다른쪽 끝이 닿아 있는 모습</li> +<li>원소의 개수가 정해져있음</li> +<li><code>front / rear 포인터</code>를 기억하고, dequeue된 원소 저장소는 재활용</li> +<li>선형 배열으로 구현하는것이 더 좋음</li> +</ul> +</li> +<li> +<p>Priority Queues</p> +<ul> +<li>원소들 사이의 우선순위를 따름</li> +<li>우선순위 구현 +<ul> +<li>원소를 넣을 때 enqueue vs. 원소를 꺼낼 때 dequeue +<ul> +<li>넣을 때(enqueue) 우선순위에 따라 정렬하는것이 조금 더 나은 Time Complexity를 가짐</li> +<li>데이터를 관리하고 활용하는 데에도 더 편리함</li> +</ul> +</li> +</ul> +</li> +</ul> +</li> +</ul> +<h3 id="span-stylecolord0e7d2treesspan"><span style="color:#D0E7D2">Trees</span></h3> +<ul> +<li> +<p><strong>Tree?</strong></p> +<ul> +<li>구성 +<ul> +<li>root node</li> +<li>interner nodes</li> +<li>leaf nodes</li> +</ul> +</li> +<li>특성 +<ul> +<li>parent node / child node</li> +<li>노드의 수준 (level) : root node로부터 거리</li> +<li>노드의 차수 (degree) : 노드의 자식 수</li> +<li>트리의 높이(height) 또는 깊이(depth) : 제일 큰 level + 1</li> +<li>subtree</li> +</ul> +</li> +</ul> +</li> +<li> +<p><strong>Binary Trees</strong></p> +<ul> +<li>모든 node의 degree &lt;= 2</li> +<li>operations +<ul> +<li>size()</li> +<li>depth()</li> +<li>순회 traversal +<ul> +<li>Depth First Traversal : 재귀 호출을 통해 구현 +<ul> +<li>inorder</li> +<li>preorder</li> +<li>postorder</li> +</ul> +</li> +<li>Breadth Tirst Traversal : queue 사용! +<ul> +<li>level이 낮은 노드를 우선으로 방문</li> +<li>같은 level인 경우 부모 노드의 순서를 따름</li> +</ul> +</li> +</ul> +</li> +</ul> +</li> +<li>포화 이진 트리 (full binary trees) +<ul> +<li>모든 node의 degree == 2</li> +</ul> +</li> +<li>완전 이진 트리 (complete binary trees) +<ul> +<li>(depth k) <code>level k-2</code>까지는 full binary tree, <code>level k-1</code>은 왼쪽부터 node 채워짐</li> +</ul> +</li> +</ul> +</li> +<li> +<p><strong>Binary Search Trees</strong></p> +<ul> +<li>모든 노드에 대해 다음 성질을 만족하는 Binary Tree +<ul> +<li>왼쪽 subtree&rsquo;s data &lt; 현재 node&rsquo;s data &lt; 오른쪽 subtree&rsquo;s data</li> +</ul> +</li> +<li>장단점 +<ul> +<li>장점 : 원소의 추가, 삭제가 편함</li> +<li>단점 : 큰 공간을 소요함 (연결 리스트로 구현)</li> +</ul> +</li> +<li>operations +<ul> +<li>insert()</li> +<li>remove()</li> +<li>lookup()</li> +<li>inorder()</li> +<li>min(), max()</li> +</ul> +</li> +</ul> +</li> +</ul> +<h3 id="span-stylecolord0e7d2heapspan"><span style="color:#D0E7D2">Heap</span></h3> +<ul> +<li>Heaps? +<ul> +<li> +<p>Binary Tree의 한 종류 (binary heap)</p> +</li> +<li> +<p>Min / Max heap</p> +<ul> +<li>root node가 항상 최소/최대 값을 가진다</li> +<li>complete binary tree +<ul> +<li><code>n</code> nodes -&gt; depth <code>log(n)+1</code></li> +<li>insert / remove operation의 Time Complexity : <code>O(log(n))</code></li> +</ul> +</li> +<li>subtree 또한 Min / Max heap</li> +</ul> +</li> +<li> +<p>Binary Seacrh Tree vs. Heap?</p> +<table> +<thead> +<tr> +<th></th> +<th>BST</th> +<th>Heap</th> +</tr> +</thead> +<tbody> +<tr> +<td>데이터 정렬</td> +<td>크기순서대로 완전 정렬</td> +<td>완전 정렬 X</td> +</tr> +<tr> +<td>데이터 검색</td> +<td>O</td> +<td>X</td> +</tr> +<tr> +<td>완전 이진 트리</td> +<td>X</td> +<td>O</td> +</tr> +<tr> +<td>연산 시간</td> +<td>(최악의 경우) O(n)</td> +<td>O(log(n))</td> +</tr> +<tr> +<td>선형 배열로 구현</td> +<td>X</td> +<td>O</td> +</tr> +</tbody> +</table> +</li> +<li> +<p>operations</p> +<ul> +<li>insert()</li> +<li>remove()</li> +</ul> +</li> +</ul> +</li> +</ul> +<h2 id="span-stylecolorb0d9b1checkspan">👀 <strong><span style="color:#B0D9B1">CHECK</span></strong></h2> +<h6 id="어렵거나-새롭게-알게-된-것-등-다시-확인할-것들"><em>(어렵거나 새롭게 알게 된 것 등 다시 확인할 것들)</em></h6> +<ul> +<li><strong>노드의 차수(degree) : # of children</strong> +<ul> +<li>binary tree : 모든 노드의 degree가 항상 2이하</li> +<li>leaf nodes : degree 0</li> +</ul> +</li> +<li><strong>단축 평가</strong> +<ul> +<li><a class="link" href="https://pydole.tistory.com/entry/Python-%EB%8B%A8%EC%B6%95%ED%8F%89%EA%B0%80short-circuit-evalution" target="_blank" rel="noopener" + >단축평가에 대해 참고한 블로그</a></li> +<li>2개 이상의 논리 조건식이 있을 경우에, <strong>앞 조건이 계산한 값에 의해 결과가 확실해지면 두번째 조건은 확인하지 않음</strong></li> +<li>False and (), True or () 인 경우 등이 해당됨</li> +</ul> +</li> +</ul> +<h2 id="span-stylecolorb0d9b1느낀-점span">❗ <strong><span style="color:#B0D9B1">느낀 점</span></strong></h2> +<p>어제의 교훈이 있어서 그런지, 오늘은 프로그래밍 과정에 실수가 적었다. +그리고, 자료구조를 구현하는 과정에서 더 나은 방식에 대해 고민하는 상황이 많아졌다.</p> +<p>오늘 주로 고민한 부분은</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span><span class="lnt">5 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-fallback" data-lang="fallback"><span class="line"><span class="cl">코드를 더 직관적으로 적고싶음 +</span></span><span class="line"><span class="cl">- 반복되는 같은 코드를 합칠 수 있는가? +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl">같은 코드 다른 효율? +</span></span><span class="line"><span class="cl">- 같은 기능을 하지만 살짝 다른 두 코드 중 더 나은것은? +</span></span></code></pre></td></tr></table> +</div> +</div><p>정도였다.</p> +<p>전자는 내가 평소 프로그래밍 할 때 자주 하긴 하는데, 항상 고민하는 부분이다. +반복되는 기능을 함수로 빼던가, 적용되는 변수를 리스트로 묶어서 반복하는 등의 방법을 쓰는데, 다른 방법은 뭐가 있을까 고민하고 있다.</p> +<p>후자는 Complexity를 구하는 방법에 대한 의문이 아니다. 실제로 이 operation이 어떻게 구현되고 있는지, 왜 그렇게 구현되었는지가 궁금한 것이다. <br> +실습 문제에서 우선순위 queue를 구현할 때, skeleton code의 dequeue 함수는 마지막 elements를 가져오는 방식으로 되어있었다.(<code>getAt(data.size())</code>) <br> +나는 처음 element를 가져오는 방식으로 생각하고(<code>getAt(1)</code>) 이에 해당하는 enqueue 함수를 작성했기 때문에 잠깐 막혔다가, 결국은 눈치채고 해결했다.<br> +그 코드를 보면서 이렇게 구현하는게 더 나은건지 궁금증이 들었고, 같은 기능을 하지만 결함이 적은(?) 코드를 작성하자는 생각이 들었다.</p> +<p>오늘은 추가 알고리즘 문제들이 있고 아직 풀지 않았는데, 쉬운 문제들이지만 이 두가지를 생각하면서 풀려고 노력해야겠다.</p> + + + + Day 2 + https://srlee056.github.io/p/day-2/ + Tue, 17 Oct 2023 00:00:00 +0000 + + https://srlee056.github.io/p/day-2/ + <h1 id="span-stylecolor79ac78til---linkedlist--stackspan"><strong><span style="color:#79AC78">TIL - LinkedList &amp; Stack</span></strong></h1> +<h2 id="span-stylecolorb0d9b1공부-내용span">📋 <strong><span style="color:#B0D9B1">공부 내용</span></strong></h2> +<h3 id="span-stylecolord0e7d2연결-리스트-linked-listspan"><span style="color:#D0E7D2">연결 리스트 Linked List</span></h3> +<ul> +<li> +<p><strong>추상적 자료구조 Abstract Data Structures</strong></p> +<ul> +<li>내부 구현에는 신경쓸 필요 없는 구조</li> +<li>data &amp; a set of operations</li> +<li>이 두 가지를 <strong>추상적으로 보여줌</strong></li> +</ul> +</li> +<li> +<p><strong>Linke List?</strong></p> +<ul> +<li>Node가 선형적으로 연결된 구조</li> +</ul> +</li> +<li> +<p><strong>Node &amp; LinkedList 구현</strong></p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"> <span class="k">class</span> <span class="nc">Node</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">item</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="o">=</span> <span class="n">item</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">next</span> <span class="o">=</span> <span class="kc">None</span> <span class="c1"># 다음 노드를 가리킴</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">class</span> <span class="nc">LinkedList</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span> <span class="o">=</span> <span class="mi">0</span> <span class="c1"># 노드의 총 갯수</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">head</span> <span class="o">=</span> <span class="kc">None</span> <span class="c1"># 첫번째 노드</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">tail</span> <span class="o">=</span> <span class="kc">None</span> <span class="c1"># 마지막 노드</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li> +<p><strong>Linked List 연산 (operations)</strong></p> +<p>linked list의 index는 1부터 시작 / 0은 다른 용도로 사용(Dummy node)</p> +<h6 id="실습으로-구현한-코드만-첨부했음">(실습으로 구현한 코드만 첨부했음)</h6> +<ul> +<li> +<p>kth element 참조</p> +</li> +<li> +<p>리스트 순회</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span><span class="lnt">5 +</span><span class="lnt">6 +</span><span class="lnt">7 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"> <span class="k">def</span> <span class="nf">traverse</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">curr</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">head</span> +</span></span><span class="line"><span class="cl"> <span class="n">returnList</span> <span class="o">=</span> <span class="p">[]</span> +</span></span><span class="line"><span class="cl"> <span class="k">while</span> <span class="n">curr</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">returnList</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">curr</span><span class="o">.</span><span class="n">data</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="n">curr</span> <span class="o">=</span> <span class="n">curr</span><span class="o">.</span><span class="n">next</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">returnList</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li> +<p>길이 얻기</p> +</li> +<li> +<p>원소 삽입</p> +<ul> +<li>Time complexity +<ul> +<li>맨 앞에 삽입 : O(1)</li> +<li>중간에 삽입 : O(n)</li> +<li>맨 끝에 삽입 : (Tail pointer가 있기 때문에) O(1)</li> +</ul> +</li> +</ul> +</li> +<li> +<p>원소 삭제</p> +<ul> +<li>Time complexity +<ul> +<li>맨 앞에 삽입 : O(1)</li> +<li>중간에 삽입 : O(n)</li> +<li>맨 끝에 삽입 : O(n) +→ 이 상황을 피하기 위해 이중 연결 리스트를 사용</li> +</ul> +</li> +</ul> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span><span class="lnt">14 +</span><span class="lnt">15 +</span><span class="lnt">16 +</span><span class="lnt">17 +</span><span class="lnt">18 +</span><span class="lnt">19 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"> <span class="c1"># 삭제한 node 데이터를 반환</span> +</span></span><span class="line"><span class="cl"> <span class="k">def</span> <span class="nf">popAt</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">pos</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">pos</span> <span class="o">&lt;</span> <span class="mi">1</span> <span class="ow">or</span> <span class="n">pos</span> <span class="o">&gt;</span> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="k">raise</span> <span class="ne">IndexError</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">pos</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span> <span class="o">=</span> <span class="kc">None</span> +</span></span><span class="line"><span class="cl"> <span class="n">curr</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">head</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">head</span> <span class="o">=</span> <span class="n">curr</span><span class="o">.</span><span class="n">next</span> +</span></span><span class="line"><span class="cl"> <span class="k">else</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">getAt</span><span class="p">(</span><span class="n">pos</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="n">curr</span> <span class="o">=</span> <span class="n">prev</span><span class="o">.</span><span class="n">next</span> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span><span class="o">.</span><span class="n">next</span> <span class="o">=</span> <span class="n">curr</span><span class="o">.</span><span class="n">next</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">pos</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">tail</span> <span class="o">=</span> <span class="n">prev</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span> <span class="o">-=</span> <span class="mi">1</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">curr</span><span class="o">.</span><span class="n">data</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li> +<p>두 리스트 합치기 concat</p> +</li> +</ul> +</li> +<li> +<p><strong>배열 Array vs 연결 리스트 Linked List</strong></p> +<table> +<thead> +<tr> +<th></th> +<th>배열</th> +<th>연결 리스트</th> +</tr> +</thead> +<tbody> +<tr> +<td>저장 공간</td> +<td>연속된 위치</td> +<td>임의의 위치</td> +</tr> +<tr> +<td>특정 원소 참조</td> +<td>매우 간편</td> +<td>선형탐색과 유사</td> +</tr> +<tr> +<td></td> +<td>O(1)</td> +<td>O(n)</td> +</tr> +</tbody> +</table> +<p><em>time complexity에 불리함이 있는데도 사용하는 이유는?</em></p> +</li> +<li> +<p><strong>연결 리스트 Linked List의 힘</strong></p> +<ul> +<li>유연한 삽입 및 삭제</li> +<li>Head, Tail에 dummy node를 추가하여 간편하고 직관적인 설계 가능</li> +<li>추가 구현 operations +<ul> +<li> +<p>insertAfter(prev, node)</p> +</li> +<li> +<p>popAfter(prev) &amp; popAt(pos)</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span><span class="lnt">14 +</span><span class="lnt">15 +</span><span class="lnt">16 +</span><span class="lnt">17 +</span><span class="lnt">18 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">popAfter</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">prev</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">curr</span> <span class="o">=</span> <span class="n">prev</span><span class="o">.</span><span class="n">next</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">curr</span> <span class="ow">is</span> <span class="kc">None</span> <span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="kc">None</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">curr</span><span class="o">.</span><span class="n">next</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">tail</span> <span class="o">=</span> <span class="n">prev</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span><span class="o">.</span><span class="n">next</span> <span class="o">=</span> <span class="n">curr</span><span class="o">.</span><span class="n">next</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span> <span class="o">-=</span> <span class="mi">1</span> <span class="c1"># nodeCount 꼭 체크하기</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">curr</span><span class="o">.</span><span class="n">data</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">popAt</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">pos</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">pos</span> <span class="o">&lt;</span> <span class="mi">1</span> <span class="ow">or</span> <span class="n">pos</span> <span class="o">&gt;</span> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="k">raise</span> <span class="ne">IndexError</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">getAt</span><span class="p">(</span><span class="n">pos</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">popAfter</span><span class="p">(</span><span class="n">prev</span><span class="p">)</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +</ul> +</li> +</ul> +</li> +</ul> +<hr> +<h3 id="span-stylecolord0e7d2양방향--이중-연결-리스트-double-linked-listspan"><span style="color:#D0E7D2">양방향 / 이중 연결 리스트 Double Linked List</span></h3> +<ul> +<li><strong>양쪽</strong>으로 연결된 link +- next node, previous node로 두 방향 모두 진행 가능 +- 메모리 사용량이 늘어나지만, 앞에서뿐만 아니라 뒤에서도 데이터를 찾아갈 수 있다는게 장점 +<ul> +<li>getAt() 함수 또한 pos가 중간값 이상일 때는 뒤에서부터 찾도록 구현할 수 있음</li> +</ul> +</li> +<li><strong>operations</strong> +<ul> +<li> +<p>reverse</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span><span class="lnt">5 +</span><span class="lnt">6 +</span><span class="lnt">7 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">reverse</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">result</span> <span class="o">=</span> <span class="p">[]</span> +</span></span><span class="line"><span class="cl"> <span class="n">curr</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">tail</span> +</span></span><span class="line"><span class="cl"> <span class="k">while</span> <span class="n">curr</span><span class="o">.</span><span class="n">prev</span><span class="o">.</span><span class="n">prev</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">curr</span> <span class="o">=</span> <span class="n">curr</span><span class="o">.</span><span class="n">prev</span> +</span></span><span class="line"><span class="cl"> <span class="n">result</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">curr</span><span class="o">.</span><span class="n">data</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">result</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li> +<p>insertBefore</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span><span class="lnt">5 +</span><span class="lnt">6 +</span><span class="lnt">7 +</span><span class="lnt">8 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">insertBefore</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">next</span><span class="p">,</span> <span class="n">newNode</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span> <span class="o">=</span> <span class="nb">next</span><span class="o">.</span><span class="n">prev</span> +</span></span><span class="line"><span class="cl"> <span class="n">newNode</span><span class="o">.</span><span class="n">next</span> <span class="o">=</span> <span class="nb">next</span> +</span></span><span class="line"><span class="cl"> <span class="n">newNode</span><span class="o">.</span><span class="n">prev</span> <span class="o">=</span> <span class="n">prev</span> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span><span class="o">.</span><span class="n">next</span> <span class="o">=</span> <span class="n">newNode</span> +</span></span><span class="line"><span class="cl"> <span class="nb">next</span><span class="o">.</span><span class="n">prev</span> <span class="o">=</span> <span class="n">newNode</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span> <span class="o">+=</span> <span class="mi">1</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="kc">True</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li> +<p>popAfter, popBefore, popAt</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span><span class="lnt">14 +</span><span class="lnt">15 +</span><span class="lnt">16 +</span><span class="lnt">17 +</span><span class="lnt">18 +</span><span class="lnt">19 +</span><span class="lnt">20 +</span><span class="lnt">21 +</span><span class="lnt">22 +</span><span class="lnt">23 +</span><span class="lnt">24 +</span><span class="lnt">25 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">popAfter</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">prev</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">curr</span> <span class="o">=</span> <span class="n">prev</span><span class="o">.</span><span class="n">next</span> +</span></span><span class="line"><span class="cl"> <span class="nb">next</span> <span class="o">=</span> <span class="n">curr</span><span class="o">.</span><span class="n">next</span> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span><span class="o">.</span><span class="n">next</span> <span class="o">=</span> <span class="nb">next</span> +</span></span><span class="line"><span class="cl"> <span class="nb">next</span><span class="o">.</span><span class="n">prev</span> <span class="o">=</span> <span class="n">prev</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span> <span class="o">-=</span> <span class="mi">1</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">curr</span><span class="o">.</span><span class="n">data</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">popBefore</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">next</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">curr</span> <span class="o">=</span> <span class="nb">next</span><span class="o">.</span><span class="n">prev</span> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span> <span class="o">=</span> <span class="n">curr</span><span class="o">.</span><span class="n">prev</span> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span><span class="o">.</span><span class="n">next</span> <span class="o">=</span> <span class="nb">next</span> +</span></span><span class="line"><span class="cl"> <span class="nb">next</span><span class="o">.</span><span class="n">prev</span> <span class="o">=</span> <span class="n">prev</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span> <span class="o">-=</span> <span class="mi">1</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">curr</span><span class="o">.</span><span class="n">data</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">popAt</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">pos</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">pos</span> <span class="o">&lt;</span> <span class="mi">1</span> <span class="ow">or</span> <span class="n">pos</span> <span class="o">&gt;</span> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="k">raise</span> <span class="ne">IndexError</span> +</span></span><span class="line"><span class="cl"> <span class="n">prev</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">getAt</span><span class="p">(</span><span class="n">pos</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">popAfter</span><span class="p">(</span><span class="n">prev</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="c1"># next = self.getAt(pos+1) # getAt 함수가 pos == nodeCount+1 일 때 지원을 하지 않아서 사용은 어려움</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># next = self.getAt(pos).next #로 사용 가능</span> +</span></span><span class="line"><span class="cl"> <span class="c1"># return self.popBefore(next)</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li> +<p>concat(self, L)</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span><span class="lnt">5 +</span><span class="lnt">6 +</span><span class="lnt">7 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">concat</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">L</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">lastNode</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">tail</span><span class="o">.</span><span class="n">prev</span> +</span></span><span class="line"><span class="cl"> <span class="n">firstNode</span> <span class="o">=</span> <span class="n">L</span><span class="o">.</span><span class="n">head</span><span class="o">.</span><span class="n">next</span> +</span></span><span class="line"><span class="cl"> <span class="n">lastNode</span><span class="o">.</span><span class="n">next</span> <span class="o">=</span> <span class="n">firstNode</span> +</span></span><span class="line"><span class="cl"> <span class="n">firstNode</span><span class="o">.</span><span class="n">prev</span> <span class="o">=</span> <span class="n">lastNode</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">tail</span> <span class="o">=</span> <span class="n">L</span><span class="o">.</span><span class="n">tail</span> +</span></span><span class="line"><span class="cl"> <span class="bp">self</span><span class="o">.</span><span class="n">nodeCount</span> <span class="o">+=</span> <span class="n">L</span><span class="o">.</span><span class="n">nodeCount</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +</ul> +</li> +</ul> +<hr> +<h3 id="span-stylecolord0e7d2스택-stackspan"><span style="color:#D0E7D2">스택 Stack</span></h3> +<ul> +<li><strong>data element를 보관할 수 있는 선형 구조 / LIFO</strong></li> +<li><strong>operations</strong> +<ul> +<li>size()</li> +<li>isEmpty()</li> +<li>push(x) +<ul> +<li>꽉 찬 스택에 push(x)로 원소를 더 추가하려고 할 때 <code>stack overflow</code> 발생</li> +</ul> +</li> +<li>pop() +<ul> +<li>비어있는 스택에서 pop()으로 없는 원소를 꺼내려 할 때 <code>stack underflow</code> 발생</li> +</ul> +</li> +<li>peek() +<ul> +<li>데이터 참조, 제거하지는 않음</li> +</ul> +</li> +</ul> +</li> +<li><strong>추상적 자료구조로 구현</strong> +<ul> +<li>Array 또는 LinkedList 이용</li> +<li>만들어져있는 Stack library 를 import 할 수도 있음 +<code>from pythonds.basic.stack import Stack</code></li> +</ul> +</li> +</ul> +<hr> +<ul> +<li> +<p><strong>스택의 응용 1) 후위 표기법으로 변환</strong></p> +<ul> +<li>중위 표기법 (infix notation) : (A+B) * (C+D) +→ 후위 표기법 (postfix notation) : AB+CD+*</li> +<li>알고리즘 설계 +<ul> +<li> +<p>operator 연산자를 스택에 넣는 방식</p> +</li> +<li> +<p>연산자 우선순위 설정</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">prec</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;*&#39;</span><span class="p">:</span><span class="mi">3</span><span class="p">,</span> <span class="s1">&#39;/&#39;</span><span class="p">:</span><span class="mi">3</span><span class="p">,</span> <span class="s1">&#39;+&#39;</span><span class="p">:</span><span class="mi">2</span><span class="p">,</span> <span class="s1">&#39;-&#39;</span><span class="p">:</span><span class="mi">2</span><span class="p">,</span> <span class="s1">&#39;(&#39;</span><span class="p">:</span><span class="mi">1</span><span class="p">}</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li> +<p>구현 코드</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span><span class="lnt">14 +</span><span class="lnt">15 +</span><span class="lnt">16 +</span><span class="lnt">17 +</span><span class="lnt">18 +</span><span class="lnt">19 +</span><span class="lnt">20 +</span><span class="lnt">21 +</span><span class="lnt">22 +</span><span class="lnt">23 +</span><span class="lnt">24 +</span><span class="lnt">25 +</span><span class="lnt">26 +</span><span class="lnt">27 +</span><span class="lnt">28 +</span><span class="lnt">29 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">solution</span><span class="p">(</span><span class="n">S</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">opStack</span> <span class="o">=</span> <span class="n">ArrayStack</span><span class="p">()</span> +</span></span><span class="line"><span class="cl"> <span class="n">charList</span> <span class="o">=</span> <span class="p">[]</span> <span class="c1"># 수식을 리스트 형태로 저장한 후 .join을 통해 문자열로 변환</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">s</span> <span class="ow">in</span> <span class="n">S</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">s</span> <span class="ow">in</span> <span class="n">prec</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span> <span class="c1"># 연산자 + 여는 괄호</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">s</span> <span class="o">==</span> <span class="s2">&#34;(&#34;</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">opStack</span><span class="o">.</span><span class="n">push</span><span class="p">(</span><span class="n">s</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="k">else</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="k">while</span> <span class="ow">not</span> <span class="n">opStack</span><span class="o">.</span><span class="n">isEmpty</span><span class="p">():</span> <span class="c1"># 스택이 비어있는 동안 계속</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">prec</span><span class="p">[</span><span class="n">opStack</span><span class="o">.</span><span class="n">peek</span><span class="p">()]</span> <span class="o">&gt;=</span> <span class="n">prec</span><span class="p">[</span><span class="n">s</span><span class="p">]:</span> <span class="c1"># 스택 맨 위의 우선순위가 높거나 같은 경우에만</span> +</span></span><span class="line"><span class="cl"> <span class="n">charList</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">opStack</span><span class="o">.</span><span class="n">pop</span><span class="p">())</span> <span class="c1"># pop()하여 문자열에 출력</span> +</span></span><span class="line"><span class="cl"> <span class="k">else</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="k">break</span> +</span></span><span class="line"><span class="cl"> <span class="n">opStack</span><span class="o">.</span><span class="n">push</span><span class="p">(</span><span class="n">s</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">elif</span> <span class="n">s</span> <span class="o">==</span> <span class="s2">&#34;)&#34;</span><span class="p">:</span> <span class="c1"># 닫는 괄호</span> +</span></span><span class="line"><span class="cl"> <span class="k">while</span> <span class="n">opStack</span><span class="o">.</span><span class="n">peek</span><span class="p">()</span> <span class="o">!=</span> <span class="s2">&#34;(&#34;</span><span class="p">:</span> <span class="c1"># 여는 괄호가 나올때까지 모든 연산자를 꺼내 출력</span> +</span></span><span class="line"><span class="cl"> <span class="n">charList</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">opStack</span><span class="o">.</span><span class="n">pop</span><span class="p">())</span> +</span></span><span class="line"><span class="cl"> <span class="n">opStack</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> <span class="c1"># pop &#39;(&#39;</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">else</span><span class="p">:</span> <span class="c1"># 피연산자</span> +</span></span><span class="line"><span class="cl"> <span class="n">charList</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">s</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">while</span> <span class="ow">not</span> <span class="n">opStack</span><span class="o">.</span><span class="n">isEmpty</span><span class="p">():</span> <span class="c1"># 스택에 남아있는 연산자들을 모두 출력</span> +</span></span><span class="line"><span class="cl"> <span class="n">charList</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">opStack</span><span class="o">.</span><span class="n">pop</span><span class="p">())</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="n">answer</span> <span class="o">=</span> <span class="s2">&#34;&#34;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">charList</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">answer</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +</ul> +</li> +</ul> +</li> +<li> +<p><strong>스택의 응용 2) 후위 표기법 계산</strong></p> +<ul> +<li>앞에서부터 뒤로 읽어나가면서 먼저 만나는 연산자를 먼저 계산</li> +<li>알고리즘 설계 +<ul> +<li> +<p>operands 피연산자들을 스택에 넣는 방식</p> +</li> +<li> +<p>구현 코드</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt"> 1 +</span><span class="lnt"> 2 +</span><span class="lnt"> 3 +</span><span class="lnt"> 4 +</span><span class="lnt"> 5 +</span><span class="lnt"> 6 +</span><span class="lnt"> 7 +</span><span class="lnt"> 8 +</span><span class="lnt"> 9 +</span><span class="lnt">10 +</span><span class="lnt">11 +</span><span class="lnt">12 +</span><span class="lnt">13 +</span><span class="lnt">14 +</span><span class="lnt">15 +</span><span class="lnt">16 +</span><span class="lnt">17 +</span><span class="lnt">18 +</span><span class="lnt">19 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">postfixEval</span><span class="p">(</span><span class="n">tokenList</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="n">valStack</span> <span class="o">=</span> <span class="n">ArrayStack</span><span class="p">()</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="n">t</span> <span class="ow">in</span> <span class="n">tokenList</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="nb">type</span><span class="p">(</span><span class="n">t</span><span class="p">)</span> <span class="ow">is</span> <span class="nb">int</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">valStack</span><span class="o">.</span><span class="n">push</span><span class="p">(</span><span class="n">t</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="k">else</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">b</span> <span class="o">=</span> <span class="n">valStack</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> +</span></span><span class="line"><span class="cl"> <span class="n">a</span> <span class="o">=</span> <span class="n">valStack</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">t</span> <span class="o">==</span> <span class="s1">&#39;*&#39;</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">valStack</span><span class="o">.</span><span class="n">push</span><span class="p">(</span><span class="n">a</span><span class="o">*</span><span class="n">b</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="k">elif</span> <span class="n">t</span> <span class="o">==</span> <span class="s1">&#39;/&#39;</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">valStack</span><span class="o">.</span><span class="n">push</span><span class="p">(</span><span class="n">a</span><span class="o">/</span><span class="n">b</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="k">elif</span> <span class="n">t</span> <span class="o">==</span> <span class="s1">&#39;+&#39;</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">valStack</span><span class="o">.</span><span class="n">push</span><span class="p">(</span><span class="n">a</span><span class="o">+</span><span class="n">b</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> <span class="k">elif</span> <span class="n">t</span> <span class="o">==</span> <span class="s1">&#39;-&#39;</span><span class="p">:</span> +</span></span><span class="line"><span class="cl"> <span class="n">valStack</span><span class="o">.</span><span class="n">push</span><span class="p">(</span><span class="n">a</span><span class="o">-</span><span class="n">b</span><span class="p">)</span> +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">valStack</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +</ul> +</li> +</ul> +</li> +</ul> +<h2 id="span-stylecolorb0d9b1checkspan">👀 <strong><span style="color:#B0D9B1">CHECK</span></strong></h2> +<h6 id="어렵거나-새롭게-알게-된-것-등-다시-확인할-것들"><em>(어렵거나 새롭게 알게 된 것 등 다시 확인할 것들)</em></h6> +<ul> +<li> +<p>member field, member method</p> +<ul> +<li>용어의 뜻은 알지만 애매해서 다시 정리하기 위해 찾아봄 <br> +<a class="link" href="https://as-i-am-programing.tistory.com/7" target="_blank" rel="noopener" + >정리에 참고한 사이트</a></li> +</ul> +</li> +<li> +<p>추상적 자료구조</p> +<ul> +<li>abstract data type vs. data structure +<ul> +<li>an ADT (Abstract Data Type) is more of a logical description, while a Data Structure is concrete.</li> +</ul> +</li> +<li><a class="link" href="https://velog.io/@hwan2da/%EC%9E%90%EB%A3%8C%EA%B5%AC%EC%A1%B0-%EC%B6%94%EC%83%81%EC%9E%90%EB%A3%8C%ED%98%95" target="_blank" rel="noopener" + >정리에 참고한 사이트 : 추상적 자료형 vs. 자료구조</a></li> +</ul> +</li> +<li> +<p>dummy node를 추가한 구조의 linked list</p> +</li> +<li> +<p>stack underflow</p> +</li> +</ul> +<h2 id="span-stylecolorb0d9b1느낀-점span">‼️ <strong><span style="color:#B0D9B1">느낀 점</span></strong></h2> +<p>오늘은 두 가지 교훈(?) 을 얻었다.</p> +<ol> +<li> +<p>한번에 두가지 일을 하지 않기 +강의를 들으면서 TIL을 적으려고 했는데, 외려 더 정신없고 힘들었다. 강의 듣는 중간에 적다 보니, 그냥 받아쓰기가 되는것도 별로였다. 큰 주제 (오늘 같은 경우 LinkedList / Stack)를 다 듣고 정리하는게 나을 듯!</p> +</li> +<li> +<p>사소한 실수 하지 않고 꼼꼼하게 체크하기 +오늘 연습문제를 풀면서</p> +<blockquote> +</blockquote> +<p>node.data 대신 node 객체를 반환함 +linked list의 nodeCount 증감시키는걸 빼먹음</p> +<p>명시된 조건을 빼먹는 실수를 저질러서 디버깅 한다고 다 합해서 한시간 가까이 소모했다. +몰라서 못 푸는것 보다 이런 부분에서 꼼꼼하지 못해서 못 푸는게 더 싫다. 심지어 원래는 그렇게 자주 하는 실수도 아니어서 자존심이 더 상했다. ㅠㅠ <br> +그래도 이런 날이 있어야 앞으로 안 그럴 수 있으니까 계속 담아두지는 말아야지!</p> +</li> +</ol> +<p>내일은 강의와 실습을 꼼꼼하게 진행하고, 내가 이해한 내용을 토대로 TIL을 잘 적어봐야겠다. :&gt;. +그리고 내일은 github 블로그에 올려봐야지! 🔥 어렵지만 할 만한 가치가 있어보인다 😊</p> + + + + Day 1 + https://srlee056.github.io/p/day-1/ + Mon, 16 Oct 2023 00:00:00 +0000 + + https://srlee056.github.io/p/day-1/ + <h1 id="span-stylecolor79ac781-자료구조--알고리즘-강의-및-코드-리뷰span"><strong><span style="color:#79AC78">1. 자료구조 &amp; 알고리즘 강의 및 코드 리뷰</span></strong></h1> +<h2 id="span-stylecolorb0d9b1공부-내용span">📋 <strong><span style="color:#B0D9B1">공부 내용</span></strong></h2> +<h3 id="span-stylecolord0e7d2선형-배열---linear-arraysspan"><span style="color:#D0E7D2">선형 배열 - Linear Arrays</span></h3> +<ul> +<li> +<p>배열(array) : 개념적 구조 / 리스트 : python 데이터형</p> +</li> +<li> +<p>리스트 methods</p> +<ul> +<li>time complexity O(1) +<ul> +<li><code>.append()</code></li> +<li><code>.pop()</code></li> +</ul> +</li> +<li>time complexity O(n) +<ul> +<li><code>.insert()</code></li> +<li><code>.del()</code></li> +<li><code>.index()</code></li> +<li><code>.insert()</code></li> +</ul> +</li> +</ul> +</li> +<li> +<p>정렬(sort)</p> +<ul> +<li><code>sorted()</code> : function, 정렬된 새로운 리스트를 반환하며 기존 리스트에는 변화 없음.</li> +<li><code>.sort()</code> : method, 기존 리스트가 정렬됨</li> +<li>숫자가 아닌 문자열 등 데이터형의 정렬 : 사전순이 기본, 문자열의 길이 등 다른 정렬 조건을 사용하고 싶다면 <code>lambda</code> 활용 +<ul> +<li> +<p>문자열을 길이순으로 정렬</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="nb">sorted</span><span class="p">(</span><span class="n">L</span><span class="p">,</span> <span class="n">key</span> <span class="o">=</span> <span class="k">lambda</span> <span class="n">x</span> <span class="p">:</span> <span class="nb">len</span><span class="p">(</span><span class="n">x</span><span class="p">))</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li> +<p>사전 데이터형(dictionary)에 key = ‘name’인 value의 문자열 순서대로 정렬</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">L</span> <span class="o">=</span> <span class="p">[</span> <span class="p">{</span><span class="s1">&#39;name&#39;</span> <span class="p">:</span> <span class="s1">&#39;John&#39;</span><span class="p">,</span> <span class="s1">&#39;score&#39;</span><span class="p">:</span> <span class="mi">90</span><span class="p">},</span> +</span></span><span class="line"><span class="cl"> <span class="p">{</span><span class="s1">&#39;name&#39;</span> <span class="p">:</span> <span class="s1">&#39;Paul&#39;</span><span class="p">,</span> <span class="s1">&#39;score&#39;</span><span class="p">:</span> <span class="mi">80</span><span class="p">}</span> <span class="p">]</span> +</span></span><span class="line"><span class="cl"><span class="nb">sorted</span><span class="p">(</span><span class="n">L</span><span class="p">,</span> <span class="n">key</span> <span class="o">=</span> <span class="k">lambda</span> <span class="n">x</span> <span class="p">:</span> <span class="n">x</span><span class="p">[</span><span class="s1">&#39;name&#39;</span><span class="p">]</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +</ul> +</li> +</ul> +</li> +<li> +<p>탐색(search)</p> +<ul> +<li>선형(linear) 탐색, 순차(sequential) 탐색</li> +<li>이진(binary) 탐색</li> +</ul> +</li> +</ul> +<h3 id="span-stylecolord0e7d2재귀-알고리즘---recursive-algorithmsspan"><span style="color:#D0E7D2">재귀 알고리즘 - recursive algorithms</span></h3> +<ul> +<li><strong>종결 조건(trivial case)</strong> 을 명시해야 함</li> +<li>예시 +<ul> +<li> +<p>1부터 x까지 숫자의 합을 구하는 함수 (sum)</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">recursiveSum</span><span class="p">(</span><span class="n">x</span><span class="p">):</span> +</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">x</span> <span class="o">&lt;</span> <span class="mi">1</span> <span class="p">:</span> <span class="k">return</span> <span class="n">x</span> +</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">recursiveSum</span><span class="p">(</span><span class="n">x</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="o">+</span> <span class="n">x</span> +</span></span></code></pre></td></tr></table> +</div> +</div></li> +<li> +<p>조합의 수 (nCm)</p> +</li> +<li> +<p>하노이의 탑</p> +</li> +<li> +<p>피보나치 순열</p> +</li> +</ul> +</li> +<li>장점 : 알고리즘을 간단하고 이해하기 쉽게 풀어냄</li> +<li>단점 : time complexity 부분에서 비효율적인 경우가 많음</li> +<li>이러한 특성 때문에 tree 자료구조를 이용하는 알고리즘에 활용</li> +</ul> +<h3 id="span-stylecolord0e7d2complexityspan"><span style="color:#D0E7D2">Complexity</span></h3> +<ul> +<li>Time Complexity</li> +<li>Space Complexity</li> +<li>다루는 데이터가 커질수록, 더 효율적인 complexity를 가지는 방식이 필요함 (2^n, n! 등의 complexity <strong>X</strong>)</li> +</ul> +<h2 id="span-stylecolorb0d9b1checkspan">👀 <strong><span style="color:#B0D9B1">CHECK</span></strong></h2> +<h6 id="어렵거나-새롭게-알게-된-것-등-다시-확인할-것들"><em>(어렵거나 새롭게 알게 된 것 등 다시 확인할 것들)</em></h6> +<ul> +<li>코드로 elapsed time을 확인 -&gt; 디버깅이나 time complexity를 직관적으로 확인하는 등에 활용</li> +<li>list method <code>.pop()</code> 과 <code>.remove()</code>의 차이점</li> +<li>big O notation - O of n 으로 읽음</li> +<li>list의 앞과 뒤에 접근하는것은 O(1)의 time complextity를 갖는다.</li> +</ul> +<h2 id="span-stylecolorb0d9b1느낀-점span">‼️ <strong><span style="color:#B0D9B1">느낀 점</span></strong></h2> +<p>아직까지는 전공 과정 복습하는 느낌이고, 쉽다고 느꼈다. 막히는 부분은 없었다. 코드를 작성하면서 조금 더 나은 코드에 대해 생각해보는것 정도. <br> +공부하는 중이나 이후에 바로 TIL을 적는게 제일 좋다고 생각하는데, 블로그 세팅에 정신이 팔려서 나중에 작성하게 된 건 조금 아쉽다. <br> +오늘은 코어타임보다 일찍 강의를 들어버려서 시간 분배가 애매했다. 내일은 코어타임 시작할 때 듣기 시작하고, 그 전에는 전날 내용을 복습하거나, 알고리즘 문제를 풀고 code review를 작성하는 시간을 가져야겠다.</p> +<h1 id="span-stylecolor79ac782-블로그-세팅-과정span"><strong><span style="color:#79AC78">2. 블로그 세팅 과정</span></strong></h1> +<p><img src="https://blog.kakaocdn.net/dn/cKgXTh/btsyuerJaNh/HhtKTmduAbBOsbBmTD8g00/img.png" + + + + loading="lazy" + + alt="https://blog.kakaocdn.net/dn/cKgXTh/btsyuerJaNh/HhtKTmduAbBOsbBmTD8g00/img.png" + + +></p> +<p>노션이나 옵시디언으로 TIL을 적고 깃에 업로드 한 적은 많지만 블로그에 올리는건 처음이라, 어디에 올리지 고민하다가 일단 티스토리 계정과 블로그를 만들었다.<br> +그런데 만들다 보니 <strong>github repo와 연동되는 page를 세팅하고 싶다..!</strong> 라는 욕심이 들기 시작했고, <br> +jekyll 등을 알아보다가 hugo를 활용한 페이지 세팅을 접하게 되어 장장 3시간을 투자했다.</p> +<p>그런데 이 글을 티스토리에 올리는 이유는? 세팅에 실패했기 때문 ㅠㅠ<br> +TIL 작성하고 나서 다시 도전해서 세팅 과정에 대해서도 글을 써 볼 예정이다.</p> +<p>+) 티스토리에서 md로 작성한게 예쁘게 안나와서 벨로그로 옮겼다 😂 훨씬 편한 것 같은데 깃허브랑 연동 전까진 벨로그로 해야겠다 :&gt;</p> +<h2 id="span-stylecolorb0d9b1지금까지-참고한-링크들span"><span style="color:#B0D9B1">(지금까지 참고한 링크들)</span></h2> +<ul> +<li><a class="link" href="https://gohugo.io/getting-started/quick-start/" target="_blank" rel="noopener" + >휴고 사이트 생성 가이드</a></li> +<li><a class="link" href="https://gohugo.io/hosting-and-deployment/hosting-on-github/" target="_blank" rel="noopener" + >휴고 사이트 깃허브 연결 가이드</a></li> +<li><a class="link" href="https://themes.gohugo.io/themes/salinger-theme/#quick-start-" target="_blank" rel="noopener" + >사용 테마1</a></li> +<li><a class="link" href="https://github.com/CaiJimmy/hugo-theme-stack-starter" target="_blank" rel="noopener" + >사용 테마2</a></li> +</ul> + + + + + diff --git a/public/tags/til/page/1/index.html b/public/tags/til/page/1/index.html new file mode 100644 index 0000000..afe8933 --- /dev/null +++ b/public/tags/til/page/1/index.html @@ -0,0 +1,10 @@ + + + + https://srlee056.github.io/tags/til/ + + + + + + diff --git a/public/tags/css/index.html b/public/tags/til/page/2/index.html similarity index 77% rename from public/tags/css/index.html rename to public/tags/til/page/2/index.html index 2f371be..065034b 100644 --- a/public/tags/css/index.html +++ b/public/tags/til/page/2/index.html @@ -1,18 +1,20 @@ - + - -Tag: css - Seorim Log - - - - - - - - - - + +Tag: TIL - 서림록 + + + + + + + + + + + +
@@ -270,10 +268,10 @@

좋은 개발자로 한걸음 더

- - + + - + +

+ + +
+ + + + + + + + + + + + 🤩 + +
+ + + +
+

서림록

+

좋은 개발자로 한걸음 더

+
+
+ + +
+ + +
+
+

+ + Tags + +

+ +
+
+

1 페이지

+

Tree

+ +
+
+
+ +
+ + + +
+
+ + +
+ Hugo로 만듦
+ JimmyStack 테마 사용 중 +
+
+ + +
+ + + + + + diff --git a/public/tags/tree/index.xml b/public/tags/tree/index.xml new file mode 100644 index 0000000..fa4fd60 --- /dev/null +++ b/public/tags/tree/index.xml @@ -0,0 +1,269 @@ + + + + Tree on 서림록 + https://srlee056.github.io/tags/tree/ + Recent content in Tree on 서림록 + Hugo -- gohugo.io + ko + Seorim Lee + Wed, 18 Oct 2023 00:00:00 +0000 + Day 3 + https://srlee056.github.io/p/day-3/ + Wed, 18 Oct 2023 00:00:00 +0000 + + https://srlee056.github.io/p/day-3/ + <h1 id="span-stylecolor79ac78til---queue-tree--heapspan"><strong><span style="color:#79AC78">TIL - Queue, Tree &amp; Heap</span></strong></h1> +<h2 id="span-stylecolorb0d9b1공부-내용span">📋 <strong><span style="color:#B0D9B1">공부 내용</span></strong></h2> +<h3 id="span-stylecolord0e7d2queuesspan"><span style="color:#D0E7D2">Queues</span></h3> +<ul> +<li> +<p>Queue?</p> +<ul> +<li>FIFO (First In First Out)</li> +<li>operations +<ul> +<li>enqueue</li> +<li>dequeue +<ul> +<li>선형 배열으로 구현: <code>O(n)</code> -&gt; 연결 리스트로 구현하는것이 더 좋음</li> +</ul> +</li> +</ul> +</li> +</ul> +</li> +<li> +<p>Circular Queues</p> +<ul> +<li>배열의 한쪽 끝과 다른쪽 끝이 닿아 있는 모습</li> +<li>원소의 개수가 정해져있음</li> +<li><code>front / rear 포인터</code>를 기억하고, dequeue된 원소 저장소는 재활용</li> +<li>선형 배열으로 구현하는것이 더 좋음</li> +</ul> +</li> +<li> +<p>Priority Queues</p> +<ul> +<li>원소들 사이의 우선순위를 따름</li> +<li>우선순위 구현 +<ul> +<li>원소를 넣을 때 enqueue vs. 원소를 꺼낼 때 dequeue +<ul> +<li>넣을 때(enqueue) 우선순위에 따라 정렬하는것이 조금 더 나은 Time Complexity를 가짐</li> +<li>데이터를 관리하고 활용하는 데에도 더 편리함</li> +</ul> +</li> +</ul> +</li> +</ul> +</li> +</ul> +<h3 id="span-stylecolord0e7d2treesspan"><span style="color:#D0E7D2">Trees</span></h3> +<ul> +<li> +<p><strong>Tree?</strong></p> +<ul> +<li>구성 +<ul> +<li>root node</li> +<li>interner nodes</li> +<li>leaf nodes</li> +</ul> +</li> +<li>특성 +<ul> +<li>parent node / child node</li> +<li>노드의 수준 (level) : root node로부터 거리</li> +<li>노드의 차수 (degree) : 노드의 자식 수</li> +<li>트리의 높이(height) 또는 깊이(depth) : 제일 큰 level + 1</li> +<li>subtree</li> +</ul> +</li> +</ul> +</li> +<li> +<p><strong>Binary Trees</strong></p> +<ul> +<li>모든 node의 degree &lt;= 2</li> +<li>operations +<ul> +<li>size()</li> +<li>depth()</li> +<li>순회 traversal +<ul> +<li>Depth First Traversal : 재귀 호출을 통해 구현 +<ul> +<li>inorder</li> +<li>preorder</li> +<li>postorder</li> +</ul> +</li> +<li>Breadth Tirst Traversal : queue 사용! +<ul> +<li>level이 낮은 노드를 우선으로 방문</li> +<li>같은 level인 경우 부모 노드의 순서를 따름</li> +</ul> +</li> +</ul> +</li> +</ul> +</li> +<li>포화 이진 트리 (full binary trees) +<ul> +<li>모든 node의 degree == 2</li> +</ul> +</li> +<li>완전 이진 트리 (complete binary trees) +<ul> +<li>(depth k) <code>level k-2</code>까지는 full binary tree, <code>level k-1</code>은 왼쪽부터 node 채워짐</li> +</ul> +</li> +</ul> +</li> +<li> +<p><strong>Binary Search Trees</strong></p> +<ul> +<li>모든 노드에 대해 다음 성질을 만족하는 Binary Tree +<ul> +<li>왼쪽 subtree&rsquo;s data &lt; 현재 node&rsquo;s data &lt; 오른쪽 subtree&rsquo;s data</li> +</ul> +</li> +<li>장단점 +<ul> +<li>장점 : 원소의 추가, 삭제가 편함</li> +<li>단점 : 큰 공간을 소요함 (연결 리스트로 구현)</li> +</ul> +</li> +<li>operations +<ul> +<li>insert()</li> +<li>remove()</li> +<li>lookup()</li> +<li>inorder()</li> +<li>min(), max()</li> +</ul> +</li> +</ul> +</li> +</ul> +<h3 id="span-stylecolord0e7d2heapspan"><span style="color:#D0E7D2">Heap</span></h3> +<ul> +<li>Heaps? +<ul> +<li> +<p>Binary Tree의 한 종류 (binary heap)</p> +</li> +<li> +<p>Min / Max heap</p> +<ul> +<li>root node가 항상 최소/최대 값을 가진다</li> +<li>complete binary tree +<ul> +<li><code>n</code> nodes -&gt; depth <code>log(n)+1</code></li> +<li>insert / remove operation의 Time Complexity : <code>O(log(n))</code></li> +</ul> +</li> +<li>subtree 또한 Min / Max heap</li> +</ul> +</li> +<li> +<p>Binary Seacrh Tree vs. Heap?</p> +<table> +<thead> +<tr> +<th></th> +<th>BST</th> +<th>Heap</th> +</tr> +</thead> +<tbody> +<tr> +<td>데이터 정렬</td> +<td>크기순서대로 완전 정렬</td> +<td>완전 정렬 X</td> +</tr> +<tr> +<td>데이터 검색</td> +<td>O</td> +<td>X</td> +</tr> +<tr> +<td>완전 이진 트리</td> +<td>X</td> +<td>O</td> +</tr> +<tr> +<td>연산 시간</td> +<td>(최악의 경우) O(n)</td> +<td>O(log(n))</td> +</tr> +<tr> +<td>선형 배열로 구현</td> +<td>X</td> +<td>O</td> +</tr> +</tbody> +</table> +</li> +<li> +<p>operations</p> +<ul> +<li>insert()</li> +<li>remove()</li> +</ul> +</li> +</ul> +</li> +</ul> +<h2 id="span-stylecolorb0d9b1checkspan">👀 <strong><span style="color:#B0D9B1">CHECK</span></strong></h2> +<h6 id="어렵거나-새롭게-알게-된-것-등-다시-확인할-것들"><em>(어렵거나 새롭게 알게 된 것 등 다시 확인할 것들)</em></h6> +<ul> +<li><strong>노드의 차수(degree) : # of children</strong> +<ul> +<li>binary tree : 모든 노드의 degree가 항상 2이하</li> +<li>leaf nodes : degree 0</li> +</ul> +</li> +<li><strong>단축 평가</strong> +<ul> +<li><a class="link" href="https://pydole.tistory.com/entry/Python-%EB%8B%A8%EC%B6%95%ED%8F%89%EA%B0%80short-circuit-evalution" target="_blank" rel="noopener" + >단축평가에 대해 참고한 블로그</a></li> +<li>2개 이상의 논리 조건식이 있을 경우에, <strong>앞 조건이 계산한 값에 의해 결과가 확실해지면 두번째 조건은 확인하지 않음</strong></li> +<li>False and (), True or () 인 경우 등이 해당됨</li> +</ul> +</li> +</ul> +<h2 id="span-stylecolorb0d9b1느낀-점span">❗ <strong><span style="color:#B0D9B1">느낀 점</span></strong></h2> +<p>어제의 교훈이 있어서 그런지, 오늘은 프로그래밍 과정에 실수가 적었다. +그리고, 자료구조를 구현하는 과정에서 더 나은 방식에 대해 고민하는 상황이 많아졌다.</p> +<p>오늘 주로 고민한 부분은</p> +<div class="highlight"><div class="chroma"> +<table class="lntable"><tr><td class="lntd"> +<pre tabindex="0" class="chroma"><code><span class="lnt">1 +</span><span class="lnt">2 +</span><span class="lnt">3 +</span><span class="lnt">4 +</span><span class="lnt">5 +</span></code></pre></td> +<td class="lntd"> +<pre tabindex="0" class="chroma"><code class="language-fallback" data-lang="fallback"><span class="line"><span class="cl">코드를 더 직관적으로 적고싶음 +</span></span><span class="line"><span class="cl">- 반복되는 같은 코드를 합칠 수 있는가? +</span></span><span class="line"><span class="cl"> +</span></span><span class="line"><span class="cl">같은 코드 다른 효율? +</span></span><span class="line"><span class="cl">- 같은 기능을 하지만 살짝 다른 두 코드 중 더 나은것은? +</span></span></code></pre></td></tr></table> +</div> +</div><p>정도였다.</p> +<p>전자는 내가 평소 프로그래밍 할 때 자주 하긴 하는데, 항상 고민하는 부분이다. +반복되는 기능을 함수로 빼던가, 적용되는 변수를 리스트로 묶어서 반복하는 등의 방법을 쓰는데, 다른 방법은 뭐가 있을까 고민하고 있다.</p> +<p>후자는 Complexity를 구하는 방법에 대한 의문이 아니다. 실제로 이 operation이 어떻게 구현되고 있는지, 왜 그렇게 구현되었는지가 궁금한 것이다. <br> +실습 문제에서 우선순위 queue를 구현할 때, skeleton code의 dequeue 함수는 마지막 elements를 가져오는 방식으로 되어있었다.(<code>getAt(data.size())</code>) <br> +나는 처음 element를 가져오는 방식으로 생각하고(<code>getAt(1)</code>) 이에 해당하는 enqueue 함수를 작성했기 때문에 잠깐 막혔다가, 결국은 눈치채고 해결했다.<br> +그 코드를 보면서 이렇게 구현하는게 더 나은건지 궁금증이 들었고, 같은 기능을 하지만 결함이 적은(?) 코드를 작성하자는 생각이 들었다.</p> +<p>오늘은 추가 알고리즘 문제들이 있고 아직 풀지 않았는데, 쉬운 문제들이지만 이 두가지를 생각하면서 풀려고 노력해야겠다.</p> + + + + + diff --git a/public/tags/tree/page/1/index.html b/public/tags/tree/page/1/index.html new file mode 100644 index 0000000..fc23a33 --- /dev/null +++ b/public/tags/tree/page/1/index.html @@ -0,0 +1,10 @@ + + + + https://srlee056.github.io/tags/tree/ + + + + + + diff --git a/public/zh-cn/404.html b/public/zh-cn/404.html deleted file mode 100644 index 2e83bfa..0000000 --- a/public/zh-cn/404.html +++ /dev/null @@ -1,249 +0,0 @@ - - - - -404 Page not found - - - - - - - - - - - - - -
- -
-
-

404 错误

-

页面不存在

-
-
- - -
- Built with Hugo
- 主题 StackJimmy 设计 -
-
- - -
-
- - - - - diff --git a/public/zh-cn/categories/index.html b/public/zh-cn/categories/index.html deleted file mode 100644 index 5c5ba46..0000000 --- a/public/zh-cn/categories/index.html +++ /dev/null @@ -1,351 +0,0 @@ - - - - -Categories - - - - - - - - - - - - - -
- - - - -
-
-

- - Section - -

- -
-
-

2 pages

-

Categories

- -
-
-
- - -
- - - - - -
-
- - -
- Built with Hugo
- 主题 StackJimmy 设计 -
-
- - -
-
- - - - - diff --git a/public/zh-cn/categories/index.xml b/public/zh-cn/categories/index.xml deleted file mode 100644 index 858e8bb..0000000 --- a/public/zh-cn/categories/index.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - Categories on 演示站点 - https://srlee056.github.io/zh-cn/categories/ - Recent content in Categories on 演示站点 - Hugo -- gohugo.io - zh-cn - Seorim Lee - Wed, 09 Sep 2020 00:00:00 +0000 - Test - https://srlee056.github.io/zh-cn/categories/test/ - Wed, 09 Sep 2020 00:00:00 +0000 - - https://srlee056.github.io/zh-cn/categories/test/ - - - - 测试 - https://srlee056.github.io/zh-cn/categories/%E6%B5%8B%E8%AF%95/ - Wed, 09 Sep 2020 00:00:00 +0000 - - https://srlee056.github.io/zh-cn/categories/%E6%B5%8B%E8%AF%95/ - - - - - diff --git a/public/zh-cn/categories/page/1/index.html b/public/zh-cn/categories/page/1/index.html deleted file mode 100644 index 4162ac0..0000000 --- a/public/zh-cn/categories/page/1/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - https://srlee056.github.io/zh-cn/categories/ - - - - - - diff --git a/public/zh-cn/categories/test/index.html b/public/zh-cn/categories/test/index.html deleted file mode 100644 index 5b6349e..0000000 --- a/public/zh-cn/categories/test/index.html +++ /dev/null @@ -1,348 +0,0 @@ - - - - -Category: Test - 演示站点 - - - - - - - - - - - - - -
- - - - -
-
-

- - Categories - -

- -
-
-

1 page

-

Test

- -
-
-
- -
- - - -
-
- - -
- Built with Hugo
- 主题 StackJimmy 设计 -
-
- - -
-
- - - - - diff --git a/public/zh-cn/categories/test/index.xml b/public/zh-cn/categories/test/index.xml deleted file mode 100644 index 6aa36ac..0000000 --- a/public/zh-cn/categories/test/index.xml +++ /dev/null @@ -1,101 +0,0 @@ - - - - Test on 演示站点 - https://srlee056.github.io/zh-cn/categories/test/ - Recent content in Test on 演示站点 - Hugo -- gohugo.io - zh-cn - Seorim Lee - Wed, 09 Sep 2020 00:00:00 +0000 - Chinese Test - https://srlee056.github.io/zh-cn/p/test-chinese/ - Wed, 09 Sep 2020 00:00:00 +0000 - - https://srlee056.github.io/zh-cn/p/test-chinese/ - <img src="https://srlee056.github.io/zh-cn/p/test-chinese/helena-hertz-wWZzXlDpMog-unsplash.jpg" alt="Featured image of post Chinese Test" /><h2 id="正文测试">正文测试</h2> -<p>而这些并不是完全重要,更加重要的问题是, 带着这些问题,我们来审视一下学生会退会。 既然如何, 对我个人而言,学生会退会不仅仅是一个重大的事件,还可能会改变我的人生。 我们不得不面对一个非常尴尬的事实,那就是, 可是,即使是这样,学生会退会的出现仍然代表了一定的意义。 学生会退会,发生了会如何,不发生又会如何。 经过上述讨论, 生活中,若学生会退会出现了,我们就不得不考虑它出现了的事实。 学生会退会,到底应该如何实现。 这样看来, 在这种困难的抉择下,本人思来想去,寝食难安。 对我个人而言,学生会退会不仅仅是一个重大的事件,还可能会改变我的人生。 就我个人来说,学生会退会对我的意义,不能不说非常重大。 莎士比亚曾经提到过,人的一生是短的,但如果卑劣地过这一生,就太长了。这似乎解答了我的疑惑。 莫扎特说过一句富有哲理的话,谁和我一样用功,谁就会和我一样成功。这启发了我, 对我个人而言,学生会退会不仅仅是一个重大的事件,还可能会改变我的人生。 学生会退会,到底应该如何实现。 一般来说, 从这个角度来看, 这种事实对本人来说意义重大,相信对这个世界也是有一定意义的。 在这种困难的抉择下,本人思来想去,寝食难安。 了解清楚学生会退会到底是一种怎么样的存在,是解决一切问题的关键。 一般来说, 生活中,若学生会退会出现了,我们就不得不考虑它出现了的事实。 问题的关键究竟为何? 而这些并不是完全重要,更加重要的问题是。</p> -<p>奥斯特洛夫斯基曾经说过,共同的事业,共同的斗争,可以使人们产生忍受一切的力量。 带着这句话,我们还要更加慎重的审视这个问题: 一般来讲,我们都必须务必慎重的考虑考虑。 既然如此, 这种事实对本人来说意义重大,相信对这个世界也是有一定意义的。 带着这些问题,我们来审视一下学生会退会。 我认为, 我认为, 在这种困难的抉择下,本人思来想去,寝食难安。 问题的关键究竟为何? 每个人都不得不面对这些问题。 在面对这种问题时, 要想清楚,学生会退会,到底是一种怎么样的存在。 我认为, 既然如此, 每个人都不得不面对这些问题。 在面对这种问题时, 那么, 我认为, 学生会退会因何而发生。</p> -<h2 id="引用">引用</h2> -<blockquote> -<p>思念是最暖的忧伤像一双翅膀<br> -让我停不了飞不远在过往游荡<br> -不告而别的你 就算为了我着想<br> -这么沉痛的呵护 我怎么能翱翔</p> -<p><em><a class="link" href="https://www.youtube.com/watch?v=3aypp_YlBzI" target="_blank" rel="noopener" - >最暖的憂傷 - 田馥甄</a></em></p> -</blockquote> -<h2 id="图片">图片</h2> -<p><img src="https://srlee056.github.io/zh-cn/p/test-chinese/florian-klauer-nptLmg6jqDo-unsplash.jpg" - width="667" - height="1000" - srcset="https://srlee056.github.io/zh-cn/p/test-chinese/florian-klauer-nptLmg6jqDo-unsplash_hu595aaf3b3dbbb41af5aed8d3958cc9f9_13854_480x0_resize_q75_box.jpg 480w, https://srlee056.github.io/zh-cn/p/test-chinese/florian-klauer-nptLmg6jqDo-unsplash_hu595aaf3b3dbbb41af5aed8d3958cc9f9_13854_1024x0_resize_q75_box.jpg 1024w" - loading="lazy" - - alt="Photo by Florian Klauer on Unsplash" - - - class="gallery-image" - data-flex-grow="66" - data-flex-basis="160px" - -> <img src="https://srlee056.github.io/zh-cn/p/test-chinese/luca-bravo-alS7ewQ41M8-unsplash.jpg" - width="1000" - height="667" - srcset="https://srlee056.github.io/zh-cn/p/test-chinese/luca-bravo-alS7ewQ41M8-unsplash_hu0a3f1163de68d0b9471979ebf0ecf11e_32400_480x0_resize_q75_box.jpg 480w, https://srlee056.github.io/zh-cn/p/test-chinese/luca-bravo-alS7ewQ41M8-unsplash_hu0a3f1163de68d0b9471979ebf0ecf11e_32400_1024x0_resize_q75_box.jpg 1024w" - loading="lazy" - - alt="Photo by Luca Bravo on Unsplash" - - - class="gallery-image" - data-flex-grow="149" - data-flex-basis="359px" - -></p> -<p><img src="https://srlee056.github.io/zh-cn/p/test-chinese/helena-hertz-wWZzXlDpMog-unsplash.jpg" - width="1000" - height="750" - srcset="https://srlee056.github.io/zh-cn/p/test-chinese/helena-hertz-wWZzXlDpMog-unsplash_hu45a5e3ad5e058da6a00650ed8fd40bea_15530_480x0_resize_q75_box.jpg 480w, https://srlee056.github.io/zh-cn/p/test-chinese/helena-hertz-wWZzXlDpMog-unsplash_hu45a5e3ad5e058da6a00650ed8fd40bea_15530_1024x0_resize_q75_box.jpg 1024w" - loading="lazy" - - alt="Photo by Helena Hertz on Unsplash" - - - class="gallery-image" - data-flex-grow="133" - data-flex-basis="320px" - -> <img src="https://srlee056.github.io/zh-cn/p/test-chinese/hudai-gayiran-3Od_VKcDEAA-unsplash.jpg" - width="667" - height="1000" - srcset="https://srlee056.github.io/zh-cn/p/test-chinese/hudai-gayiran-3Od_VKcDEAA-unsplash_hub241c2a9c7a2caf7e16a2a5bbc7141ff_18711_480x0_resize_q75_box.jpg 480w, https://srlee056.github.io/zh-cn/p/test-chinese/hudai-gayiran-3Od_VKcDEAA-unsplash_hub241c2a9c7a2caf7e16a2a5bbc7141ff_18711_1024x0_resize_q75_box.jpg 1024w" - loading="lazy" - - alt="Photo by Hudai Gayiran on Unsplash" - - - class="gallery-image" - data-flex-grow="66" - data-flex-basis="160px" - -></p> -<div class="highlight"><div class="chroma"> -<table class="lntable"><tr><td class="lntd"> -<pre tabindex="0" class="chroma"><code><span class="lnt">1 -</span><span class="lnt">2 -</span><span class="lnt">3 -</span></code></pre></td> -<td class="lntd"> -<pre tabindex="0" class="chroma"><code class="language-markdown" data-lang="markdown"><span class="line"><span class="cl">![<span class="nt">Photo by Florian Klauer on Unsplash</span>](<span class="na">florian-klauer-nptLmg6jqDo-unsplash.jpg</span>) ![<span class="nt">Photo by Luca Bravo on Unsplash</span>](<span class="na">luca-bravo-alS7ewQ41M8-unsplash.jpg</span>) -</span></span><span class="line"><span class="cl"> -</span></span><span class="line"><span class="cl">![<span class="nt">Photo by Helena Hertz on Unsplash</span>](<span class="na">helena-hertz-wWZzXlDpMog-unsplash.jpg</span>) ![<span class="nt">Photo by Hudai Gayiran on Unsplash</span>](<span class="na">hudai-gayiran-3Od_VKcDEAA-unsplash.jpg</span>) -</span></span></code></pre></td></tr></table> -</div> -</div><p>相册语法来自 <a class="link" href="https://typlog.com/" target="_blank" rel="noopener" - >Typlog</a></p> - - - - - diff --git a/public/zh-cn/categories/test/page/1/index.html b/public/zh-cn/categories/test/page/1/index.html deleted file mode 100644 index 7213ad7..0000000 --- a/public/zh-cn/categories/test/page/1/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - https://srlee056.github.io/zh-cn/categories/test/ - - - - - - diff --git "a/public/zh-cn/categories/\346\265\213\350\257\225/index.html" "b/public/zh-cn/categories/\346\265\213\350\257\225/index.html" deleted file mode 100644 index ec2681d..0000000 --- "a/public/zh-cn/categories/\346\265\213\350\257\225/index.html" +++ /dev/null @@ -1,348 +0,0 @@ - - - - -Category: 测试 - 演示站点 - - - - - - - - - - - - - -
- - - - -
-
-

- - Categories - -

- -
-
-

1 page

-

测试

- -
-
-
- -
- - - -
-
- - -
- Built with Hugo
- 主题 StackJimmy 设计 -
-
- - -
-
- - - - - diff --git "a/public/zh-cn/categories/\346\265\213\350\257\225/index.xml" "b/public/zh-cn/categories/\346\265\213\350\257\225/index.xml" deleted file mode 100644 index 1713158..0000000 --- "a/public/zh-cn/categories/\346\265\213\350\257\225/index.xml" +++ /dev/null @@ -1,101 +0,0 @@ - - - - 测试 on 演示站点 - https://srlee056.github.io/zh-cn/categories/%E6%B5%8B%E8%AF%95/ - Recent content in 测试 on 演示站点 - Hugo -- gohugo.io - zh-cn - Seorim Lee - Wed, 09 Sep 2020 00:00:00 +0000 - Chinese Test - https://srlee056.github.io/zh-cn/p/test-chinese/ - Wed, 09 Sep 2020 00:00:00 +0000 - - https://srlee056.github.io/zh-cn/p/test-chinese/ - <img src="https://srlee056.github.io/zh-cn/p/test-chinese/helena-hertz-wWZzXlDpMog-unsplash.jpg" alt="Featured image of post Chinese Test" /><h2 id="正文测试">正文测试</h2> -<p>而这些并不是完全重要,更加重要的问题是, 带着这些问题,我们来审视一下学生会退会。 既然如何, 对我个人而言,学生会退会不仅仅是一个重大的事件,还可能会改变我的人生。 我们不得不面对一个非常尴尬的事实,那就是, 可是,即使是这样,学生会退会的出现仍然代表了一定的意义。 学生会退会,发生了会如何,不发生又会如何。 经过上述讨论, 生活中,若学生会退会出现了,我们就不得不考虑它出现了的事实。 学生会退会,到底应该如何实现。 这样看来, 在这种困难的抉择下,本人思来想去,寝食难安。 对我个人而言,学生会退会不仅仅是一个重大的事件,还可能会改变我的人生。 就我个人来说,学生会退会对我的意义,不能不说非常重大。 莎士比亚曾经提到过,人的一生是短的,但如果卑劣地过这一生,就太长了。这似乎解答了我的疑惑。 莫扎特说过一句富有哲理的话,谁和我一样用功,谁就会和我一样成功。这启发了我, 对我个人而言,学生会退会不仅仅是一个重大的事件,还可能会改变我的人生。 学生会退会,到底应该如何实现。 一般来说, 从这个角度来看, 这种事实对本人来说意义重大,相信对这个世界也是有一定意义的。 在这种困难的抉择下,本人思来想去,寝食难安。 了解清楚学生会退会到底是一种怎么样的存在,是解决一切问题的关键。 一般来说, 生活中,若学生会退会出现了,我们就不得不考虑它出现了的事实。 问题的关键究竟为何? 而这些并不是完全重要,更加重要的问题是。</p> -<p>奥斯特洛夫斯基曾经说过,共同的事业,共同的斗争,可以使人们产生忍受一切的力量。 带着这句话,我们还要更加慎重的审视这个问题: 一般来讲,我们都必须务必慎重的考虑考虑。 既然如此, 这种事实对本人来说意义重大,相信对这个世界也是有一定意义的。 带着这些问题,我们来审视一下学生会退会。 我认为, 我认为, 在这种困难的抉择下,本人思来想去,寝食难安。 问题的关键究竟为何? 每个人都不得不面对这些问题。 在面对这种问题时, 要想清楚,学生会退会,到底是一种怎么样的存在。 我认为, 既然如此, 每个人都不得不面对这些问题。 在面对这种问题时, 那么, 我认为, 学生会退会因何而发生。</p> -<h2 id="引用">引用</h2> -<blockquote> -<p>思念是最暖的忧伤像一双翅膀<br> -让我停不了飞不远在过往游荡<br> -不告而别的你 就算为了我着想<br> -这么沉痛的呵护 我怎么能翱翔</p> -<p><em><a class="link" href="https://www.youtube.com/watch?v=3aypp_YlBzI" target="_blank" rel="noopener" - >最暖的憂傷 - 田馥甄</a></em></p> -</blockquote> -<h2 id="图片">图片</h2> -<p><img src="https://srlee056.github.io/zh-cn/p/test-chinese/florian-klauer-nptLmg6jqDo-unsplash.jpg" - width="667" - height="1000" - srcset="https://srlee056.github.io/zh-cn/p/test-chinese/florian-klauer-nptLmg6jqDo-unsplash_hu595aaf3b3dbbb41af5aed8d3958cc9f9_13854_480x0_resize_q75_box.jpg 480w, https://srlee056.github.io/zh-cn/p/test-chinese/florian-klauer-nptLmg6jqDo-unsplash_hu595aaf3b3dbbb41af5aed8d3958cc9f9_13854_1024x0_resize_q75_box.jpg 1024w" - loading="lazy" - - alt="Photo by Florian Klauer on Unsplash" - - - class="gallery-image" - data-flex-grow="66" - data-flex-basis="160px" - -> <img src="https://srlee056.github.io/zh-cn/p/test-chinese/luca-bravo-alS7ewQ41M8-unsplash.jpg" - width="1000" - height="667" - srcset="https://srlee056.github.io/zh-cn/p/test-chinese/luca-bravo-alS7ewQ41M8-unsplash_hu0a3f1163de68d0b9471979ebf0ecf11e_32400_480x0_resize_q75_box.jpg 480w, https://srlee056.github.io/zh-cn/p/test-chinese/luca-bravo-alS7ewQ41M8-unsplash_hu0a3f1163de68d0b9471979ebf0ecf11e_32400_1024x0_resize_q75_box.jpg 1024w" - loading="lazy" - - alt="Photo by Luca Bravo on Unsplash" - - - class="gallery-image" - data-flex-grow="149" - data-flex-basis="359px" - -></p> -<p><img src="https://srlee056.github.io/zh-cn/p/test-chinese/helena-hertz-wWZzXlDpMog-unsplash.jpg" - width="1000" - height="750" - srcset="https://srlee056.github.io/zh-cn/p/test-chinese/helena-hertz-wWZzXlDpMog-unsplash_hu45a5e3ad5e058da6a00650ed8fd40bea_15530_480x0_resize_q75_box.jpg 480w, https://srlee056.github.io/zh-cn/p/test-chinese/helena-hertz-wWZzXlDpMog-unsplash_hu45a5e3ad5e058da6a00650ed8fd40bea_15530_1024x0_resize_q75_box.jpg 1024w" - loading="lazy" - - alt="Photo by Helena Hertz on Unsplash" - - - class="gallery-image" - data-flex-grow="133" - data-flex-basis="320px" - -> <img src="https://srlee056.github.io/zh-cn/p/test-chinese/hudai-gayiran-3Od_VKcDEAA-unsplash.jpg" - width="667" - height="1000" - srcset="https://srlee056.github.io/zh-cn/p/test-chinese/hudai-gayiran-3Od_VKcDEAA-unsplash_hub241c2a9c7a2caf7e16a2a5bbc7141ff_18711_480x0_resize_q75_box.jpg 480w, https://srlee056.github.io/zh-cn/p/test-chinese/hudai-gayiran-3Od_VKcDEAA-unsplash_hub241c2a9c7a2caf7e16a2a5bbc7141ff_18711_1024x0_resize_q75_box.jpg 1024w" - loading="lazy" - - alt="Photo by Hudai Gayiran on Unsplash" - - - class="gallery-image" - data-flex-grow="66" - data-flex-basis="160px" - -></p> -<div class="highlight"><div class="chroma"> -<table class="lntable"><tr><td class="lntd"> -<pre tabindex="0" class="chroma"><code><span class="lnt">1 -</span><span class="lnt">2 -</span><span class="lnt">3 -</span></code></pre></td> -<td class="lntd"> -<pre tabindex="0" class="chroma"><code class="language-markdown" data-lang="markdown"><span class="line"><span class="cl">![<span class="nt">Photo by Florian Klauer on Unsplash</span>](<span class="na">florian-klauer-nptLmg6jqDo-unsplash.jpg</span>) ![<span class="nt">Photo by Luca Bravo on Unsplash</span>](<span class="na">luca-bravo-alS7ewQ41M8-unsplash.jpg</span>) -</span></span><span class="line"><span class="cl"> -</span></span><span class="line"><span class="cl">![<span class="nt">Photo by Helena Hertz on Unsplash</span>](<span class="na">helena-hertz-wWZzXlDpMog-unsplash.jpg</span>) ![<span class="nt">Photo by Hudai Gayiran on Unsplash</span>](<span class="na">hudai-gayiran-3Od_VKcDEAA-unsplash.jpg</span>) -</span></span></code></pre></td></tr></table> -</div> -</div><p>相册语法来自 <a class="link" href="https://typlog.com/" target="_blank" rel="noopener" - >Typlog</a></p> - - - - - diff --git "a/public/zh-cn/categories/\346\265\213\350\257\225/page/1/index.html" "b/public/zh-cn/categories/\346\265\213\350\257\225/page/1/index.html" deleted file mode 100644 index 9ee1bdd..0000000 --- "a/public/zh-cn/categories/\346\265\213\350\257\225/page/1/index.html" +++ /dev/null @@ -1,10 +0,0 @@ - - - - https://srlee056.github.io/zh-cn/categories/%E6%B5%8B%E8%AF%95/ - - - - - - diff --git a/public/zh-cn/index.html b/public/zh-cn/index.html deleted file mode 100644 index dcb2c2c..0000000 --- a/public/zh-cn/index.html +++ /dev/null @@ -1,404 +0,0 @@ - - - - - -演示站点 - - - - - - - - - - - - - -
- - - - -
- - - - - -
- - -
-
-
- - Featured image of post Chinese Test - - -
- - -
- - - - -
-

- Chinese Test -

- - -

- 这是一个副标题 -

- -
- - - - - -
- -
- - - - - - - - - - -
- - - -
- - - - - - - - - -
- -
- - - -
- -
-
- -
-
- - -
- Built with Hugo
- 主题 StackJimmy 设计 -
-
- -
-
- - - - - diff --git a/public/zh-cn/index.xml b/public/zh-cn/index.xml deleted file mode 100644 index 0ba1920..0000000 --- a/public/zh-cn/index.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - - 演示站点 - https://srlee056.github.io/zh-cn/ - Recent content on 演示站点 - Hugo -- gohugo.io - zh-cn - Seorim Lee - Wed, 09 Sep 2020 00:00:00 +0000 - Chinese Test - https://srlee056.github.io/zh-cn/p/test-chinese/ - Wed, 09 Sep 2020 00:00:00 +0000 - - https://srlee056.github.io/zh-cn/p/test-chinese/ - <img src="https://srlee056.github.io/zh-cn/p/test-chinese/helena-hertz-wWZzXlDpMog-unsplash.jpg" alt="Featured image of post Chinese Test" /><h2 id="正文测试">正文测试</h2> -<p>而这些并不是完全重要,更加重要的问题是, 带着这些问题,我们来审视一下学生会退会。 既然如何, 对我个人而言,学生会退会不仅仅是一个重大的事件,还可能会改变我的人生。 我们不得不面对一个非常尴尬的事实,那就是, 可是,即使是这样,学生会退会的出现仍然代表了一定的意义。 学生会退会,发生了会如何,不发生又会如何。 经过上述讨论, 生活中,若学生会退会出现了,我们就不得不考虑它出现了的事实。 学生会退会,到底应该如何实现。 这样看来, 在这种困难的抉择下,本人思来想去,寝食难安。 对我个人而言,学生会退会不仅仅是一个重大的事件,还可能会改变我的人生。 就我个人来说,学生会退会对我的意义,不能不说非常重大。 莎士比亚曾经提到过,人的一生是短的,但如果卑劣地过这一生,就太长了。这似乎解答了我的疑惑。 莫扎特说过一句富有哲理的话,谁和我一样用功,谁就会和我一样成功。这启发了我, 对我个人而言,学生会退会不仅仅是一个重大的事件,还可能会改变我的人生。 学生会退会,到底应该如何实现。 一般来说, 从这个角度来看, 这种事实对本人来说意义重大,相信对这个世界也是有一定意义的。 在这种困难的抉择下,本人思来想去,寝食难安。 了解清楚学生会退会到底是一种怎么样的存在,是解决一切问题的关键。 一般来说, 生活中,若学生会退会出现了,我们就不得不考虑它出现了的事实。 问题的关键究竟为何? 而这些并不是完全重要,更加重要的问题是。</p> -<p>奥斯特洛夫斯基曾经说过,共同的事业,共同的斗争,可以使人们产生忍受一切的力量。 带着这句话,我们还要更加慎重的审视这个问题: 一般来讲,我们都必须务必慎重的考虑考虑。 既然如此, 这种事实对本人来说意义重大,相信对这个世界也是有一定意义的。 带着这些问题,我们来审视一下学生会退会。 我认为, 我认为, 在这种困难的抉择下,本人思来想去,寝食难安。 问题的关键究竟为何? 每个人都不得不面对这些问题。 在面对这种问题时, 要想清楚,学生会退会,到底是一种怎么样的存在。 我认为, 既然如此, 每个人都不得不面对这些问题。 在面对这种问题时, 那么, 我认为, 学生会退会因何而发生。</p> -<h2 id="引用">引用</h2> -<blockquote> -<p>思念是最暖的忧伤像一双翅膀<br> -让我停不了飞不远在过往游荡<br> -不告而别的你 就算为了我着想<br> -这么沉痛的呵护 我怎么能翱翔</p> -<p><em><a class="link" href="https://www.youtube.com/watch?v=3aypp_YlBzI" target="_blank" rel="noopener" - >最暖的憂傷 - 田馥甄</a></em></p> -</blockquote> -<h2 id="图片">图片</h2> -<p><img src="https://srlee056.github.io/zh-cn/p/test-chinese/florian-klauer-nptLmg6jqDo-unsplash.jpg" - width="667" - height="1000" - srcset="https://srlee056.github.io/zh-cn/p/test-chinese/florian-klauer-nptLmg6jqDo-unsplash_hu595aaf3b3dbbb41af5aed8d3958cc9f9_13854_480x0_resize_q75_box.jpg 480w, https://srlee056.github.io/zh-cn/p/test-chinese/florian-klauer-nptLmg6jqDo-unsplash_hu595aaf3b3dbbb41af5aed8d3958cc9f9_13854_1024x0_resize_q75_box.jpg 1024w" - loading="lazy" - - alt="Photo by Florian Klauer on Unsplash" - - - class="gallery-image" - data-flex-grow="66" - data-flex-basis="160px" - -> <img src="https://srlee056.github.io/zh-cn/p/test-chinese/luca-bravo-alS7ewQ41M8-unsplash.jpg" - width="1000" - height="667" - srcset="https://srlee056.github.io/zh-cn/p/test-chinese/luca-bravo-alS7ewQ41M8-unsplash_hu0a3f1163de68d0b9471979ebf0ecf11e_32400_480x0_resize_q75_box.jpg 480w, https://srlee056.github.io/zh-cn/p/test-chinese/luca-bravo-alS7ewQ41M8-unsplash_hu0a3f1163de68d0b9471979ebf0ecf11e_32400_1024x0_resize_q75_box.jpg 1024w" - loading="lazy" - - alt="Photo by Luca Bravo on Unsplash" - - - class="gallery-image" - data-flex-grow="149" - data-flex-basis="359px" - -></p> -<p><img src="https://srlee056.github.io/zh-cn/p/test-chinese/helena-hertz-wWZzXlDpMog-unsplash.jpg" - width="1000" - height="750" - srcset="https://srlee056.github.io/zh-cn/p/test-chinese/helena-hertz-wWZzXlDpMog-unsplash_hu45a5e3ad5e058da6a00650ed8fd40bea_15530_480x0_resize_q75_box.jpg 480w, https://srlee056.github.io/zh-cn/p/test-chinese/helena-hertz-wWZzXlDpMog-unsplash_hu45a5e3ad5e058da6a00650ed8fd40bea_15530_1024x0_resize_q75_box.jpg 1024w" - loading="lazy" - - alt="Photo by Helena Hertz on Unsplash" - - - class="gallery-image" - data-flex-grow="133" - data-flex-basis="320px" - -> <img src="https://srlee056.github.io/zh-cn/p/test-chinese/hudai-gayiran-3Od_VKcDEAA-unsplash.jpg" - width="667" - height="1000" - srcset="https://srlee056.github.io/zh-cn/p/test-chinese/hudai-gayiran-3Od_VKcDEAA-unsplash_hub241c2a9c7a2caf7e16a2a5bbc7141ff_18711_480x0_resize_q75_box.jpg 480w, https://srlee056.github.io/zh-cn/p/test-chinese/hudai-gayiran-3Od_VKcDEAA-unsplash_hub241c2a9c7a2caf7e16a2a5bbc7141ff_18711_1024x0_resize_q75_box.jpg 1024w" - loading="lazy" - - alt="Photo by Hudai Gayiran on Unsplash" - - - class="gallery-image" - data-flex-grow="66" - data-flex-basis="160px" - -></p> -<div class="highlight"><div class="chroma"> -<table class="lntable"><tr><td class="lntd"> -<pre tabindex="0" class="chroma"><code><span class="lnt">1 -</span><span class="lnt">2 -</span><span class="lnt">3 -</span></code></pre></td> -<td class="lntd"> -<pre tabindex="0" class="chroma"><code class="language-markdown" data-lang="markdown"><span class="line"><span class="cl">![<span class="nt">Photo by Florian Klauer on Unsplash</span>](<span class="na">florian-klauer-nptLmg6jqDo-unsplash.jpg</span>) ![<span class="nt">Photo by Luca Bravo on Unsplash</span>](<span class="na">luca-bravo-alS7ewQ41M8-unsplash.jpg</span>) -</span></span><span class="line"><span class="cl"> -</span></span><span class="line"><span class="cl">![<span class="nt">Photo by Helena Hertz on Unsplash</span>](<span class="na">helena-hertz-wWZzXlDpMog-unsplash.jpg</span>) ![<span class="nt">Photo by Hudai Gayiran on Unsplash</span>](<span class="na">hudai-gayiran-3Od_VKcDEAA-unsplash.jpg</span>) -</span></span></code></pre></td></tr></table> -</div> -</div><p>相册语法来自 <a class="link" href="https://typlog.com/" target="_blank" rel="noopener" - >Typlog</a></p> - - - - 关于 - https://srlee056.github.io/zh-cn/%E5%85%B3%E4%BA%8E/ - Mon, 01 Jan 0001 00:00:00 +0000 - - https://srlee056.github.io/zh-cn/%E5%85%B3%E4%BA%8E/ - <p>This is a test page for i18n support.</p> - - - - - diff --git a/public/zh-cn/p/test-chinese/florian-klauer-nptLmg6jqDo-unsplash.jpg b/public/zh-cn/p/test-chinese/florian-klauer-nptLmg6jqDo-unsplash.jpg deleted file mode 100644 index 4798ed4..0000000 Binary files a/public/zh-cn/p/test-chinese/florian-klauer-nptLmg6jqDo-unsplash.jpg and /dev/null differ diff --git a/public/zh-cn/p/test-chinese/florian-klauer-nptLmg6jqDo-unsplash_hu595aaf3b3dbbb41af5aed8d3958cc9f9_13854_1024x0_resize_q75_box.jpg b/public/zh-cn/p/test-chinese/florian-klauer-nptLmg6jqDo-unsplash_hu595aaf3b3dbbb41af5aed8d3958cc9f9_13854_1024x0_resize_q75_box.jpg deleted file mode 100644 index 369b16e..0000000 Binary files a/public/zh-cn/p/test-chinese/florian-klauer-nptLmg6jqDo-unsplash_hu595aaf3b3dbbb41af5aed8d3958cc9f9_13854_1024x0_resize_q75_box.jpg and /dev/null differ diff --git a/public/zh-cn/p/test-chinese/florian-klauer-nptLmg6jqDo-unsplash_hu595aaf3b3dbbb41af5aed8d3958cc9f9_13854_480x0_resize_q75_box.jpg b/public/zh-cn/p/test-chinese/florian-klauer-nptLmg6jqDo-unsplash_hu595aaf3b3dbbb41af5aed8d3958cc9f9_13854_480x0_resize_q75_box.jpg deleted file mode 100644 index b7fae50..0000000 Binary files a/public/zh-cn/p/test-chinese/florian-klauer-nptLmg6jqDo-unsplash_hu595aaf3b3dbbb41af5aed8d3958cc9f9_13854_480x0_resize_q75_box.jpg and /dev/null differ diff --git a/public/zh-cn/p/test-chinese/helena-hertz-wWZzXlDpMog-unsplash.jpg b/public/zh-cn/p/test-chinese/helena-hertz-wWZzXlDpMog-unsplash.jpg deleted file mode 100644 index 0120706..0000000 Binary files a/public/zh-cn/p/test-chinese/helena-hertz-wWZzXlDpMog-unsplash.jpg and /dev/null differ diff --git a/public/zh-cn/p/test-chinese/helena-hertz-wWZzXlDpMog-unsplash_hu45a5e3ad5e058da6a00650ed8fd40bea_15530_1024x0_resize_q75_box.jpg b/public/zh-cn/p/test-chinese/helena-hertz-wWZzXlDpMog-unsplash_hu45a5e3ad5e058da6a00650ed8fd40bea_15530_1024x0_resize_q75_box.jpg deleted file mode 100644 index b140f26..0000000 Binary files a/public/zh-cn/p/test-chinese/helena-hertz-wWZzXlDpMog-unsplash_hu45a5e3ad5e058da6a00650ed8fd40bea_15530_1024x0_resize_q75_box.jpg and /dev/null differ diff --git a/public/zh-cn/p/test-chinese/helena-hertz-wWZzXlDpMog-unsplash_hu45a5e3ad5e058da6a00650ed8fd40bea_15530_120x120_fill_q75_box_smart1.jpg b/public/zh-cn/p/test-chinese/helena-hertz-wWZzXlDpMog-unsplash_hu45a5e3ad5e058da6a00650ed8fd40bea_15530_120x120_fill_q75_box_smart1.jpg deleted file mode 100644 index 294ca4d..0000000 Binary files a/public/zh-cn/p/test-chinese/helena-hertz-wWZzXlDpMog-unsplash_hu45a5e3ad5e058da6a00650ed8fd40bea_15530_120x120_fill_q75_box_smart1.jpg and /dev/null differ diff --git a/public/zh-cn/p/test-chinese/helena-hertz-wWZzXlDpMog-unsplash_hu45a5e3ad5e058da6a00650ed8fd40bea_15530_1600x0_resize_q75_box.jpg b/public/zh-cn/p/test-chinese/helena-hertz-wWZzXlDpMog-unsplash_hu45a5e3ad5e058da6a00650ed8fd40bea_15530_1600x0_resize_q75_box.jpg deleted file mode 100644 index 74ade4c..0000000 Binary files a/public/zh-cn/p/test-chinese/helena-hertz-wWZzXlDpMog-unsplash_hu45a5e3ad5e058da6a00650ed8fd40bea_15530_1600x0_resize_q75_box.jpg and /dev/null differ diff --git a/public/zh-cn/p/test-chinese/helena-hertz-wWZzXlDpMog-unsplash_hu45a5e3ad5e058da6a00650ed8fd40bea_15530_480x0_resize_q75_box.jpg b/public/zh-cn/p/test-chinese/helena-hertz-wWZzXlDpMog-unsplash_hu45a5e3ad5e058da6a00650ed8fd40bea_15530_480x0_resize_q75_box.jpg deleted file mode 100644 index e7a15e1..0000000 Binary files a/public/zh-cn/p/test-chinese/helena-hertz-wWZzXlDpMog-unsplash_hu45a5e3ad5e058da6a00650ed8fd40bea_15530_480x0_resize_q75_box.jpg and /dev/null differ diff --git a/public/zh-cn/p/test-chinese/helena-hertz-wWZzXlDpMog-unsplash_hu45a5e3ad5e058da6a00650ed8fd40bea_15530_800x0_resize_q75_box.jpg b/public/zh-cn/p/test-chinese/helena-hertz-wWZzXlDpMog-unsplash_hu45a5e3ad5e058da6a00650ed8fd40bea_15530_800x0_resize_q75_box.jpg deleted file mode 100644 index f86e05d..0000000 Binary files a/public/zh-cn/p/test-chinese/helena-hertz-wWZzXlDpMog-unsplash_hu45a5e3ad5e058da6a00650ed8fd40bea_15530_800x0_resize_q75_box.jpg and /dev/null differ diff --git a/public/zh-cn/p/test-chinese/hudai-gayiran-3Od_VKcDEAA-unsplash.jpg b/public/zh-cn/p/test-chinese/hudai-gayiran-3Od_VKcDEAA-unsplash.jpg deleted file mode 100644 index 1a280b2..0000000 Binary files a/public/zh-cn/p/test-chinese/hudai-gayiran-3Od_VKcDEAA-unsplash.jpg and /dev/null differ diff --git a/public/zh-cn/p/test-chinese/hudai-gayiran-3Od_VKcDEAA-unsplash_hub241c2a9c7a2caf7e16a2a5bbc7141ff_18711_1024x0_resize_q75_box.jpg b/public/zh-cn/p/test-chinese/hudai-gayiran-3Od_VKcDEAA-unsplash_hub241c2a9c7a2caf7e16a2a5bbc7141ff_18711_1024x0_resize_q75_box.jpg deleted file mode 100644 index 811aeba..0000000 Binary files a/public/zh-cn/p/test-chinese/hudai-gayiran-3Od_VKcDEAA-unsplash_hub241c2a9c7a2caf7e16a2a5bbc7141ff_18711_1024x0_resize_q75_box.jpg and /dev/null differ diff --git a/public/zh-cn/p/test-chinese/hudai-gayiran-3Od_VKcDEAA-unsplash_hub241c2a9c7a2caf7e16a2a5bbc7141ff_18711_480x0_resize_q75_box.jpg b/public/zh-cn/p/test-chinese/hudai-gayiran-3Od_VKcDEAA-unsplash_hub241c2a9c7a2caf7e16a2a5bbc7141ff_18711_480x0_resize_q75_box.jpg deleted file mode 100644 index 4fd5f1e..0000000 Binary files a/public/zh-cn/p/test-chinese/hudai-gayiran-3Od_VKcDEAA-unsplash_hub241c2a9c7a2caf7e16a2a5bbc7141ff_18711_480x0_resize_q75_box.jpg and /dev/null differ diff --git a/public/zh-cn/p/test-chinese/index.html b/public/zh-cn/p/test-chinese/index.html deleted file mode 100644 index 0a88d76..0000000 --- a/public/zh-cn/p/test-chinese/index.html +++ /dev/null @@ -1,606 +0,0 @@ - - - - -Chinese Test - - - - - - - - - - - - - - -
- - - - -
-
-
-
- - Featured image of post Chinese Test - - -
- - -
- - - - -
-

- Chinese Test -

- - -

- 这是一个副标题 -

- -
- - - - - -
- -
- - - - - - - - - - -
- - - -
- - - - - - - - - -
- -
- - - -
- -
- -
- - -

正文测试

-

而这些并不是完全重要,更加重要的问题是, 带着这些问题,我们来审视一下学生会退会。 既然如何, 对我个人而言,学生会退会不仅仅是一个重大的事件,还可能会改变我的人生。 我们不得不面对一个非常尴尬的事实,那就是, 可是,即使是这样,学生会退会的出现仍然代表了一定的意义。 学生会退会,发生了会如何,不发生又会如何。 经过上述讨论, 生活中,若学生会退会出现了,我们就不得不考虑它出现了的事实。 学生会退会,到底应该如何实现。 这样看来, 在这种困难的抉择下,本人思来想去,寝食难安。 对我个人而言,学生会退会不仅仅是一个重大的事件,还可能会改变我的人生。 就我个人来说,学生会退会对我的意义,不能不说非常重大。 莎士比亚曾经提到过,人的一生是短的,但如果卑劣地过这一生,就太长了。这似乎解答了我的疑惑。 莫扎特说过一句富有哲理的话,谁和我一样用功,谁就会和我一样成功。这启发了我, 对我个人而言,学生会退会不仅仅是一个重大的事件,还可能会改变我的人生。 学生会退会,到底应该如何实现。 一般来说, 从这个角度来看, 这种事实对本人来说意义重大,相信对这个世界也是有一定意义的。 在这种困难的抉择下,本人思来想去,寝食难安。 了解清楚学生会退会到底是一种怎么样的存在,是解决一切问题的关键。 一般来说, 生活中,若学生会退会出现了,我们就不得不考虑它出现了的事实。 问题的关键究竟为何? 而这些并不是完全重要,更加重要的问题是。

-

奥斯特洛夫斯基曾经说过,共同的事业,共同的斗争,可以使人们产生忍受一切的力量。 带着这句话,我们还要更加慎重的审视这个问题: 一般来讲,我们都必须务必慎重的考虑考虑。 既然如此, 这种事实对本人来说意义重大,相信对这个世界也是有一定意义的。 带着这些问题,我们来审视一下学生会退会。 我认为, 我认为, 在这种困难的抉择下,本人思来想去,寝食难安。 问题的关键究竟为何? 每个人都不得不面对这些问题。 在面对这种问题时, 要想清楚,学生会退会,到底是一种怎么样的存在。 我认为, 既然如此, 每个人都不得不面对这些问题。 在面对这种问题时, 那么, 我认为, 学生会退会因何而发生。

-

引用

-
-

思念是最暖的忧伤像一双翅膀
-让我停不了飞不远在过往游荡
-不告而别的你 就算为了我着想
-这么沉痛的呵护 我怎么能翱翔

-

最暖的憂傷 - 田馥甄

-
-

图片

-

Photo by Florian Klauer on Unsplash Photo by Luca Bravo on Unsplash

-

Photo by Helena Hertz on Unsplash Photo by Hudai Gayiran on Unsplash

-
- -
-
1
-2
-3
-
-
![Photo by Florian Klauer on Unsplash](florian-klauer-nptLmg6jqDo-unsplash.jpg)  ![Photo by Luca Bravo on Unsplash](luca-bravo-alS7ewQ41M8-unsplash.jpg) 
-
-![Photo by Helena Hertz on Unsplash](helena-hertz-wWZzXlDpMog-unsplash.jpg)  ![Photo by Hudai Gayiran on Unsplash](hudai-gayiran-3Od_VKcDEAA-unsplash.jpg)
-
-
-

相册语法来自 Typlog

- -
- - -
- - - -
- - - - - - - - - Licensed under CC BY-NC-SA 4.0 -
-
- - - -
- - - - - - - - -
-
- - -comments powered by Disqus -
- - - - - - - -
- - -
- Built with Hugo
- 主题 StackJimmy 设计 -
-
- - - - - -
-
- - - - - diff --git a/public/zh-cn/p/test-chinese/luca-bravo-alS7ewQ41M8-unsplash.jpg b/public/zh-cn/p/test-chinese/luca-bravo-alS7ewQ41M8-unsplash.jpg deleted file mode 100644 index f6c90bc..0000000 Binary files a/public/zh-cn/p/test-chinese/luca-bravo-alS7ewQ41M8-unsplash.jpg and /dev/null differ diff --git a/public/zh-cn/p/test-chinese/luca-bravo-alS7ewQ41M8-unsplash_hu0a3f1163de68d0b9471979ebf0ecf11e_32400_1024x0_resize_q75_box.jpg b/public/zh-cn/p/test-chinese/luca-bravo-alS7ewQ41M8-unsplash_hu0a3f1163de68d0b9471979ebf0ecf11e_32400_1024x0_resize_q75_box.jpg deleted file mode 100644 index de8b71b..0000000 Binary files a/public/zh-cn/p/test-chinese/luca-bravo-alS7ewQ41M8-unsplash_hu0a3f1163de68d0b9471979ebf0ecf11e_32400_1024x0_resize_q75_box.jpg and /dev/null differ diff --git a/public/zh-cn/p/test-chinese/luca-bravo-alS7ewQ41M8-unsplash_hu0a3f1163de68d0b9471979ebf0ecf11e_32400_480x0_resize_q75_box.jpg b/public/zh-cn/p/test-chinese/luca-bravo-alS7ewQ41M8-unsplash_hu0a3f1163de68d0b9471979ebf0ecf11e_32400_480x0_resize_q75_box.jpg deleted file mode 100644 index 56a2f6b..0000000 Binary files a/public/zh-cn/p/test-chinese/luca-bravo-alS7ewQ41M8-unsplash_hu0a3f1163de68d0b9471979ebf0ecf11e_32400_480x0_resize_q75_box.jpg and /dev/null differ diff --git a/public/zh-cn/page/1/index.html b/public/zh-cn/page/1/index.html deleted file mode 100644 index fba73ff..0000000 --- a/public/zh-cn/page/1/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - https://srlee056.github.io/zh-cn/ - - - - - - diff --git a/public/zh-cn/page/index.html b/public/zh-cn/page/index.html deleted file mode 100644 index 9f5872a..0000000 --- a/public/zh-cn/page/index.html +++ /dev/null @@ -1,339 +0,0 @@ - - - - -Pages - - - - - - - - - - - - - -
- - - - -
-
-

- - Section - -

- -
-
-

1 page

-

Pages

- -
-
-
- -
- - - -
-
- - -
- Built with Hugo
- 主题 StackJimmy 设计 -
-
- - -
-
- - - - - diff --git a/public/zh-cn/page/index.xml b/public/zh-cn/page/index.xml deleted file mode 100644 index 88c3c20..0000000 --- a/public/zh-cn/page/index.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - Pages on 演示站点 - https://srlee056.github.io/zh-cn/page/ - Recent content in Pages on 演示站点 - Hugo -- gohugo.io - zh-cn - Seorim Lee - 关于 - https://srlee056.github.io/zh-cn/%E5%85%B3%E4%BA%8E/ - Mon, 01 Jan 0001 00:00:00 +0000 - - https://srlee056.github.io/zh-cn/%E5%85%B3%E4%BA%8E/ - <p>This is a test page for i18n support.</p> - - - - - diff --git a/public/zh-cn/page/page/1/index.html b/public/zh-cn/page/page/1/index.html deleted file mode 100644 index 0b4b261..0000000 --- a/public/zh-cn/page/page/1/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - https://srlee056.github.io/zh-cn/page/ - - - - - - diff --git a/public/zh-cn/post/index.html b/public/zh-cn/post/index.html deleted file mode 100644 index 42bb3d0..0000000 --- a/public/zh-cn/post/index.html +++ /dev/null @@ -1,348 +0,0 @@ - - - - -Posts - - - - - - - - - - - - - -
- - - - -
-
-

- - Section - -

- -
-
-

1 page

-

Posts

- -
-
-
- -
- - - -
-
- - -
- Built with Hugo
- 主题 StackJimmy 设计 -
-
- - -
-
- - - - - diff --git a/public/zh-cn/post/index.xml b/public/zh-cn/post/index.xml deleted file mode 100644 index 4061361..0000000 --- a/public/zh-cn/post/index.xml +++ /dev/null @@ -1,101 +0,0 @@ - - - - Posts on 演示站点 - https://srlee056.github.io/zh-cn/post/ - Recent content in Posts on 演示站点 - Hugo -- gohugo.io - zh-cn - Seorim Lee - Wed, 09 Sep 2020 00:00:00 +0000 - Chinese Test - https://srlee056.github.io/zh-cn/p/test-chinese/ - Wed, 09 Sep 2020 00:00:00 +0000 - - https://srlee056.github.io/zh-cn/p/test-chinese/ - <img src="https://srlee056.github.io/zh-cn/p/test-chinese/helena-hertz-wWZzXlDpMog-unsplash.jpg" alt="Featured image of post Chinese Test" /><h2 id="正文测试">正文测试</h2> -<p>而这些并不是完全重要,更加重要的问题是, 带着这些问题,我们来审视一下学生会退会。 既然如何, 对我个人而言,学生会退会不仅仅是一个重大的事件,还可能会改变我的人生。 我们不得不面对一个非常尴尬的事实,那就是, 可是,即使是这样,学生会退会的出现仍然代表了一定的意义。 学生会退会,发生了会如何,不发生又会如何。 经过上述讨论, 生活中,若学生会退会出现了,我们就不得不考虑它出现了的事实。 学生会退会,到底应该如何实现。 这样看来, 在这种困难的抉择下,本人思来想去,寝食难安。 对我个人而言,学生会退会不仅仅是一个重大的事件,还可能会改变我的人生。 就我个人来说,学生会退会对我的意义,不能不说非常重大。 莎士比亚曾经提到过,人的一生是短的,但如果卑劣地过这一生,就太长了。这似乎解答了我的疑惑。 莫扎特说过一句富有哲理的话,谁和我一样用功,谁就会和我一样成功。这启发了我, 对我个人而言,学生会退会不仅仅是一个重大的事件,还可能会改变我的人生。 学生会退会,到底应该如何实现。 一般来说, 从这个角度来看, 这种事实对本人来说意义重大,相信对这个世界也是有一定意义的。 在这种困难的抉择下,本人思来想去,寝食难安。 了解清楚学生会退会到底是一种怎么样的存在,是解决一切问题的关键。 一般来说, 生活中,若学生会退会出现了,我们就不得不考虑它出现了的事实。 问题的关键究竟为何? 而这些并不是完全重要,更加重要的问题是。</p> -<p>奥斯特洛夫斯基曾经说过,共同的事业,共同的斗争,可以使人们产生忍受一切的力量。 带着这句话,我们还要更加慎重的审视这个问题: 一般来讲,我们都必须务必慎重的考虑考虑。 既然如此, 这种事实对本人来说意义重大,相信对这个世界也是有一定意义的。 带着这些问题,我们来审视一下学生会退会。 我认为, 我认为, 在这种困难的抉择下,本人思来想去,寝食难安。 问题的关键究竟为何? 每个人都不得不面对这些问题。 在面对这种问题时, 要想清楚,学生会退会,到底是一种怎么样的存在。 我认为, 既然如此, 每个人都不得不面对这些问题。 在面对这种问题时, 那么, 我认为, 学生会退会因何而发生。</p> -<h2 id="引用">引用</h2> -<blockquote> -<p>思念是最暖的忧伤像一双翅膀<br> -让我停不了飞不远在过往游荡<br> -不告而别的你 就算为了我着想<br> -这么沉痛的呵护 我怎么能翱翔</p> -<p><em><a class="link" href="https://www.youtube.com/watch?v=3aypp_YlBzI" target="_blank" rel="noopener" - >最暖的憂傷 - 田馥甄</a></em></p> -</blockquote> -<h2 id="图片">图片</h2> -<p><img src="https://srlee056.github.io/zh-cn/p/test-chinese/florian-klauer-nptLmg6jqDo-unsplash.jpg" - width="667" - height="1000" - srcset="https://srlee056.github.io/zh-cn/p/test-chinese/florian-klauer-nptLmg6jqDo-unsplash_hu595aaf3b3dbbb41af5aed8d3958cc9f9_13854_480x0_resize_q75_box.jpg 480w, https://srlee056.github.io/zh-cn/p/test-chinese/florian-klauer-nptLmg6jqDo-unsplash_hu595aaf3b3dbbb41af5aed8d3958cc9f9_13854_1024x0_resize_q75_box.jpg 1024w" - loading="lazy" - - alt="Photo by Florian Klauer on Unsplash" - - - class="gallery-image" - data-flex-grow="66" - data-flex-basis="160px" - -> <img src="https://srlee056.github.io/zh-cn/p/test-chinese/luca-bravo-alS7ewQ41M8-unsplash.jpg" - width="1000" - height="667" - srcset="https://srlee056.github.io/zh-cn/p/test-chinese/luca-bravo-alS7ewQ41M8-unsplash_hu0a3f1163de68d0b9471979ebf0ecf11e_32400_480x0_resize_q75_box.jpg 480w, https://srlee056.github.io/zh-cn/p/test-chinese/luca-bravo-alS7ewQ41M8-unsplash_hu0a3f1163de68d0b9471979ebf0ecf11e_32400_1024x0_resize_q75_box.jpg 1024w" - loading="lazy" - - alt="Photo by Luca Bravo on Unsplash" - - - class="gallery-image" - data-flex-grow="149" - data-flex-basis="359px" - -></p> -<p><img src="https://srlee056.github.io/zh-cn/p/test-chinese/helena-hertz-wWZzXlDpMog-unsplash.jpg" - width="1000" - height="750" - srcset="https://srlee056.github.io/zh-cn/p/test-chinese/helena-hertz-wWZzXlDpMog-unsplash_hu45a5e3ad5e058da6a00650ed8fd40bea_15530_480x0_resize_q75_box.jpg 480w, https://srlee056.github.io/zh-cn/p/test-chinese/helena-hertz-wWZzXlDpMog-unsplash_hu45a5e3ad5e058da6a00650ed8fd40bea_15530_1024x0_resize_q75_box.jpg 1024w" - loading="lazy" - - alt="Photo by Helena Hertz on Unsplash" - - - class="gallery-image" - data-flex-grow="133" - data-flex-basis="320px" - -> <img src="https://srlee056.github.io/zh-cn/p/test-chinese/hudai-gayiran-3Od_VKcDEAA-unsplash.jpg" - width="667" - height="1000" - srcset="https://srlee056.github.io/zh-cn/p/test-chinese/hudai-gayiran-3Od_VKcDEAA-unsplash_hub241c2a9c7a2caf7e16a2a5bbc7141ff_18711_480x0_resize_q75_box.jpg 480w, https://srlee056.github.io/zh-cn/p/test-chinese/hudai-gayiran-3Od_VKcDEAA-unsplash_hub241c2a9c7a2caf7e16a2a5bbc7141ff_18711_1024x0_resize_q75_box.jpg 1024w" - loading="lazy" - - alt="Photo by Hudai Gayiran on Unsplash" - - - class="gallery-image" - data-flex-grow="66" - data-flex-basis="160px" - -></p> -<div class="highlight"><div class="chroma"> -<table class="lntable"><tr><td class="lntd"> -<pre tabindex="0" class="chroma"><code><span class="lnt">1 -</span><span class="lnt">2 -</span><span class="lnt">3 -</span></code></pre></td> -<td class="lntd"> -<pre tabindex="0" class="chroma"><code class="language-markdown" data-lang="markdown"><span class="line"><span class="cl">![<span class="nt">Photo by Florian Klauer on Unsplash</span>](<span class="na">florian-klauer-nptLmg6jqDo-unsplash.jpg</span>) ![<span class="nt">Photo by Luca Bravo on Unsplash</span>](<span class="na">luca-bravo-alS7ewQ41M8-unsplash.jpg</span>) -</span></span><span class="line"><span class="cl"> -</span></span><span class="line"><span class="cl">![<span class="nt">Photo by Helena Hertz on Unsplash</span>](<span class="na">helena-hertz-wWZzXlDpMog-unsplash.jpg</span>) ![<span class="nt">Photo by Hudai Gayiran on Unsplash</span>](<span class="na">hudai-gayiran-3Od_VKcDEAA-unsplash.jpg</span>) -</span></span></code></pre></td></tr></table> -</div> -</div><p>相册语法来自 <a class="link" href="https://typlog.com/" target="_blank" rel="noopener" - >Typlog</a></p> - - - - - diff --git a/public/zh-cn/post/page/1/index.html b/public/zh-cn/post/page/1/index.html deleted file mode 100644 index 220982d..0000000 --- a/public/zh-cn/post/page/1/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - https://srlee056.github.io/zh-cn/post/ - - - - - - diff --git a/public/zh-cn/sitemap.xml b/public/zh-cn/sitemap.xml deleted file mode 100644 index b4c677f..0000000 --- a/public/zh-cn/sitemap.xml +++ /dev/null @@ -1,134 +0,0 @@ - - - - https://srlee056.github.io/zh-cn/ - 2020-09-09T00:00:00+00:00 - - - - - - https://srlee056.github.io/zh-cn/categories/ - 2020-09-09T00:00:00+00:00 - - - - - - https://srlee056.github.io/zh-cn/p/test-chinese/ - 2020-09-09T00:00:00+00:00 - - https://srlee056.github.io/zh-cn/post/ - 2020-09-09T00:00:00+00:00 - - - - - https://srlee056.github.io/zh-cn/categories/test/ - 2020-09-09T00:00:00+00:00 - - - - https://srlee056.github.io/zh-cn/categories/%E6%B5%8B%E8%AF%95/ - 2020-09-09T00:00:00+00:00 - - https://srlee056.github.io/zh-cn/page/ - - - - https://srlee056.github.io/zh-cn/tags/ - - - - - - https://srlee056.github.io/zh-cn/%E5%85%B3%E4%BA%8E/ - - - - diff --git a/public/zh-cn/tags/index.html b/public/zh-cn/tags/index.html deleted file mode 100644 index 880fd34..0000000 --- a/public/zh-cn/tags/index.html +++ /dev/null @@ -1,329 +0,0 @@ - - - - -Tags - - - - - - - - - - - - - -
- - - - -
-
-

- - Section - -

- -
-
-

0 pages

-

Tags

- -
-
-
- - -
- -
-
- - -
- Built with Hugo
- 主题 StackJimmy 设计 -
-
- - -
-
- - - - - diff --git a/public/zh-cn/tags/index.xml b/public/zh-cn/tags/index.xml deleted file mode 100644 index bcc34a8..0000000 --- a/public/zh-cn/tags/index.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - Tags on 演示站点 - https://srlee056.github.io/zh-cn/tags/ - Recent content in Tags on 演示站点 - Hugo -- gohugo.io - zh-cn - Seorim Lee - - diff --git a/public/zh-cn/tags/page/1/index.html b/public/zh-cn/tags/page/1/index.html deleted file mode 100644 index aa005dc..0000000 --- a/public/zh-cn/tags/page/1/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - https://srlee056.github.io/zh-cn/tags/ - - - - - - diff --git "a/public/zh-cn/\345\205\263\344\272\216/index.html" "b/public/zh-cn/\345\205\263\344\272\216/index.html" deleted file mode 100644 index 02c402d..0000000 --- "a/public/zh-cn/\345\205\263\344\272\216/index.html" +++ /dev/null @@ -1,470 +0,0 @@ - - - - -关于 - - - - - - - - - - - - - -
- - - -
-
-
- -
- - -
-

- 关于 -

- - -
- - - - - -
- - - -
- - - - - - - - - -
- -
- - - -
- - - - - - - - - - - -
- - English - -
-
- -
- -
- -
- - -

This is a test page for i18n support.

- -
- - -
- - - -
- - - - - - - - - Licensed under CC BY-NC-SA 4.0 -
-
- - - -
- - - - - - - - -
-
- - -comments powered by Disqus -
- - - - - - - -
- - -
- Built with Hugo
- 主题 StackJimmy 设计 -
-
- - - - - -
-
- - - - - diff --git a/resources/_gen/images/avatar_hu8ddc8f6dcd4c226f91e5ab7aaf623fd6_118700_300x0_resize_box_3.png b/resources/_gen/images/avatar_hu8ddc8f6dcd4c226f91e5ab7aaf623fd6_118700_300x0_resize_box_3.png new file mode 100644 index 0000000..49c45a9 Binary files /dev/null and b/resources/_gen/images/avatar_hu8ddc8f6dcd4c226f91e5ab7aaf623fd6_118700_300x0_resize_box_3.png differ diff --git a/resources/_gen/images/categories/Test/_hu8102ac0a5989befdf52fa5096a373f78_52927_ba0b8e744b36f1e48b9c54b5d2847004.jpg b/resources/_gen/images/categories/Test/_hu8102ac0a5989befdf52fa5096a373f78_52927_ba0b8e744b36f1e48b9c54b5d2847004.jpg new file mode 100644 index 0000000..abeee55 Binary files /dev/null and b/resources/_gen/images/categories/Test/_hu8102ac0a5989befdf52fa5096a373f78_52927_ba0b8e744b36f1e48b9c54b5d2847004.jpg differ diff --git a/resources/_gen/images/categories/Test/hutomo-abrianto-l2jk-uxb1BY-unsplash_hu8102ac0a5989befdf52fa5096a373f78_52927_120x120_fill_q75_box_smart1.jpg b/resources/_gen/images/categories/Test/hutomo-abrianto-l2jk-uxb1BY-unsplash_hu8102ac0a5989befdf52fa5096a373f78_52927_120x120_fill_q75_box_smart1.jpg new file mode 100644 index 0000000..1c73a8a Binary files /dev/null and b/resources/_gen/images/categories/Test/hutomo-abrianto-l2jk-uxb1BY-unsplash_hu8102ac0a5989befdf52fa5096a373f78_52927_120x120_fill_q75_box_smart1.jpg differ