From 8e1a7d35f1543fcc6157908ebd8eea74700553e4 Mon Sep 17 00:00:00 2001 From: minlu21 Date: Thu, 27 Jun 2024 21:01:30 +0800 Subject: [PATCH] made changes to css --- public/categories/index.html | 48 ++++ public/categories/index.xml | 11 + public/categories/page/1/index.html | 10 + public/css/cv.css | 57 +++++ public/css/projects.css | 30 +++ public/css/reset.css | 67 ++++++ public/css/single-container.css | 127 +++++++++++ public/css/styles.css | 149 +++++++++++++ public/cv/index.html | 206 ++++++++++++++++++ public/favicon.ico | Bin 0 -> 15406 bytes public/index.html | 55 +++++ public/index.xml | 26 +++ public/js/main.js | 4 + public/sitemap.xml | 25 +++ public/tags/bst/index.html | 50 +++++ public/tags/bst/index.xml | 19 ++ public/tags/bst/page/1/index.html | 10 + public/tags/index.html | 50 +++++ public/tags/index.xml | 19 ++ public/tags/page/1/index.html | 10 + public/writeups/index.html | 50 +++++ public/writeups/index.xml | 19 ++ public/writeups/page/1/index.html | 10 + public/writeups/wr1/index.html | 126 +++++++++++ .../basic/archetypes/{lc.md => writeups.md} | 0 themes/basic/assets/css/single-container.css | 35 ++- 26 files changed, 1209 insertions(+), 4 deletions(-) create mode 100644 public/categories/index.html create mode 100644 public/categories/index.xml create mode 100644 public/categories/page/1/index.html create mode 100644 public/css/cv.css create mode 100644 public/css/projects.css create mode 100644 public/css/reset.css create mode 100644 public/css/single-container.css create mode 100644 public/css/styles.css create mode 100644 public/cv/index.html create mode 100644 public/favicon.ico create mode 100644 public/index.html create mode 100644 public/index.xml create mode 100644 public/js/main.js create mode 100644 public/sitemap.xml create mode 100644 public/tags/bst/index.html create mode 100644 public/tags/bst/index.xml create mode 100644 public/tags/bst/page/1/index.html create mode 100644 public/tags/index.html create mode 100644 public/tags/index.xml create mode 100644 public/tags/page/1/index.html create mode 100644 public/writeups/index.html create mode 100644 public/writeups/index.xml create mode 100644 public/writeups/page/1/index.html create mode 100644 public/writeups/wr1/index.html rename themes/basic/archetypes/{lc.md => writeups.md} (100%) diff --git a/public/categories/index.html b/public/categories/index.html new file mode 100644 index 0000000..89b3542 --- /dev/null +++ b/public/categories/index.html @@ -0,0 +1,48 @@ + + + + + + +Categories | Min Lu + + + + + + + + + + + + + + +
+
+ +

Categories

+ + + +
+
+ + + + + \ No newline at end of file diff --git a/public/categories/index.xml b/public/categories/index.xml new file mode 100644 index 0000000..3f4a6ac --- /dev/null +++ b/public/categories/index.xml @@ -0,0 +1,11 @@ + + + + Categories on Min Lu + //localhost:1313/categories/ + Recent content in Categories on Min Lu + Hugo + en-us + + + diff --git a/public/categories/page/1/index.html b/public/categories/page/1/index.html new file mode 100644 index 0000000..d14e27f --- /dev/null +++ b/public/categories/page/1/index.html @@ -0,0 +1,10 @@ + + + + //localhost:1313/categories/ + + + + + + diff --git a/public/css/cv.css b/public/css/cv.css new file mode 100644 index 0000000..f438497 --- /dev/null +++ b/public/css/cv.css @@ -0,0 +1,57 @@ +.cv-container>h1 { + font-size: 24px; + margin-bottom: 1%; + border-bottom: 1px solid black; +} + +.cv-container>section { + margin-bottom: 2%; +} + +.cv-container>section>h3 { + font-weight: 100; + text-decoration: underline; + margin-bottom: -1%; +} + +.cv-container>section>ul>li { + font-size: 14px; +} + +table, +.table th, +.table td { + width: 100%; + text-align: left; + padding: 0; + margin: -0.25%; +} + +table { + margin-top: 1%; +} + +th.first { + padding: 0; + margin: 0; +} + +td.first { + color: green; + padding: 0; + margin: 0; + font-size: 14px; +} + +th.second { + text-align: right; + margin: 0; + padding: 0; +} + +td.second { + padding: 0; + margin: 0; + text-align: right; + font-size: 14px; +} \ No newline at end of file diff --git a/public/css/projects.css b/public/css/projects.css new file mode 100644 index 0000000..e1e84a9 --- /dev/null +++ b/public/css/projects.css @@ -0,0 +1,30 @@ +.proj-list-section { + padding: 1% 0; + margin: 0; +} + +.proj-list-section>h2>a { + text-decoration: none; + color: black; + font-weight: 500; + font-size: 18px; +} + +.proj-list-section>h2>a:hover { + color: green; +} + +.proj-desc { + display: flex; + flex-direction: horizontal; + justify-content: space-between; +} + +.proj-desc>p { + width: 75%; +} + +.proj-desc>img { + width: 25%; + text-align: right; +} \ No newline at end of file diff --git a/public/css/reset.css b/public/css/reset.css new file mode 100644 index 0000000..f496e7c --- /dev/null +++ b/public/css/reset.css @@ -0,0 +1,67 @@ +/* body { + color: #222; + font-family: sans-serif; + line-height: 1.5; + margin: 1rem; + max-width: 768px; +} + +header { + border-bottom: 1px solid #222; + margin-bottom: 1rem; +} + +footer { + border-top: 1px solid #222; + margin-top: 1rem; +} + +a { + color: #00e; + text-decoration: none; +} */ + +*, +*::before, +*::after { + box-sizing: border-box; +} + +html { + height: 100%; +} + +* { + margin: 0; +} + +body { + line-height: 1.5; + -webkit-font-smoothing: antialiased; +} + +img, +picture, +video, +canvas, +svg { + display: block; + max-width: 100%; +} + +input, +button, +textarea, +select { + font: inherit; +} + +p, +h1, +h2, +h3, +h4, +h5, +h6 { + overflow-wrap: break-word; +} \ No newline at end of file diff --git a/public/css/single-container.css b/public/css/single-container.css new file mode 100644 index 0000000..5213454 --- /dev/null +++ b/public/css/single-container.css @@ -0,0 +1,127 @@ +.single-container>h2 { + color: green; + padding-top: 1%; + /* padding-bottom: 0.5px; */ + border-bottom: 1px solid green; +} + +.single-container>h3, +.single-container>h4, +.single-container>h5, +.single-container>h6 { + color: lightslategray; + padding-top: 1%; +} + +.single-container>h4, +.single-container>h5, +.single-container>h6 { + font-weight: 500; +} + +.single-container>p { + margin-top: 1%; + margin-bottom: 1%; +} + +.highlight { + width: inherit; + margin: 0; + padding: 0; +} + +.highlight>pre { + width: 90%; + padding: 5px; + margin: 0 auto; +} + +.highlight>pre>code>span>span { + width: inherit; + text-wrap: wrap; +} + +.single-container>div { + margin-top: 2.5%; +} + +.single-container>div { + display: flex; + flex-direction: horizontal; +} + +.single-container>div>div { + font-weight: bold; +} + +.single-container>div>ul { + margin-left: 1%; + padding: 0; + width: 100%; +} + +.single-container>div>ul>li { + display: inline-block; + padding: 0 0.5%; +} + +.single-container>div>ul>li>a { + background-color: rgb(203, 210, 216); + text-decoration: none; + color: black; + border-radius: 15%; + padding: 0 5px; +} + +.single-container>div>ul>li>a:hover { + color: green; + background-color: rgb(233, 232, 232); +} + +#TableOfContents { + margin-left: 20px; +} + +.toc { + color: gray; + margin-top: 1%; + font-weight: lighter; +} + +#TableOfContents>ul>li, +#TableOfContents>ul>li>ul>li { + list-style-type: none; + padding: 0; + margin: 0; +} + +#TableOfContents>ul { + margin: 0; + padding: 0; +} + +#TableOfContents>ul>li>ul { + padding: 0 5px; + margin-left: 5px; + border-left: 1px solid gray; +} + +#TableOfContents>ul>li>a, +#TableOfContents>ul>li>ul>li>a { + text-decoration: none; +} + +#TableOfContents>ul>li>a { + color: black; + font-size: 16px; +} + +#TableOfContents>ul>li>ul>li>a { + color: gray; + font-size: 14px; +} + +#TableOfContents>ul>li>a:hover, +#TableOfContents>ul>li>ul>li>a:hover { + color: green; +} \ No newline at end of file diff --git a/public/css/styles.css b/public/css/styles.css new file mode 100644 index 0000000..0a0ca36 --- /dev/null +++ b/public/css/styles.css @@ -0,0 +1,149 @@ +body { + color: #222; + font-family: sans-serif; + display: block; + /* flex-direction: column; + align-items: center; + justify-content: center; */ + height: 100vh; + width: 100vw; + font-size: 14px; + position: absolute; +} + +.navbar { + /* position: fixed; */ + /* margin-top: -2.5%; */ + /* position: relative; */ + margin: auto; + margin-top: 7.5%; + margin-bottom: 1%; + width: 60vw; + /* height: 12%; */ + /* position: relative; */ + border-bottom: 1px solid black; + +} + +.container { + width: 60vw; + height: 50vh; + /* margin-top: 5%; */ + margin: auto; + overflow: auto; + flex-direction: column; + display: flex; + /* position: relative; */ +} + + +header { + /* margin-bottom: 1%; */ + /* position: relative; */ +} + +header>h1 { + font-size: 32px; +} + +header>h1>a { + text-decoration: none; + color: black; + font-weight: 100; +} + +header>h1>a:hover { + color: green; + text-shadow: 2px 2px 8px lightgreen; +} + +nav { + display: flex; + flex-direction: horizontal; + justify-content: space-between; + margin-bottom: 1%; + /* position: relative; */ +} + +@media only screen and (max-width: 768px) { + nav { + flex-direction: column; + } +} + +nav>a { + text-decoration: none; + margin: 0; + padding: 0; + color: slategray; +} + +nav>a:hover { + color: green; + /* border-bottom: 1px solid green; */ + padding: 0; + margin: 0; + text-shadow: 2px 2px 8px lightgreen; +} + +main { + height: 100%; + /* position: relative; */ + +} + +main>h1 { + font-size: 24px; + margin-bottom: 1%; + border-bottom: 1px solid black; +} + +main>h2 { + font-size: 18px; + color: black; + text-decoration: none; +} + +main>h2>a { + text-decoration: none; + font-weight: lighter; + color: black; +} + +main>h2>a:hover { + color: green; +} + +footer { + font-size: small; + text-align: right; + color: lightslategray; + margin: auto; + width: 60vw; +} + +.single-container { + overflow: auto; + height: 100%; +} + +.cv-container { + overflow: auto; + height: 100%; + padding: 0; +} + +.contacts { + display: flex; + flex-direction: row; + align-items: center; + margin: auto; + margin-top: 2.5%; + padding: 0; + justify-content: space-between; + width: 50%; +} + +.contacts>li { + list-style-type: none; +} \ No newline at end of file diff --git a/public/cv/index.html b/public/cv/index.html new file mode 100644 index 0000000..bc625ab --- /dev/null +++ b/public/cv/index.html @@ -0,0 +1,206 @@ + + + + + + +Curriculum vitae | Min Lu + + + + + + + + + + + + + + +
+
+ +
+

Curriculum vitae

+
+

Education

+ + + + + + + + + + +
Georgia Institute of TechnologyAtlanta, GA
M.S. in Computer Science (GPA: n/a)Expected: May 2026
+
    +
  • Coursework: n/a
  • +
+ + + + + + + + + + +
Purdue UniversityWest Lafayette, IN
B.S. in Computer Science, Mathematics, and Statistics (GPA: 3.94/4.00)Aug. 2020-May 2024
+
    +
  • Coursework: Compilers; Operating Systems; Systems Programming; Computer Architecture; Programming Languages; Databases; Algorithms; Machine Learning; Artificial Intelligence
  • +
+ +
+ +
+

Research Experience

+ + + + + + + + + + +
Kihara Lab, Purdue UniversityWest Lafayette, IN
Undergraduate Research AssistantOct. 2022-Dec. 2023
+
    + +
  • Investigated correlations between 3D Zernike moments and protein pair RMSDs using molecular simulations.
  • + +
+ + + + + + + + + + +
Sustainable Computing Laboratory, University of Notre DameNotre Dame, IN
Undergraduate Research AssistantJun. 2023-Aug. 2023
+
    + +
  • Conducted literature review on pruning algorithms to improve neural network fairness.
  • + +
  • Implemented pruning algorithms using PyTorch to improve convolutional neural network fairness.
  • + +
+ + + + + + + + + + +
Democracy in Plain Sight Lab, Purdue UniversityWest Lafayette, IN
Undergraduate Research AssistantMay 2022-Aug. 2022
+
    + +
  • Implemented an automated data collection pipeline with the JavaScript Puppeteer library to collect over 80000 entries of Peru's voting data and ballot images.
  • + +
+ +
+ +
+

Work Experience

+ + + + + + + + + + +
Advanced Semiconductor EngineeringChungli, TW
IT InternJun. 2024-Aug.2024
+
    + +
+ + + + + + + + + + +
Purdue UniversityWest Lafayette, IN
Undergraduate Teaching AssistantOct. 2022-Dec. 2023
+
    + +
  • Department of Computer Science: C Programming; Systems Programming
  • + +
  • The Data Mine/Ford Corporate Project: Project lead for researching the effect of a dataset's reliability coefficient and the performance of NLP models.
  • + +
+ + + + + + + + + + +
DeloitteTaipei, TW
Risk Advisory InternJun. 2022-Aug. 2022
+
    + +
+ +
+ +
+

Skills

+ + + + +
Programming + C++, C, Python, Java, JavaScript, SQL, MongoDB, Rust, Haskell +
+ + + + +
Languages + English, Chinese +
+ +
+
+ + +
+
+ + + + + \ No newline at end of file diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..67f8b777851849527933b78b1f98bd564d8255d1 GIT binary patch literal 15406 zcmeI3%WEH16vro|f`O{FV5Nc>unpZA42Xe(zeP4Fn0Fu>#YKe(c41L;qszMJ-bXDi z>L1W57+rSdLS5OG#!V^IKxvbj6n@gC#QOREdT$vg^US^Tf(#t)%-r+%o^#KA&hHll zeL;V)Z(l$;7%c7yg4co|7#w``eB{|6_?CCW!=`>H2!44k2#&ym2ojIpQ{=j)r>9?; zot^z+et!PXxw*M}BHinq>XMXKboc`~d=&+uPNklCgSOc%pC zkdxhQd};55Lm1#0hSD%6>D`)|ni^JI((I(w8QJADo{YL>VsSr%Ckg*U$-2s8+X=sG z{FIYm*irl0d{!y{D{f@u4p-n@#^$z+5S`e?RJu8p?Lq>0x`@}vIu7kfT z8Od5bMN4D{&~ch_$NgBcM#n%A`@~N^|ABlif3x_ci!t%#JQ&cWarai1&Z6~TkWOa9 zw}_GQ!9UZ~o(wFidYcy6DoF0rq<yz2-5e zTyl`ty!pUE-U+vC*KNN6@vklal>5+`8rxs}uh#LW?(tW105Q;7(Wx&Lm6uJ~)`e`X z^RF;~r?T~jY{_Q$A_iJ-m%jcoHny$5gr&~)r;P=1C}sVP-puv4#i0EM{FfkKed1Em zy4%`}me{Us{}sjpj#~DgVGO#rYen+cu9FI~=yTd>3AzfcLA`SnbFXu|pT#pXGc&>2(2!(N+83v|%y-!B zH|JI#fb9Zw1NxWuxyA*n7Wlp875YYr(Gs{zKTE)l_AX1Q6wmo%>|9k+6aP<2dk>lant}U*_E8rG3D-5uK;;yPx-8W%=Kfda!;c%(fl0 ze&XHrrr^uM0oGf>Z1DFnHhqLl>1%^5TzTuk|3H|*ul4(0o-gE;Z3>^kyq|VB2&R>$ z;3|M)g|TQza{|6pwl*t(FLk^UW^(9F%1?ditXdD)PeI>TZP%AQuxqb<#h1RS^?+T! z8Ck2^t}lCF{~KLC_TZ^~%@^LN9`I|g*;@RHecST~{FkHc(w1kiUj^&=w&0Dy`6E8G zdj4Yla1TF#N4vKWh(zA3A5dm)G|O@NEjS_AkOu zAJA`duQdQy-kiND%)+h<+}gi?*&_V<{_uGJE+68oBmMcH-Rl|t`yCgB%e&5Zsqq=>yyS- z+H#S&ls3nqdmTC0`~O|AJhXPJKi1jW{{U!5hztM# literal 0 HcmV?d00001 diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..47411cd --- /dev/null +++ b/public/index.html @@ -0,0 +1,55 @@ + + + + + + + +Min Lu + + + + + + + + + + + + + + +
+
+ +

My name is Min Lu. I am currently a Masters student studying Computer Science at Georgia Tech. Previously I was a Bachelors student studying Computer Science at Purdue University. I can be contacted using the following channels.

+ + + +
+
+
+

Copyright 2024. All rights reserved.

+ +
+ + + + \ No newline at end of file diff --git a/public/index.xml b/public/index.xml new file mode 100644 index 0000000..5571069 --- /dev/null +++ b/public/index.xml @@ -0,0 +1,26 @@ + + + + Home on Min Lu + //localhost:1313/ + Recent content in Home on Min Lu + Hugo + en-us + Thu, 27 Jun 2024 07:56:53 +0800 + + + LeetCode Daily Question: #1382 + //localhost:1313/writeups/wr1/ + Thu, 27 Jun 2024 07:56:53 +0800 + //localhost:1313/writeups/wr1/ + Problem Given the root of a BST, return a balanced BST with the same node values. If there is more than one answer, return any of them. Key Takeaways An inorder traversal of a BST returns a list of sorted values. Whenever recursing using indices, make sure to check if the start index ever exceeds the end index as a base case. Calculate the midpoint between two indices as (start + (end - start) / 2). + + + Curriculum vitae + //localhost:1313/cv/ + Tue, 25 Jun 2024 09:31:37 +0800 + //localhost:1313/cv/ + + + + diff --git a/public/js/main.js b/public/js/main.js new file mode 100644 index 0000000..dd7dc87 --- /dev/null +++ b/public/js/main.js @@ -0,0 +1,4 @@ +(() => { + // + console.log("This site was generated by Hugo."); +})(); diff --git a/public/sitemap.xml b/public/sitemap.xml new file mode 100644 index 0000000..0befb3a --- /dev/null +++ b/public/sitemap.xml @@ -0,0 +1,25 @@ + + + + //localhost:1313/tags/bst/ + 2024-06-27T07:56:53+08:00 + + //localhost:1313/ + 2024-06-27T07:56:53+08:00 + + //localhost:1313/writeups/wr1/ + 2024-06-27T07:56:53+08:00 + + //localhost:1313/tags/ + 2024-06-27T07:56:53+08:00 + + //localhost:1313/writeups/ + 2024-06-27T07:56:53+08:00 + + //localhost:1313/cv/ + 2024-06-25T09:31:37+08:00 + + //localhost:1313/categories/ + + diff --git a/public/tags/bst/index.html b/public/tags/bst/index.html new file mode 100644 index 0000000..eba024f --- /dev/null +++ b/public/tags/bst/index.html @@ -0,0 +1,50 @@ + + + + + + +Bst | Min Lu + + + + + + + + + + + + + + +
+
+ +

Bst

+ + +

LeetCode Daily Question: #1382

+ + +
+
+
+

Copyright 2024. All rights reserved.

+ +
+ + + + \ No newline at end of file diff --git a/public/tags/bst/index.xml b/public/tags/bst/index.xml new file mode 100644 index 0000000..ae63fbf --- /dev/null +++ b/public/tags/bst/index.xml @@ -0,0 +1,19 @@ + + + + Bst on Min Lu + //localhost:1313/tags/bst/ + Recent content in Bst on Min Lu + Hugo + en-us + Thu, 27 Jun 2024 07:56:53 +0800 + + + LeetCode Daily Question: #1382 + //localhost:1313/writeups/wr1/ + Thu, 27 Jun 2024 07:56:53 +0800 + //localhost:1313/writeups/wr1/ + Problem Given the root of a BST, return a balanced BST with the same node values. If there is more than one answer, return any of them. Key Takeaways An inorder traversal of a BST returns a list of sorted values. Whenever recursing using indices, make sure to check if the start index ever exceeds the end index as a base case. Calculate the midpoint between two indices as (start + (end - start) / 2). + + + diff --git a/public/tags/bst/page/1/index.html b/public/tags/bst/page/1/index.html new file mode 100644 index 0000000..84e092c --- /dev/null +++ b/public/tags/bst/page/1/index.html @@ -0,0 +1,10 @@ + + + + //localhost:1313/tags/bst/ + + + + + + diff --git a/public/tags/index.html b/public/tags/index.html new file mode 100644 index 0000000..8ac8998 --- /dev/null +++ b/public/tags/index.html @@ -0,0 +1,50 @@ + + + + + + +Tags | Min Lu + + + + + + + + + + + + + + +
+
+ +

Tags

+ + +

Bst

+ + +
+
+
+

Copyright 2024. All rights reserved.

+ +
+ + + + \ No newline at end of file diff --git a/public/tags/index.xml b/public/tags/index.xml new file mode 100644 index 0000000..0f037a1 --- /dev/null +++ b/public/tags/index.xml @@ -0,0 +1,19 @@ + + + + Tags on Min Lu + //localhost:1313/tags/ + Recent content in Tags on Min Lu + Hugo + en-us + Thu, 27 Jun 2024 07:56:53 +0800 + + + Bst + //localhost:1313/tags/bst/ + Mon, 01 Jan 0001 00:00:00 +0000 + //localhost:1313/tags/bst/ + + + + diff --git a/public/tags/page/1/index.html b/public/tags/page/1/index.html new file mode 100644 index 0000000..8771809 --- /dev/null +++ b/public/tags/page/1/index.html @@ -0,0 +1,10 @@ + + + + //localhost:1313/tags/ + + + + + + diff --git a/public/writeups/index.html b/public/writeups/index.html new file mode 100644 index 0000000..d5190db --- /dev/null +++ b/public/writeups/index.html @@ -0,0 +1,50 @@ + + + + + + +Writeups | Min Lu + + + + + + + + + + + + + + +
+
+ +

Writeups

+ + +

LeetCode Daily Question: #1382

+ + +
+
+
+

Copyright 2024. All rights reserved.

+ +
+ + + + \ No newline at end of file diff --git a/public/writeups/index.xml b/public/writeups/index.xml new file mode 100644 index 0000000..1e250b9 --- /dev/null +++ b/public/writeups/index.xml @@ -0,0 +1,19 @@ + + + + Writeups on Min Lu + //localhost:1313/writeups/ + Recent content in Writeups on Min Lu + Hugo + en-us + Thu, 27 Jun 2024 07:56:53 +0800 + + + LeetCode Daily Question: #1382 + //localhost:1313/writeups/wr1/ + Thu, 27 Jun 2024 07:56:53 +0800 + //localhost:1313/writeups/wr1/ + Problem Given the root of a BST, return a balanced BST with the same node values. If there is more than one answer, return any of them. Key Takeaways An inorder traversal of a BST returns a list of sorted values. Whenever recursing using indices, make sure to check if the start index ever exceeds the end index as a base case. Calculate the midpoint between two indices as (start + (end - start) / 2). + + + diff --git a/public/writeups/page/1/index.html b/public/writeups/page/1/index.html new file mode 100644 index 0000000..e3b6b1a --- /dev/null +++ b/public/writeups/page/1/index.html @@ -0,0 +1,10 @@ + + + + //localhost:1313/writeups/ + + + + + + diff --git a/public/writeups/wr1/index.html b/public/writeups/wr1/index.html new file mode 100644 index 0000000..cf0bb85 --- /dev/null +++ b/public/writeups/wr1/index.html @@ -0,0 +1,126 @@ + + + + + + +LeetCode Daily Question: #1382 | Min Lu + + + + + + + + + + + + + + +
+
+ +
+

LeetCode Daily Question: #1382

+ + + + + +

Table of Contents

+ + +

Problem

+

Given the root of a BST, return a balanced BST with the same node values. If there is more than one answer, return any of them.

+

Key Takeaways

+
    +
  • An inorder traversal of a BST returns a list of sorted values.
  • +
  • Whenever recursing using indices, make sure to check if the start index ever exceeds the end index as a base case.
  • +
  • Calculate the midpoint between two indices as (start + (end - start) / 2).
  • +
+

Algorithm

+
    +
  1. Do inorder traversal on the original BST and get a vector of sorted values in the BST.
  2. +
  3. Recurse on the vector to construct the balanced BST, keeping track of the start and index node at each step. +
      +
    • For each step in the recursion, set the midpoint as the root of that subtree, and then construct the left and right subtrees out of the two halves of the vector.
    • +
    +
  4. +
+

Implementation Details

+

Inorder Traversal of BST

+
void sortedElements(TreeNode* root, vector<int>& sol) {
+    if (!root) {
+        return {};
+    }
+    sortedElements(root->left, sol);
+    sol.push_back(root->val);
+    sortedElements(root->right, sol);
+}
+

Constructing Balanced BST

+
TreeNode* constructBBST(TreeNode* root, vector<int> vals, int start, int end) {
+    if (start > end) {
+        return nullptr;
+    }
+    if (start == end) {
+        return new TreeNode(vals[start]);
+    }
+    int mid = start + (end - start) / 2;
+    root = new TreeNode(vals[mid]);
+    root->left = constructBBST(root->left, vals, start, mid - 1);
+    root->right = constructBBST(root->right, vals, mid + 1, end);
+    return root;
+}
+

Final Solution

+
TreeNode* solution(TreeNode* root) {
+    vector<int> vals;
+    sortedElements(root, vals);
+    TreeNode * fin = constructBBST(nullptr, vals, 0, vals.size() - 1);
+}
+
+ +
+
Tags:
+ +
+ +
+ + +
+
+ + + + + \ No newline at end of file diff --git a/themes/basic/archetypes/lc.md b/themes/basic/archetypes/writeups.md similarity index 100% rename from themes/basic/archetypes/lc.md rename to themes/basic/archetypes/writeups.md diff --git a/themes/basic/assets/css/single-container.css b/themes/basic/assets/css/single-container.css index 89a28c1..5213454 100644 --- a/themes/basic/assets/css/single-container.css +++ b/themes/basic/assets/css/single-container.css @@ -1,12 +1,22 @@ -.single-container>h2, +.single-container>h2 { + color: green; + padding-top: 1%; + /* padding-bottom: 0.5px; */ + border-bottom: 1px solid green; +} + .single-container>h3, .single-container>h4, .single-container>h5, .single-container>h6 { - color: green; + color: lightslategray; padding-top: 1%; - /* padding-bottom: 0.5px; */ - border-bottom: 1px solid green; +} + +.single-container>h4, +.single-container>h5, +.single-container>h6 { + font-weight: 500; } .single-container>p { @@ -14,6 +24,23 @@ margin-bottom: 1%; } +.highlight { + width: inherit; + margin: 0; + padding: 0; +} + +.highlight>pre { + width: 90%; + padding: 5px; + margin: 0 auto; +} + +.highlight>pre>code>span>span { + width: inherit; + text-wrap: wrap; +} + .single-container>div { margin-top: 2.5%; }