diff --git a/README.md b/README.md index e35ec41dc..758c260b7 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ - +

diff --git a/codes/pythontutor/chapter_computational_complexity/time_complexity.md b/codes/pythontutor/chapter_computational_complexity/time_complexity.md index 0eb992ce3..d32a48260 100644 --- a/codes/pythontutor/chapter_computational_complexity/time_complexity.md +++ b/codes/pythontutor/chapter_computational_complexity/time_complexity.md @@ -26,13 +26,13 @@ https://pythontutor.com/render.html#code=def%20exponential%28n%29%20-%3E%20int%3 https://pythontutor.com/render.html#code=def%20exp_recur%28n%29%20-%3E%20int%3A%0A%20%20%20%20%22%22%22%E6%8C%87%E6%95%B0%E9%98%B6%EF%BC%88%E9%80%92%E5%BD%92%E5%AE%9E%E7%8E%B0%EF%BC%89%22%22%22%0A%20%20%20%20if%20n%20%3D%3D%201%3A%0A%20%20%20%20%20%20%20%20return%201%0A%20%20%20%20return%20exp_recur%28n%20-%201%29%20%2B%20exp_recur%28n%20-%201%29%20%2B%201%0A%0A%22%22%22Driver%20Code%22%22%22%0Aif%20__name__%20%3D%3D%20%22__main__%22%3A%0A%20%20%20%20n%20%3D%207%0A%20%20%20%20print%28%22%E8%BE%93%E5%85%A5%E6%95%B0%E6%8D%AE%E5%A4%A7%E5%B0%8F%20n%20%3D%22,%20n%29%0A%0A%20%20%20%20count%20%3D%20exp_recur%28n%29%0A%20%20%20%20print%28%22%E6%8C%87%E6%95%B0%E9%98%B6%EF%BC%88%E9%80%92%E5%BD%92%E5%AE%9E%E7%8E%B0%EF%BC%89%E7%9A%84%E6%93%8D%E4%BD%9C%E6%95%B0%E9%87%8F%20%3D%22,%20count%29&cumulative=false&curInstr=3&heapPrimitives=nevernest&mode=display&origin=opt-frontend.js&py=311&rawInputLstJSON=%5B%5D&textReferences=false -https://pythontutor.com/render.html#code=def%20logarithmic%28n%3A%20float%29%20-%3E%20int%3A%0A%20%20%20%20%22%22%22%E5%AF%B9%E6%95%B0%E9%98%B6%EF%BC%88%E5%BE%AA%E7%8E%AF%E5%AE%9E%E7%8E%B0%EF%BC%89%22%22%22%0A%20%20%20%20count%20%3D%200%0A%20%20%20%20while%20n%20%3E%201%3A%0A%20%20%20%20%20%20%20%20n%20%3D%20n%20/%202%0A%20%20%20%20%20%20%20%20count%20%2B%3D%201%0A%20%20%20%20return%20count%0A%0A%22%22%22Driver%20Code%22%22%22%0Aif%20__name__%20%3D%3D%20%22__main__%22%3A%0A%20%20%20%20n%20%3D%208%0A%20%20%20%20print%28%22%E8%BE%93%E5%85%A5%E6%95%B0%E6%8D%AE%E5%A4%A7%E5%B0%8F%20n%20%3D%22,%20n%29%0A%0A%20%20%20%20count%20%3D%20logarithmic%28n%29%0A%20%20%20%20print%28%22%E5%AF%B9%E6%95%B0%E9%98%B6%EF%BC%88%E5%BE%AA%E7%8E%AF%E5%AE%9E%E7%8E%B0%EF%BC%89%E7%9A%84%E6%93%8D%E4%BD%9C%E6%95%B0%E9%87%8F%20%3D%22,%20count%29&cumulative=false&curInstr=3&heapPrimitives=nevernest&mode=display&origin=opt-frontend.js&py=311&rawInputLstJSON=%5B%5D&textReferences=false +https://pythontutor.com/render.html#code=def%20logarithmic%28n%3A%20int%29%20-%3E%20int%3A%0A%20%20%20%20%22%22%22%E5%AF%B9%E6%95%B0%E9%98%B6%EF%BC%88%E5%BE%AA%E7%8E%AF%E5%AE%9E%E7%8E%B0%EF%BC%89%22%22%22%0A%20%20%20%20count%20%3D%200%0A%20%20%20%20while%20n%20%3E%201%3A%0A%20%20%20%20%20%20%20%20n%20%3D%20n%20/%202%0A%20%20%20%20%20%20%20%20count%20%2B%3D%201%0A%20%20%20%20return%20count%0A%0A%22%22%22Driver%20Code%22%22%22%0Aif%20__name__%20%3D%3D%20%22__main__%22%3A%0A%20%20%20%20n%20%3D%208%0A%20%20%20%20print%28%22%E8%BE%93%E5%85%A5%E6%95%B0%E6%8D%AE%E5%A4%A7%E5%B0%8F%20n%20%3D%22,%20n%29%0A%0A%20%20%20%20count%20%3D%20logarithmic%28n%29%0A%20%20%20%20print%28%22%E5%AF%B9%E6%95%B0%E9%98%B6%EF%BC%88%E5%BE%AA%E7%8E%AF%E5%AE%9E%E7%8E%B0%EF%BC%89%E7%9A%84%E6%93%8D%E4%BD%9C%E6%95%B0%E9%87%8F%20%3D%22,%20count%29&cumulative=false&curInstr=3&heapPrimitives=nevernest&mode=display&origin=opt-frontend.js&py=311&rawInputLstJSON=%5B%5D&textReferences=false -https://pythontutor.com/render.html#code=def%20log_recur%28n%3A%20float%29%20-%3E%20int%3A%0A%20%20%20%20%22%22%22%E5%AF%B9%E6%95%B0%E9%98%B6%EF%BC%88%E9%80%92%E5%BD%92%E5%AE%9E%E7%8E%B0%EF%BC%89%22%22%22%0A%20%20%20%20if%20n%20%3C%3D%201%3A%0A%20%20%20%20%20%20%20%20return%200%0A%20%20%20%20return%20log_recur%28n%20/%202%29%20%2B%201%0A%0A%22%22%22Driver%20Code%22%22%22%0Aif%20__name__%20%3D%3D%20%22__main__%22%3A%0A%20%20%20%20n%20%3D%208%0A%20%20%20%20print%28%22%E8%BE%93%E5%85%A5%E6%95%B0%E6%8D%AE%E5%A4%A7%E5%B0%8F%20n%20%3D%22,%20n%29%0A%0A%20%20%20%20count%20%3D%20log_recur%28n%29%0A%20%20%20%20print%28%22%E5%AF%B9%E6%95%B0%E9%98%B6%EF%BC%88%E9%80%92%E5%BD%92%E5%AE%9E%E7%8E%B0%EF%BC%89%E7%9A%84%E6%93%8D%E4%BD%9C%E6%95%B0%E9%87%8F%20%3D%22,%20count%29&cumulative=false&curInstr=3&heapPrimitives=nevernest&mode=display&origin=opt-frontend.js&py=311&rawInputLstJSON=%5B%5D&textReferences=false +https://pythontutor.com/render.html#code=def%20log_recur%28n%3A%20int%29%20-%3E%20int%3A%0A%20%20%20%20%22%22%22%E5%AF%B9%E6%95%B0%E9%98%B6%EF%BC%88%E9%80%92%E5%BD%92%E5%AE%9E%E7%8E%B0%EF%BC%89%22%22%22%0A%20%20%20%20if%20n%20%3C%3D%201%3A%0A%20%20%20%20%20%20%20%20return%200%0A%20%20%20%20return%20log_recur%28n%20/%202%29%20%2B%201%0A%0A%22%22%22Driver%20Code%22%22%22%0Aif%20__name__%20%3D%3D%20%22__main__%22%3A%0A%20%20%20%20n%20%3D%208%0A%20%20%20%20print%28%22%E8%BE%93%E5%85%A5%E6%95%B0%E6%8D%AE%E5%A4%A7%E5%B0%8F%20n%20%3D%22,%20n%29%0A%0A%20%20%20%20count%20%3D%20log_recur%28n%29%0A%20%20%20%20print%28%22%E5%AF%B9%E6%95%B0%E9%98%B6%EF%BC%88%E9%80%92%E5%BD%92%E5%AE%9E%E7%8E%B0%EF%BC%89%E7%9A%84%E6%93%8D%E4%BD%9C%E6%95%B0%E9%87%8F%20%3D%22,%20count%29&cumulative=false&curInstr=4&heapPrimitives=nevernest&mode=display&origin=opt-frontend.js&py=311&rawInputLstJSON=%5B%5D&textReferences=false -https://pythontutor.com/render.html#code=def%20linear_log_recur%28n%3A%20float%29%20-%3E%20int%3A%0A%20%20%20%20%22%22%22%E7%BA%BF%E6%80%A7%E5%AF%B9%E6%95%B0%E9%98%B6%22%22%22%0A%20%20%20%20if%20n%20%3C%3D%201%3A%0A%20%20%20%20%20%20%20%20return%201%0A%20%20%20%20count%20%3D%20linear_log_recur%28n%20//%202%29%20%2B%20linear_log_recur%28n%20//%202%29%0A%20%20%20%20for%20_%20in%20range%28n%29%3A%0A%20%20%20%20%20%20%20%20count%20%2B%3D%201%0A%20%20%20%20return%20count%0A%0A%22%22%22Driver%20Code%22%22%22%0Aif%20__name__%20%3D%3D%20%22__main__%22%3A%0A%20%20%20%20n%20%3D%208%0A%20%20%20%20print%28%22%E8%BE%93%E5%85%A5%E6%95%B0%E6%8D%AE%E5%A4%A7%E5%B0%8F%20n%20%3D%22,%20n%29%0A%0A%20%20%20%20count%20%3D%20linear_log_recur%28n%29%0A%20%20%20%20print%28%22%E7%BA%BF%E6%80%A7%E5%AF%B9%E6%95%B0%E9%98%B6%EF%BC%88%E9%80%92%E5%BD%92%E5%AE%9E%E7%8E%B0%EF%BC%89%E7%9A%84%E6%93%8D%E4%BD%9C%E6%95%B0%E9%87%8F%20%3D%22,%20count%29&cumulative=false&curInstr=3&heapPrimitives=nevernest&mode=display&origin=opt-frontend.js&py=311&rawInputLstJSON=%5B%5D&textReferences=false +https://pythontutor.com/render.html#code=def%20linear_log_recur%28n%3A%20int%29%20-%3E%20int%3A%0A%20%20%20%20%22%22%22%E7%BA%BF%E6%80%A7%E5%AF%B9%E6%95%B0%E9%98%B6%22%22%22%0A%20%20%20%20if%20n%20%3C%3D%201%3A%0A%20%20%20%20%20%20%20%20return%201%0A%20%20%20%20count%20%3D%20linear_log_recur%28n%20//%202%29%20%2B%20linear_log_recur%28n%20//%202%29%0A%20%20%20%20for%20_%20in%20range%28n%29%3A%0A%20%20%20%20%20%20%20%20count%20%2B%3D%201%0A%20%20%20%20return%20count%0A%0A%22%22%22Driver%20Code%22%22%22%0Aif%20__name__%20%3D%3D%20%22__main__%22%3A%0A%20%20%20%20n%20%3D%208%0A%20%20%20%20print%28%22%E8%BE%93%E5%85%A5%E6%95%B0%E6%8D%AE%E5%A4%A7%E5%B0%8F%20n%20%3D%22,%20n%29%0A%0A%20%20%20%20count%20%3D%20linear_log_recur%28n%29%0A%20%20%20%20print%28%22%E7%BA%BF%E6%80%A7%E5%AF%B9%E6%95%B0%E9%98%B6%EF%BC%88%E9%80%92%E5%BD%92%E5%AE%9E%E7%8E%B0%EF%BC%89%E7%9A%84%E6%93%8D%E4%BD%9C%E6%95%B0%E9%87%8F%20%3D%22,%20count%29&cumulative=false&curInstr=4&heapPrimitives=nevernest&mode=display&origin=opt-frontend.js&py=311&rawInputLstJSON=%5B%5D&textReferences=false https://pythontutor.com/render.html#code=def%20factorial_recur%28n%29%20-%3E%20int%3A%0A%20%20%20%20%22%22%22%E9%98%B6%E4%B9%98%E9%98%B6%EF%BC%88%E9%80%92%E5%BD%92%E5%AE%9E%E7%8E%B0%EF%BC%89%22%22%22%0A%20%20%20%20if%20n%20%3D%3D%200%3A%0A%20%20%20%20%20%20%20%20return%201%0A%20%20%20%20count%20%3D%200%0A%20%20%20%20%23%20%E4%BB%8E%201%20%E4%B8%AA%E5%88%86%E8%A3%82%E5%87%BA%20n%20%E4%B8%AA%0A%20%20%20%20for%20_%20in%20range%28n%29%3A%0A%20%20%20%20%20%20%20%20count%20%2B%3D%20factorial_recur%28n%20-%201%29%0A%20%20%20%20return%20count%0A%0A%22%22%22Driver%20Code%22%22%22%0Aif%20__name__%20%3D%3D%20%22__main__%22%3A%0A%20%20%20%20n%20%3D%204%0A%20%20%20%20print%28%22%E8%BE%93%E5%85%A5%E6%95%B0%E6%8D%AE%E5%A4%A7%E5%B0%8F%20n%20%3D%22,%20n%29%0A%0A%20%20%20%20count%20%3D%20factorial_recur%28n%29%0A%20%20%20%20print%28%22%E9%98%B6%E4%B9%98%E9%98%B6%EF%BC%88%E9%80%92%E5%BD%92%E5%AE%9E%E7%8E%B0%EF%BC%89%E7%9A%84%E6%93%8D%E4%BD%9C%E6%95%B0%E9%87%8F%20%3D%22,%20count%29&cumulative=false&curInstr=3&heapPrimitives=nevernest&mode=display&origin=opt-frontend.js&py=311&rawInputLstJSON=%5B%5D&textReferences=false diff --git a/codes/pythontutor/chapter_sorting/quick_sort.md b/codes/pythontutor/chapter_sorting/quick_sort.md index c0347cf53..727217026 100644 --- a/codes/pythontutor/chapter_sorting/quick_sort.md +++ b/codes/pythontutor/chapter_sorting/quick_sort.md @@ -11,7 +11,7 @@ https://pythontutor.com/render.html#code=def%20partition%28nums%3A%20list%5Bint% https://pythontutor.com/render.html#code=def%20partition%28nums%3A%20list%5Bint%5D,%20left%3A%20int,%20right%3A%20int%29%20-%3E%20int%3A%0A%20%20%20%20%22%22%22%E5%93%A8%E5%85%B5%E5%88%92%E5%88%86%22%22%22%0A%20%20%20%20%23%20%E4%BB%A5%20nums%5Bleft%5D%20%E4%B8%BA%E5%9F%BA%E5%87%86%E6%95%B0%0A%20%20%20%20i,%20j%20%3D%20left,%20right%0A%20%20%20%20while%20i%20%3C%20j%3A%0A%20%20%20%20%20%20%20%20while%20i%20%3C%20j%20and%20nums%5Bj%5D%20%3E%3D%20nums%5Bleft%5D%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20j%20-%3D%201%20%20%23%20%E4%BB%8E%E5%8F%B3%E5%90%91%E5%B7%A6%E6%89%BE%E9%A6%96%E4%B8%AA%E5%B0%8F%E4%BA%8E%E5%9F%BA%E5%87%86%E6%95%B0%E7%9A%84%E5%85%83%E7%B4%A0%0A%20%20%20%20%20%20%20%20while%20i%20%3C%20j%20and%20nums%5Bi%5D%20%3C%3D%20nums%5Bleft%5D%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20i%20%2B%3D%201%20%20%23%20%E4%BB%8E%E5%B7%A6%E5%90%91%E5%8F%B3%E6%89%BE%E9%A6%96%E4%B8%AA%E5%A4%A7%E4%BA%8E%E5%9F%BA%E5%87%86%E6%95%B0%E7%9A%84%E5%85%83%E7%B4%A0%0A%20%20%20%20%20%20%20%20%23%20%E5%85%83%E7%B4%A0%E4%BA%A4%E6%8D%A2%0A%20%20%20%20%20%20%20%20nums%5Bi%5D,%20nums%5Bj%5D%20%3D%20nums%5Bj%5D,%20nums%5Bi%5D%0A%20%20%20%20%23%20%E5%B0%86%E5%9F%BA%E5%87%86%E6%95%B0%E4%BA%A4%E6%8D%A2%E8%87%B3%E4%B8%A4%E5%AD%90%E6%95%B0%E7%BB%84%E7%9A%84%E5%88%86%E7%95%8C%E7%BA%BF%0A%20%20%20%20nums%5Bi%5D,%20nums%5Bleft%5D%20%3D%20nums%5Bleft%5D,%20nums%5Bi%5D%0A%20%20%20%20return%20i%20%20%23%20%E8%BF%94%E5%9B%9E%E5%9F%BA%E5%87%86%E6%95%B0%E7%9A%84%E7%B4%A2%E5%BC%95%0A%0Adef%20quick_sort%28nums%3A%20list%5Bint%5D,%20left%3A%20int,%20right%3A%20int%29%3A%0A%20%20%20%20%22%22%22%E5%BF%AB%E9%80%9F%E6%8E%92%E5%BA%8F%22%22%22%0A%20%20%20%20%23%20%E5%AD%90%E6%95%B0%E7%BB%84%E9%95%BF%E5%BA%A6%E4%B8%BA%201%20%E6%97%B6%E7%BB%88%E6%AD%A2%E9%80%92%E5%BD%92%0A%20%20%20%20if%20left%20%3E%3D%20right%3A%0A%20%20%20%20%20%20%20%20return%0A%20%20%20%20%23%20%E5%93%A8%E5%85%B5%E5%88%92%E5%88%86%0A%20%20%20%20pivot%20%3D%20partition%28nums,%20left,%20right%29%0A%20%20%20%20%23%20%E9%80%92%E5%BD%92%E5%B7%A6%E5%AD%90%E6%95%B0%E7%BB%84%E3%80%81%E5%8F%B3%E5%AD%90%E6%95%B0%E7%BB%84%0A%20%20%20%20quick_sort%28nums,%20left,%20pivot%20-%201%29%0A%20%20%20%20quick_sort%28nums,%20pivot%20%2B%201,%20right%29%0A%0A%0A%22%22%22Driver%20Code%22%22%22%0Aif%20__name__%20%3D%3D%20%22__main__%22%3A%0A%20%20%20%20%23%20%E5%BF%AB%E9%80%9F%E6%8E%92%E5%BA%8F%0A%20%20%20%20nums%20%3D%20%5B2,%204,%201,%200,%203,%205%5D%0A%20%20%20%20quick_sort%28nums,%200,%20len%28nums%29%20-%201%29%0A%20%20%20%20print%28%22%E5%BF%AB%E9%80%9F%E6%8E%92%E5%BA%8F%E5%AE%8C%E6%88%90%E5%90%8E%20nums%20%3D%22,%20nums%29&cumulative=false&curInstr=5&heapPrimitives=nevernest&mode=display&origin=opt-frontend.js&py=311&rawInputLstJSON=%5B%5D&textReferences=false -https://pythontutor.com/render.html#code=def%20median_three%28nums%3A%20list%5Bint%5D,%20left%3A%20int,%20mid%3A%20int,%20right%3A%20int%29%20-%3E%20int%3A%0A%20%20%20%20%22%22%22%E9%80%89%E5%8F%96%E4%B8%89%E4%B8%AA%E5%80%99%E9%80%89%E5%85%83%E7%B4%A0%E7%9A%84%E4%B8%AD%E4%BD%8D%E6%95%B0%22%22%22%0A%20%20%20%20%23%20%E6%AD%A4%E5%A4%84%E4%BD%BF%E7%94%A8%E5%BC%82%E6%88%96%E8%BF%90%E7%AE%97%E6%9D%A5%E7%AE%80%E5%8C%96%E4%BB%A3%E7%A0%81%0A%20%20%20%20%23%20%E5%BC%82%E6%88%96%E8%A7%84%E5%88%99%E4%B8%BA%200%20%5E%200%20%3D%201%20%5E%201%20%3D%200,%200%20%5E%201%20%3D%201%20%5E%200%20%3D%201%0A%20%20%20%20if%20%28nums%5Bleft%5D%20%3C%20nums%5Bmid%5D%29%20%5E%20%28nums%5Bleft%5D%20%3C%20nums%5Bright%5D%29%3A%0A%20%20%20%20%20%20%20%20return%20left%0A%20%20%20%20elif%20%28nums%5Bmid%5D%20%3C%20nums%5Bleft%5D%29%20%5E%20%28nums%5Bmid%5D%20%3C%20nums%5Bright%5D%29%3A%0A%20%20%20%20%20%20%20%20return%20mid%0A%20%20%20%20return%20right%0A%0Adef%20partition%28nums%3A%20list%5Bint%5D,%20left%3A%20int,%20right%3A%20int%29%20-%3E%20int%3A%0A%20%20%20%20%22%22%22%E5%93%A8%E5%85%B5%E5%88%92%E5%88%86%EF%BC%88%E4%B8%89%E6%95%B0%E5%8F%96%E4%B8%AD%E5%80%BC%EF%BC%89%22%22%22%0A%20%20%20%20%23%20%E4%BB%A5%20nums%5Bleft%5D%20%E4%B8%BA%E5%9F%BA%E5%87%86%E6%95%B0%0A%20%20%20%20med%20%3D%20median_three%28nums,%20left,%20%28left%20%2B%20right%29%20//%202,%20right%29%0A%20%20%20%20%23%20%E5%B0%86%E4%B8%AD%E4%BD%8D%E6%95%B0%E4%BA%A4%E6%8D%A2%E8%87%B3%E6%95%B0%E7%BB%84%E6%9C%80%E5%B7%A6%E7%AB%AF%0A%20%20%20%20nums%5Bleft%5D,%20nums%5Bmed%5D%20%3D%20nums%5Bmed%5D,%20nums%5Bleft%5D%0A%20%20%20%20%23%20%E4%BB%A5%20nums%5Bleft%5D%20%E4%B8%BA%E5%9F%BA%E5%87%86%E6%95%B0%0A%20%20%20%20i,%20j%20%3D%20left,%20right%0A%20%20%20%20while%20i%20%3C%20j%3A%0A%20%20%20%20%20%20%20%20while%20i%20%3C%20j%20and%20nums%5Bj%5D%20%3E%3D%20nums%5Bleft%5D%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20j%20-%3D%201%20%20%23%20%E4%BB%8E%E5%8F%B3%E5%90%91%E5%B7%A6%E6%89%BE%E9%A6%96%E4%B8%AA%E5%B0%8F%E4%BA%8E%E5%9F%BA%E5%87%86%E6%95%B0%E7%9A%84%E5%85%83%E7%B4%A0%0A%20%20%20%20%20%20%20%20while%20i%20%3C%20j%20and%20nums%5Bi%5D%20%3C%3D%20nums%5Bleft%5D%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20i%20%2B%3D%201%20%20%23%20%E4%BB%8E%E5%B7%A6%E5%90%91%E5%8F%B3%E6%89%BE%E9%A6%96%E4%B8%AA%E5%A4%A7%E4%BA%8E%E5%9F%BA%E5%87%86%E6%95%B0%E7%9A%84%E5%85%83%E7%B4%A0%0A%20%20%20%20%20%20%20%20%23%20%E5%85%83%E7%B4%A0%E4%BA%A4%E6%8D%A2%0A%20%20%20%20%20%20%20%20nums%5Bi%5D,%20nums%5Bj%5D%20%3D%20nums%5Bj%5D,%20nums%5Bi%5D%0A%20%20%20%20%23%20%E5%B0%86%E5%9F%BA%E5%87%86%E6%95%B0%E4%BA%A4%E6%8D%A2%E8%87%B3%E4%B8%A4%E5%AD%90%E6%95%B0%E7%BB%84%E7%9A%84%E5%88%86%E7%95%8C%E7%BA%BF%0A%20%20%20%20nums%5Bi%5D,%20nums%5Bleft%5D%20%3D%20nums%5Bleft%5D,%20nums%5Bi%5D%0A%20%20%20%20return%20i%20%20%23%20%E8%BF%94%E5%9B%9E%E5%9F%BA%E5%87%86%E6%95%B0%E7%9A%84%E7%B4%A2%E5%BC%95%0A%0A%0A%22%22%22Driver%20Code%22%22%22%0Aif%20__name__%20%3D%3D%20%22__main__%22%3A%0A%20%20%20%20%23%20%E4%B8%AD%E4%BD%8D%E5%9F%BA%E5%87%86%E6%95%B0%E4%BC%98%E5%8C%96%0A%20%20%20%20nums%20%3D%20%5B2,%204,%201,%200,%203,%205%5D%0A%20%20%20%20partition%28nums,%200,%20len%28nums%29%20-%201%29%0A%20%20%20%20print%28%22%E5%93%A8%E5%85%B5%E5%88%92%E5%88%86%EF%BC%88%E4%B8%AD%E4%BD%8D%E5%9F%BA%E5%87%86%E6%95%B0%E4%BC%98%E5%8C%96%EF%BC%89%E5%AE%8C%E6%88%90%E5%90%8E%20nums%20%3D%22,%20nums%29&cumulative=false&curInstr=5&heapPrimitives=nevernest&mode=display&origin=opt-frontend.js&py=311&rawInputLstJSON=%5B%5D&textReferences=false +https://pythontutor.com/render.html#code=def%20median_three%28nums%3A%20list%5Bint%5D,%20left%3A%20int,%20mid%3A%20int,%20right%3A%20int%29%20-%3E%20int%3A%0A%20%20%20%20%22%22%22%E9%80%89%E5%8F%96%E4%B8%89%E4%B8%AA%E5%80%99%E9%80%89%E5%85%83%E7%B4%A0%E7%9A%84%E4%B8%AD%E4%BD%8D%E6%95%B0%22%22%22%0A%20%20%20%20l,%20m,%20r%20%3D%20nums%5Bleft%5D,%20nums%5Bmid%5D,%20nums%5Bright%5D%0A%20%20%20%20if%20%28l%20%3C%3D%20m%20%3C%3D%20r%29%20or%20%28r%20%3C%3D%20m%20%3C%3D%20l%29%3A%0A%20%20%20%20%20%20%20%20return%20mid%20%20%23%20m%20%E5%9C%A8%20l%20%E5%92%8C%20r%20%E4%B9%8B%E9%97%B4%0A%20%20%20%20if%20%28m%20%3C%3D%20l%20%3C%3D%20r%29%20or%20%28r%20%3C%3D%20l%20%3C%3D%20m%29%3A%0A%20%20%20%20%20%20%20%20return%20left%20%20%23%20l%20%E5%9C%A8%20m%20%E5%92%8C%20r%20%E4%B9%8B%E9%97%B4%0A%20%20%20%20return%20right%0A%0Adef%20partition%28nums%3A%20list%5Bint%5D,%20left%3A%20int,%20right%3A%20int%29%20-%3E%20int%3A%0A%20%20%20%20%22%22%22%E5%93%A8%E5%85%B5%E5%88%92%E5%88%86%EF%BC%88%E4%B8%89%E6%95%B0%E5%8F%96%E4%B8%AD%E5%80%BC%EF%BC%89%22%22%22%0A%20%20%20%20%23%20%E4%BB%A5%20nums%5Bleft%5D%20%E4%B8%BA%E5%9F%BA%E5%87%86%E6%95%B0%0A%20%20%20%20med%20%3D%20median_three%28nums,%20left,%20%28left%20%2B%20right%29%20//%202,%20right%29%0A%20%20%20%20%23%20%E5%B0%86%E4%B8%AD%E4%BD%8D%E6%95%B0%E4%BA%A4%E6%8D%A2%E8%87%B3%E6%95%B0%E7%BB%84%E6%9C%80%E5%B7%A6%E7%AB%AF%0A%20%20%20%20nums%5Bleft%5D,%20nums%5Bmed%5D%20%3D%20nums%5Bmed%5D,%20nums%5Bleft%5D%0A%20%20%20%20%23%20%E4%BB%A5%20nums%5Bleft%5D%20%E4%B8%BA%E5%9F%BA%E5%87%86%E6%95%B0%0A%20%20%20%20i,%20j%20%3D%20left,%20right%0A%20%20%20%20while%20i%20%3C%20j%3A%0A%20%20%20%20%20%20%20%20while%20i%20%3C%20j%20and%20nums%5Bj%5D%20%3E%3D%20nums%5Bleft%5D%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20j%20-%3D%201%20%20%23%20%E4%BB%8E%E5%8F%B3%E5%90%91%E5%B7%A6%E6%89%BE%E9%A6%96%E4%B8%AA%E5%B0%8F%E4%BA%8E%E5%9F%BA%E5%87%86%E6%95%B0%E7%9A%84%E5%85%83%E7%B4%A0%0A%20%20%20%20%20%20%20%20while%20i%20%3C%20j%20and%20nums%5Bi%5D%20%3C%3D%20nums%5Bleft%5D%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20i%20%2B%3D%201%20%20%23%20%E4%BB%8E%E5%B7%A6%E5%90%91%E5%8F%B3%E6%89%BE%E9%A6%96%E4%B8%AA%E5%A4%A7%E4%BA%8E%E5%9F%BA%E5%87%86%E6%95%B0%E7%9A%84%E5%85%83%E7%B4%A0%0A%20%20%20%20%20%20%20%20%23%20%E5%85%83%E7%B4%A0%E4%BA%A4%E6%8D%A2%0A%20%20%20%20%20%20%20%20nums%5Bi%5D,%20nums%5Bj%5D%20%3D%20nums%5Bj%5D,%20nums%5Bi%5D%0A%20%20%20%20%23%20%E5%B0%86%E5%9F%BA%E5%87%86%E6%95%B0%E4%BA%A4%E6%8D%A2%E8%87%B3%E4%B8%A4%E5%AD%90%E6%95%B0%E7%BB%84%E7%9A%84%E5%88%86%E7%95%8C%E7%BA%BF%0A%20%20%20%20nums%5Bi%5D,%20nums%5Bleft%5D%20%3D%20nums%5Bleft%5D,%20nums%5Bi%5D%0A%20%20%20%20return%20i%20%20%23%20%E8%BF%94%E5%9B%9E%E5%9F%BA%E5%87%86%E6%95%B0%E7%9A%84%E7%B4%A2%E5%BC%95%0A%0A%0A%22%22%22Driver%20Code%22%22%22%0Aif%20__name__%20%3D%3D%20%22__main__%22%3A%0A%20%20%20%20%23%20%E4%B8%AD%E4%BD%8D%E5%9F%BA%E5%87%86%E6%95%B0%E4%BC%98%E5%8C%96%0A%20%20%20%20nums%20%3D%20%5B2,%204,%201,%200,%203,%205%5D%0A%20%20%20%20partition%28nums,%200,%20len%28nums%29%20-%201%29%0A%20%20%20%20print%28%22%E5%93%A8%E5%85%B5%E5%88%92%E5%88%86%EF%BC%88%E4%B8%AD%E4%BD%8D%E5%9F%BA%E5%87%86%E6%95%B0%E4%BC%98%E5%8C%96%EF%BC%89%E5%AE%8C%E6%88%90%E5%90%8E%20nums%20%3D%22,%20nums%29&cumulative=false&curInstr=5&heapPrimitives=nevernest&mode=display&origin=opt-frontend.js&py=311&rawInputLstJSON=%5B%5D&textReferences=false https://pythontutor.com/render.html#code=def%20partition%28nums%3A%20list%5Bint%5D,%20left%3A%20int,%20right%3A%20int%29%20-%3E%20int%3A%0A%20%20%20%20%22%22%22%E5%93%A8%E5%85%B5%E5%88%92%E5%88%86%22%22%22%0A%20%20%20%20%23%20%E4%BB%A5%20nums%5Bleft%5D%20%E4%B8%BA%E5%9F%BA%E5%87%86%E6%95%B0%0A%20%20%20%20i,%20j%20%3D%20left,%20right%0A%20%20%20%20while%20i%20%3C%20j%3A%0A%20%20%20%20%20%20%20%20while%20i%20%3C%20j%20and%20nums%5Bj%5D%20%3E%3D%20nums%5Bleft%5D%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20j%20-%3D%201%20%20%23%20%E4%BB%8E%E5%8F%B3%E5%90%91%E5%B7%A6%E6%89%BE%E9%A6%96%E4%B8%AA%E5%B0%8F%E4%BA%8E%E5%9F%BA%E5%87%86%E6%95%B0%E7%9A%84%E5%85%83%E7%B4%A0%0A%20%20%20%20%20%20%20%20while%20i%20%3C%20j%20and%20nums%5Bi%5D%20%3C%3D%20nums%5Bleft%5D%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20i%20%2B%3D%201%20%20%23%20%E4%BB%8E%E5%B7%A6%E5%90%91%E5%8F%B3%E6%89%BE%E9%A6%96%E4%B8%AA%E5%A4%A7%E4%BA%8E%E5%9F%BA%E5%87%86%E6%95%B0%E7%9A%84%E5%85%83%E7%B4%A0%0A%20%20%20%20%20%20%20%20%23%20%E5%85%83%E7%B4%A0%E4%BA%A4%E6%8D%A2%0A%20%20%20%20%20%20%20%20nums%5Bi%5D,%20nums%5Bj%5D%20%3D%20nums%5Bj%5D,%20nums%5Bi%5D%0A%20%20%20%20%23%20%E5%B0%86%E5%9F%BA%E5%87%86%E6%95%B0%E4%BA%A4%E6%8D%A2%E8%87%B3%E4%B8%A4%E5%AD%90%E6%95%B0%E7%BB%84%E7%9A%84%E5%88%86%E7%95%8C%E7%BA%BF%0A%20%20%20%20nums%5Bi%5D,%20nums%5Bleft%5D%20%3D%20nums%5Bleft%5D,%20nums%5Bi%5D%0A%20%20%20%20return%20i%20%20%23%20%E8%BF%94%E5%9B%9E%E5%9F%BA%E5%87%86%E6%95%B0%E7%9A%84%E7%B4%A2%E5%BC%95%0A%0Adef%20quick_sort%28nums%3A%20list%5Bint%5D,%20left%3A%20int,%20right%3A%20int%29%3A%0A%20%20%20%20%22%22%22%E5%BF%AB%E9%80%9F%E6%8E%92%E5%BA%8F%EF%BC%88%E5%B0%BE%E9%80%92%E5%BD%92%E4%BC%98%E5%8C%96%EF%BC%89%22%22%22%0A%20%20%20%20%23%20%E5%AD%90%E6%95%B0%E7%BB%84%E9%95%BF%E5%BA%A6%E4%B8%BA%201%20%E6%97%B6%E7%BB%88%E6%AD%A2%0A%20%20%20%20while%20left%20%3C%20right%3A%0A%20%20%20%20%20%20%20%20%23%20%E5%93%A8%E5%85%B5%E5%88%92%E5%88%86%E6%93%8D%E4%BD%9C%0A%20%20%20%20%20%20%20%20pivot%20%3D%20partition%28nums,%20left,%20right%29%0A%20%20%20%20%20%20%20%20%23%20%E5%AF%B9%E4%B8%A4%E4%B8%AA%E5%AD%90%E6%95%B0%E7%BB%84%E4%B8%AD%E8%BE%83%E7%9F%AD%E7%9A%84%E9%82%A3%E4%B8%AA%E6%89%A7%E8%A1%8C%E5%BF%AB%E9%80%9F%E6%8E%92%E5%BA%8F%0A%20%20%20%20%20%20%20%20if%20pivot%20-%20left%20%3C%20right%20-%20pivot%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20quick_sort%28nums,%20left,%20pivot%20-%201%29%20%20%23%20%E9%80%92%E5%BD%92%E6%8E%92%E5%BA%8F%E5%B7%A6%E5%AD%90%E6%95%B0%E7%BB%84%0A%20%20%20%20%20%20%20%20%20%20%20%20left%20%3D%20pivot%20%2B%201%20%20%23%20%E5%89%A9%E4%BD%99%E6%9C%AA%E6%8E%92%E5%BA%8F%E5%8C%BA%E9%97%B4%E4%B8%BA%20%5Bpivot%20%2B%201,%20right%5D%0A%20%20%20%20%20%20%20%20else%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20quick_sort%28nums,%20pivot%20%2B%201,%20right%29%20%20%23%20%E9%80%92%E5%BD%92%E6%8E%92%E5%BA%8F%E5%8F%B3%E5%AD%90%E6%95%B0%E7%BB%84%0A%20%20%20%20%20%20%20%20%20%20%20%20right%20%3D%20pivot%20-%201%20%20%23%20%E5%89%A9%E4%BD%99%E6%9C%AA%E6%8E%92%E5%BA%8F%E5%8C%BA%E9%97%B4%E4%B8%BA%20%5Bleft,%20pivot%20-%201%5D%0A%0A%22%22%22Driver%20Code%22%22%22%0Aif%20__name__%20%3D%3D%20%22__main__%22%3A%0A%20%20%20%20%23%20%E5%BF%AB%E9%80%9F%E6%8E%92%E5%BA%8F%EF%BC%88%E5%B0%BE%E9%80%92%E5%BD%92%E4%BC%98%E5%8C%96%EF%BC%89%0A%20%20%20%20nums%20%3D%20%5B2,%204,%201,%200,%203,%205%5D%0A%20%20%20%20quick_sort%28nums,%200,%20len%28nums%29%20-%201%29%0A%20%20%20%20print%28%22%E5%BF%AB%E9%80%9F%E6%8E%92%E5%BA%8F%EF%BC%88%E5%B0%BE%E9%80%92%E5%BD%92%E4%BC%98%E5%8C%96%EF%BC%89%E5%AE%8C%E6%88%90%E5%90%8E%20nums%20%3D%22,%20nums%29&cumulative=false&curInstr=5&heapPrimitives=nevernest&mode=display&origin=opt-frontend.js&py=311&rawInputLstJSON=%5B%5D&textReferences=false diff --git a/docs-en/index.assets/conceptual_rendering.png b/docs-en/index.assets/conceptual_rendering.png deleted file mode 100644 index 4f9a14acb..000000000 Binary files a/docs-en/index.assets/conceptual_rendering.png and /dev/null differ diff --git a/docs-en/index.assets/hello_algo_header.png b/docs-en/index.assets/hello_algo_header.png deleted file mode 100644 index 793d96e97..000000000 Binary files a/docs-en/index.assets/hello_algo_header.png and /dev/null differ diff --git a/docs-en/index.assets/hello_algo_hero.jpg b/docs-en/index.assets/hello_algo_hero.jpg deleted file mode 100644 index 6f8f67fca..000000000 Binary files a/docs-en/index.assets/hello_algo_hero.jpg and /dev/null differ diff --git a/docs/chapter_appendix/terminology.md b/docs/chapter_appendix/terminology.md index fc1873c90..091365b7b 100644 --- a/docs/chapter_appendix/terminology.md +++ b/docs/chapter_appendix/terminology.md @@ -130,7 +130,7 @@ | $n$-queens problem | $n$ 皇后问题 | $n$ 皇后問題 | | dynamic programming | 动态规划 | 動態規劃 | | initial state | 初始状态 | 初始狀態 | -| state-trasition equation | 状态转移方程 | 狀態轉移方程 | +| state-transition equation | 状态转移方程 | 狀態轉移方程 | | knapsack problem | 背包问题 | 背包問題 | | edit distance problem | 编辑距离问题 | 編輯距離問題 | | greedy algorithm | 贪心算法 | 貪婪演算法 | diff --git a/README-en.md b/en/README.md similarity index 100% rename from README-en.md rename to en/README.md diff --git a/docs-en/assets/covers/chapter_appendix.jpg b/en/docs/assets/covers/chapter_appendix.jpg similarity index 100% rename from docs-en/assets/covers/chapter_appendix.jpg rename to en/docs/assets/covers/chapter_appendix.jpg diff --git a/docs-en/assets/covers/chapter_array_and_linkedlist.jpg b/en/docs/assets/covers/chapter_array_and_linkedlist.jpg similarity index 100% rename from docs-en/assets/covers/chapter_array_and_linkedlist.jpg rename to en/docs/assets/covers/chapter_array_and_linkedlist.jpg diff --git a/docs-en/assets/covers/chapter_backtracking.jpg b/en/docs/assets/covers/chapter_backtracking.jpg similarity index 100% rename from docs-en/assets/covers/chapter_backtracking.jpg rename to en/docs/assets/covers/chapter_backtracking.jpg diff --git a/docs-en/assets/covers/chapter_complexity_analysis.jpg b/en/docs/assets/covers/chapter_complexity_analysis.jpg similarity index 100% rename from docs-en/assets/covers/chapter_complexity_analysis.jpg rename to en/docs/assets/covers/chapter_complexity_analysis.jpg diff --git a/docs-en/assets/covers/chapter_data_structure.jpg b/en/docs/assets/covers/chapter_data_structure.jpg similarity index 100% rename from docs-en/assets/covers/chapter_data_structure.jpg rename to en/docs/assets/covers/chapter_data_structure.jpg diff --git a/docs-en/assets/covers/chapter_divide_and_conquer.jpg b/en/docs/assets/covers/chapter_divide_and_conquer.jpg similarity index 100% rename from docs-en/assets/covers/chapter_divide_and_conquer.jpg rename to en/docs/assets/covers/chapter_divide_and_conquer.jpg diff --git a/docs-en/assets/covers/chapter_dynamic_programming.jpg b/en/docs/assets/covers/chapter_dynamic_programming.jpg similarity index 100% rename from docs-en/assets/covers/chapter_dynamic_programming.jpg rename to en/docs/assets/covers/chapter_dynamic_programming.jpg diff --git a/docs-en/assets/covers/chapter_graph.jpg b/en/docs/assets/covers/chapter_graph.jpg similarity index 100% rename from docs-en/assets/covers/chapter_graph.jpg rename to en/docs/assets/covers/chapter_graph.jpg diff --git a/docs-en/assets/covers/chapter_greedy.jpg b/en/docs/assets/covers/chapter_greedy.jpg similarity index 100% rename from docs-en/assets/covers/chapter_greedy.jpg rename to en/docs/assets/covers/chapter_greedy.jpg diff --git a/docs-en/assets/covers/chapter_hashing.jpg b/en/docs/assets/covers/chapter_hashing.jpg similarity index 100% rename from docs-en/assets/covers/chapter_hashing.jpg rename to en/docs/assets/covers/chapter_hashing.jpg diff --git a/docs-en/assets/covers/chapter_heap.jpg b/en/docs/assets/covers/chapter_heap.jpg similarity index 100% rename from docs-en/assets/covers/chapter_heap.jpg rename to en/docs/assets/covers/chapter_heap.jpg diff --git a/docs-en/assets/covers/chapter_introduction.jpg b/en/docs/assets/covers/chapter_introduction.jpg similarity index 100% rename from docs-en/assets/covers/chapter_introduction.jpg rename to en/docs/assets/covers/chapter_introduction.jpg diff --git a/docs-en/assets/covers/chapter_preface.jpg b/en/docs/assets/covers/chapter_preface.jpg similarity index 100% rename from docs-en/assets/covers/chapter_preface.jpg rename to en/docs/assets/covers/chapter_preface.jpg diff --git a/docs-en/assets/covers/chapter_searching.jpg b/en/docs/assets/covers/chapter_searching.jpg similarity index 100% rename from docs-en/assets/covers/chapter_searching.jpg rename to en/docs/assets/covers/chapter_searching.jpg diff --git a/docs-en/assets/covers/chapter_sorting.jpg b/en/docs/assets/covers/chapter_sorting.jpg similarity index 100% rename from docs-en/assets/covers/chapter_sorting.jpg rename to en/docs/assets/covers/chapter_sorting.jpg diff --git a/docs-en/assets/covers/chapter_stack_and_queue.jpg b/en/docs/assets/covers/chapter_stack_and_queue.jpg similarity index 100% rename from docs-en/assets/covers/chapter_stack_and_queue.jpg rename to en/docs/assets/covers/chapter_stack_and_queue.jpg diff --git a/docs-en/assets/covers/chapter_tree.jpg b/en/docs/assets/covers/chapter_tree.jpg similarity index 100% rename from docs-en/assets/covers/chapter_tree.jpg rename to en/docs/assets/covers/chapter_tree.jpg diff --git a/docs-en/chapter_array_and_linkedlist/array.assets/array_definition.png b/en/docs/chapter_array_and_linkedlist/array.assets/array_definition.png similarity index 100% rename from docs-en/chapter_array_and_linkedlist/array.assets/array_definition.png rename to en/docs/chapter_array_and_linkedlist/array.assets/array_definition.png diff --git a/docs-en/chapter_array_and_linkedlist/array.assets/array_insert_element.png b/en/docs/chapter_array_and_linkedlist/array.assets/array_insert_element.png similarity index 100% rename from docs-en/chapter_array_and_linkedlist/array.assets/array_insert_element.png rename to en/docs/chapter_array_and_linkedlist/array.assets/array_insert_element.png diff --git a/docs-en/chapter_array_and_linkedlist/array.assets/array_memory_location_calculation.png b/en/docs/chapter_array_and_linkedlist/array.assets/array_memory_location_calculation.png similarity index 100% rename from docs-en/chapter_array_and_linkedlist/array.assets/array_memory_location_calculation.png rename to en/docs/chapter_array_and_linkedlist/array.assets/array_memory_location_calculation.png diff --git a/docs-en/chapter_array_and_linkedlist/array.assets/array_remove_element.png b/en/docs/chapter_array_and_linkedlist/array.assets/array_remove_element.png similarity index 100% rename from docs-en/chapter_array_and_linkedlist/array.assets/array_remove_element.png rename to en/docs/chapter_array_and_linkedlist/array.assets/array_remove_element.png diff --git a/docs-en/chapter_array_and_linkedlist/array.md b/en/docs/chapter_array_and_linkedlist/array.md similarity index 99% rename from docs-en/chapter_array_and_linkedlist/array.md rename to en/docs/chapter_array_and_linkedlist/array.md index f36670785..7a1a655a8 100755 --- a/docs-en/chapter_array_and_linkedlist/array.md +++ b/en/docs/chapter_array_and_linkedlist/array.md @@ -105,6 +105,12 @@ Arrays can be initialized in two ways depending on the needs: either without ini int nums[5] = { 1, 3, 2, 5, 4 }; ``` +=== "Kotlin" + + ```kotlin title="array.kt" + + ``` + === "Zig" ```zig title="array.zig" diff --git a/docs-en/chapter_array_and_linkedlist/index.md b/en/docs/chapter_array_and_linkedlist/index.md similarity index 100% rename from docs-en/chapter_array_and_linkedlist/index.md rename to en/docs/chapter_array_and_linkedlist/index.md diff --git a/docs-en/chapter_array_and_linkedlist/linked_list.assets/linkedlist_common_types.png b/en/docs/chapter_array_and_linkedlist/linked_list.assets/linkedlist_common_types.png similarity index 100% rename from docs-en/chapter_array_and_linkedlist/linked_list.assets/linkedlist_common_types.png rename to en/docs/chapter_array_and_linkedlist/linked_list.assets/linkedlist_common_types.png diff --git a/docs-en/chapter_array_and_linkedlist/linked_list.assets/linkedlist_definition.png b/en/docs/chapter_array_and_linkedlist/linked_list.assets/linkedlist_definition.png similarity index 100% rename from docs-en/chapter_array_and_linkedlist/linked_list.assets/linkedlist_definition.png rename to en/docs/chapter_array_and_linkedlist/linked_list.assets/linkedlist_definition.png diff --git a/docs-en/chapter_array_and_linkedlist/linked_list.assets/linkedlist_insert_node.png b/en/docs/chapter_array_and_linkedlist/linked_list.assets/linkedlist_insert_node.png similarity index 100% rename from docs-en/chapter_array_and_linkedlist/linked_list.assets/linkedlist_insert_node.png rename to en/docs/chapter_array_and_linkedlist/linked_list.assets/linkedlist_insert_node.png diff --git a/docs-en/chapter_array_and_linkedlist/linked_list.assets/linkedlist_remove_node.png b/en/docs/chapter_array_and_linkedlist/linked_list.assets/linkedlist_remove_node.png similarity index 100% rename from docs-en/chapter_array_and_linkedlist/linked_list.assets/linkedlist_remove_node.png rename to en/docs/chapter_array_and_linkedlist/linked_list.assets/linkedlist_remove_node.png diff --git a/docs-en/chapter_array_and_linkedlist/linked_list.md b/en/docs/chapter_array_and_linkedlist/linked_list.md similarity index 99% rename from docs-en/chapter_array_and_linkedlist/linked_list.md rename to en/docs/chapter_array_and_linkedlist/linked_list.md index 6400a50e4..93e7c591d 100755 --- a/docs-en/chapter_array_and_linkedlist/linked_list.md +++ b/en/docs/chapter_array_and_linkedlist/linked_list.md @@ -159,6 +159,12 @@ As the code below illustrates, a `ListNode` in a linked list, besides holding a } ``` +=== "Kotlin" + + ```kotlin title="" + + ``` + === "Zig" ```zig title="" @@ -373,6 +379,12 @@ Constructing a linked list is a two-step process: first, initializing each node n3->next = n4; ``` +=== "Kotlin" + + ```kotlin title="linked_list.kt" + + ``` + === "Zig" ```zig title="linked_list.zig" @@ -624,6 +636,12 @@ As shown in the figure, there are three common types of linked lists. } ``` +=== "Kotlin" + + ```kotlin title="" + + ``` + === "Zig" ```zig title="" diff --git a/docs-en/chapter_array_and_linkedlist/list.md b/en/docs/chapter_array_and_linkedlist/list.md similarity index 98% rename from docs-en/chapter_array_and_linkedlist/list.md rename to en/docs/chapter_array_and_linkedlist/list.md index 5269f7788..028d9265e 100755 --- a/docs-en/chapter_array_and_linkedlist/list.md +++ b/en/docs/chapter_array_and_linkedlist/list.md @@ -126,6 +126,12 @@ We typically use two initialization methods: "without initial values" and "with // C does not provide built-in dynamic arrays ``` +=== "Kotlin" + + ```kotlin title="list.kt" + + ``` + === "Zig" ```zig title="list.zig" @@ -244,6 +250,12 @@ Lists are essentially arrays, thus they can access and update elements in $O(1)$ // C does not provide built-in dynamic arrays ``` +=== "Kotlin" + + ```kotlin title="list.kt" + + ``` + === "Zig" ```zig title="list.zig" @@ -464,6 +476,12 @@ Compared to arrays, lists offer more flexibility in adding and removing elements // C does not provide built-in dynamic arrays ``` +=== "Kotlin" + + ```kotlin title="list.kt" + + ``` + === "Zig" ```zig title="list.zig" @@ -650,6 +668,12 @@ Similar to arrays, lists can be iterated either by using indices or by directly // C does not provide built-in dynamic arrays ``` +=== "Kotlin" + + ```kotlin title="list.kt" + + ``` + === "Zig" ```zig title="list.zig" @@ -758,6 +782,12 @@ Given a new list `nums1`, we can append it to the end of the original list. // C does not provide built-in dynamic arrays ``` +=== "Kotlin" + + ```kotlin title="list.kt" + + ``` + === "Zig" ```zig title="list.zig" @@ -848,6 +878,12 @@ Once the list is sorted, we can employ algorithms commonly used in array-related // C does not provide built-in dynamic arrays ``` +=== "Kotlin" + + ```kotlin title="list.kt" + + ``` + === "Zig" ```zig title="list.zig" diff --git a/docs-en/chapter_array_and_linkedlist/ram_and_cache.assets/computer_storage_devices.png b/en/docs/chapter_array_and_linkedlist/ram_and_cache.assets/computer_storage_devices.png similarity index 100% rename from docs-en/chapter_array_and_linkedlist/ram_and_cache.assets/computer_storage_devices.png rename to en/docs/chapter_array_and_linkedlist/ram_and_cache.assets/computer_storage_devices.png diff --git a/docs-en/chapter_array_and_linkedlist/ram_and_cache.assets/storage_pyramid.png b/en/docs/chapter_array_and_linkedlist/ram_and_cache.assets/storage_pyramid.png similarity index 100% rename from docs-en/chapter_array_and_linkedlist/ram_and_cache.assets/storage_pyramid.png rename to en/docs/chapter_array_and_linkedlist/ram_and_cache.assets/storage_pyramid.png diff --git a/docs-en/chapter_array_and_linkedlist/ram_and_cache.md b/en/docs/chapter_array_and_linkedlist/ram_and_cache.md similarity index 100% rename from docs-en/chapter_array_and_linkedlist/ram_and_cache.md rename to en/docs/chapter_array_and_linkedlist/ram_and_cache.md diff --git a/docs-en/chapter_array_and_linkedlist/summary.md b/en/docs/chapter_array_and_linkedlist/summary.md similarity index 100% rename from docs-en/chapter_array_and_linkedlist/summary.md rename to en/docs/chapter_array_and_linkedlist/summary.md diff --git a/docs-en/chapter_computational_complexity/index.md b/en/docs/chapter_computational_complexity/index.md similarity index 100% rename from docs-en/chapter_computational_complexity/index.md rename to en/docs/chapter_computational_complexity/index.md diff --git a/docs-en/chapter_computational_complexity/iteration_and_recursion.assets/iteration.png b/en/docs/chapter_computational_complexity/iteration_and_recursion.assets/iteration.png similarity index 100% rename from docs-en/chapter_computational_complexity/iteration_and_recursion.assets/iteration.png rename to en/docs/chapter_computational_complexity/iteration_and_recursion.assets/iteration.png diff --git a/docs-en/chapter_computational_complexity/iteration_and_recursion.assets/nested_iteration.png b/en/docs/chapter_computational_complexity/iteration_and_recursion.assets/nested_iteration.png similarity index 100% rename from docs-en/chapter_computational_complexity/iteration_and_recursion.assets/nested_iteration.png rename to en/docs/chapter_computational_complexity/iteration_and_recursion.assets/nested_iteration.png diff --git a/docs-en/chapter_computational_complexity/iteration_and_recursion.assets/recursion_sum.png b/en/docs/chapter_computational_complexity/iteration_and_recursion.assets/recursion_sum.png similarity index 100% rename from docs-en/chapter_computational_complexity/iteration_and_recursion.assets/recursion_sum.png rename to en/docs/chapter_computational_complexity/iteration_and_recursion.assets/recursion_sum.png diff --git a/docs-en/chapter_computational_complexity/iteration_and_recursion.assets/recursion_sum_depth.png b/en/docs/chapter_computational_complexity/iteration_and_recursion.assets/recursion_sum_depth.png similarity index 100% rename from docs-en/chapter_computational_complexity/iteration_and_recursion.assets/recursion_sum_depth.png rename to en/docs/chapter_computational_complexity/iteration_and_recursion.assets/recursion_sum_depth.png diff --git a/docs-en/chapter_computational_complexity/iteration_and_recursion.assets/recursion_tree.png b/en/docs/chapter_computational_complexity/iteration_and_recursion.assets/recursion_tree.png similarity index 100% rename from docs-en/chapter_computational_complexity/iteration_and_recursion.assets/recursion_tree.png rename to en/docs/chapter_computational_complexity/iteration_and_recursion.assets/recursion_tree.png diff --git a/docs-en/chapter_computational_complexity/iteration_and_recursion.assets/tail_recursion_sum.png b/en/docs/chapter_computational_complexity/iteration_and_recursion.assets/tail_recursion_sum.png similarity index 100% rename from docs-en/chapter_computational_complexity/iteration_and_recursion.assets/tail_recursion_sum.png rename to en/docs/chapter_computational_complexity/iteration_and_recursion.assets/tail_recursion_sum.png diff --git a/docs-en/chapter_computational_complexity/iteration_and_recursion.md b/en/docs/chapter_computational_complexity/iteration_and_recursion.md similarity index 100% rename from docs-en/chapter_computational_complexity/iteration_and_recursion.md rename to en/docs/chapter_computational_complexity/iteration_and_recursion.md diff --git a/docs-en/chapter_computational_complexity/performance_evaluation.md b/en/docs/chapter_computational_complexity/performance_evaluation.md similarity index 100% rename from docs-en/chapter_computational_complexity/performance_evaluation.md rename to en/docs/chapter_computational_complexity/performance_evaluation.md diff --git a/docs-en/chapter_computational_complexity/space_complexity.assets/space_complexity_common_types.png b/en/docs/chapter_computational_complexity/space_complexity.assets/space_complexity_common_types.png similarity index 100% rename from docs-en/chapter_computational_complexity/space_complexity.assets/space_complexity_common_types.png rename to en/docs/chapter_computational_complexity/space_complexity.assets/space_complexity_common_types.png diff --git a/docs-en/chapter_computational_complexity/space_complexity.assets/space_complexity_exponential.png b/en/docs/chapter_computational_complexity/space_complexity.assets/space_complexity_exponential.png similarity index 100% rename from docs-en/chapter_computational_complexity/space_complexity.assets/space_complexity_exponential.png rename to en/docs/chapter_computational_complexity/space_complexity.assets/space_complexity_exponential.png diff --git a/docs-en/chapter_computational_complexity/space_complexity.assets/space_complexity_recursive_linear.png b/en/docs/chapter_computational_complexity/space_complexity.assets/space_complexity_recursive_linear.png similarity index 100% rename from docs-en/chapter_computational_complexity/space_complexity.assets/space_complexity_recursive_linear.png rename to en/docs/chapter_computational_complexity/space_complexity.assets/space_complexity_recursive_linear.png diff --git a/docs-en/chapter_computational_complexity/space_complexity.assets/space_complexity_recursive_quadratic.png b/en/docs/chapter_computational_complexity/space_complexity.assets/space_complexity_recursive_quadratic.png similarity index 100% rename from docs-en/chapter_computational_complexity/space_complexity.assets/space_complexity_recursive_quadratic.png rename to en/docs/chapter_computational_complexity/space_complexity.assets/space_complexity_recursive_quadratic.png diff --git a/docs-en/chapter_computational_complexity/space_complexity.assets/space_types.png b/en/docs/chapter_computational_complexity/space_complexity.assets/space_types.png similarity index 100% rename from docs-en/chapter_computational_complexity/space_complexity.assets/space_types.png rename to en/docs/chapter_computational_complexity/space_complexity.assets/space_types.png diff --git a/docs-en/chapter_computational_complexity/space_complexity.md b/en/docs/chapter_computational_complexity/space_complexity.md similarity index 99% rename from docs-en/chapter_computational_complexity/space_complexity.md rename to en/docs/chapter_computational_complexity/space_complexity.md index 6e7be8104..85f5f08d0 100644 --- a/docs-en/chapter_computational_complexity/space_complexity.md +++ b/en/docs/chapter_computational_complexity/space_complexity.md @@ -310,6 +310,12 @@ The relevant code is as follows: } ``` +=== "Kotlin" + + ```kotlin title="" + + ``` + === "Zig" ```zig title="" @@ -456,6 +462,12 @@ Consider the following code, the term "worst-case" in worst-case space complexit } ``` +=== "Kotlin" + + ```kotlin title="" + + ``` + === "Zig" ```zig title="" @@ -694,6 +706,12 @@ Consider the following code, the term "worst-case" in worst-case space complexit } ``` +=== "Kotlin" + + ```kotlin title="" + + ``` + === "Zig" ```zig title="" diff --git a/docs-en/chapter_computational_complexity/summary.md b/en/docs/chapter_computational_complexity/summary.md similarity index 100% rename from docs-en/chapter_computational_complexity/summary.md rename to en/docs/chapter_computational_complexity/summary.md diff --git a/docs-en/chapter_computational_complexity/time_complexity.assets/asymptotic_upper_bound.png b/en/docs/chapter_computational_complexity/time_complexity.assets/asymptotic_upper_bound.png similarity index 100% rename from docs-en/chapter_computational_complexity/time_complexity.assets/asymptotic_upper_bound.png rename to en/docs/chapter_computational_complexity/time_complexity.assets/asymptotic_upper_bound.png diff --git a/docs-en/chapter_computational_complexity/time_complexity.assets/time_complexity_common_types.png b/en/docs/chapter_computational_complexity/time_complexity.assets/time_complexity_common_types.png similarity index 100% rename from docs-en/chapter_computational_complexity/time_complexity.assets/time_complexity_common_types.png rename to en/docs/chapter_computational_complexity/time_complexity.assets/time_complexity_common_types.png diff --git a/docs-en/chapter_computational_complexity/time_complexity.assets/time_complexity_constant_linear_quadratic.png b/en/docs/chapter_computational_complexity/time_complexity.assets/time_complexity_constant_linear_quadratic.png similarity index 100% rename from docs-en/chapter_computational_complexity/time_complexity.assets/time_complexity_constant_linear_quadratic.png rename to en/docs/chapter_computational_complexity/time_complexity.assets/time_complexity_constant_linear_quadratic.png diff --git a/docs-en/chapter_computational_complexity/time_complexity.assets/time_complexity_exponential.png b/en/docs/chapter_computational_complexity/time_complexity.assets/time_complexity_exponential.png similarity index 100% rename from docs-en/chapter_computational_complexity/time_complexity.assets/time_complexity_exponential.png rename to en/docs/chapter_computational_complexity/time_complexity.assets/time_complexity_exponential.png diff --git a/docs-en/chapter_computational_complexity/time_complexity.assets/time_complexity_factorial.png b/en/docs/chapter_computational_complexity/time_complexity.assets/time_complexity_factorial.png similarity index 100% rename from docs-en/chapter_computational_complexity/time_complexity.assets/time_complexity_factorial.png rename to en/docs/chapter_computational_complexity/time_complexity.assets/time_complexity_factorial.png diff --git a/docs-en/chapter_computational_complexity/time_complexity.assets/time_complexity_logarithmic.png b/en/docs/chapter_computational_complexity/time_complexity.assets/time_complexity_logarithmic.png similarity index 100% rename from docs-en/chapter_computational_complexity/time_complexity.assets/time_complexity_logarithmic.png rename to en/docs/chapter_computational_complexity/time_complexity.assets/time_complexity_logarithmic.png diff --git a/docs-en/chapter_computational_complexity/time_complexity.assets/time_complexity_logarithmic_linear.png b/en/docs/chapter_computational_complexity/time_complexity.assets/time_complexity_logarithmic_linear.png similarity index 100% rename from docs-en/chapter_computational_complexity/time_complexity.assets/time_complexity_logarithmic_linear.png rename to en/docs/chapter_computational_complexity/time_complexity.assets/time_complexity_logarithmic_linear.png diff --git a/docs-en/chapter_computational_complexity/time_complexity.assets/time_complexity_simple_example.png b/en/docs/chapter_computational_complexity/time_complexity.assets/time_complexity_simple_example.png similarity index 100% rename from docs-en/chapter_computational_complexity/time_complexity.assets/time_complexity_simple_example.png rename to en/docs/chapter_computational_complexity/time_complexity.assets/time_complexity_simple_example.png diff --git a/docs-en/chapter_computational_complexity/time_complexity.md b/en/docs/chapter_computational_complexity/time_complexity.md similarity index 99% rename from docs-en/chapter_computational_complexity/time_complexity.md rename to en/docs/chapter_computational_complexity/time_complexity.md index 194c02047..549d1d7bf 100644 --- a/docs-en/chapter_computational_complexity/time_complexity.md +++ b/en/docs/chapter_computational_complexity/time_complexity.md @@ -171,6 +171,12 @@ For example, consider the following code with an input size of $n$: } ``` +=== "Kotlin" + + ```kotlin title="" + + ``` + === "Zig" ```zig title="" @@ -429,6 +435,12 @@ Let's understand this concept of "time growth trend" with an example. Assume the } ``` +=== "Kotlin" + + ```kotlin title="" + + ``` + === "Zig" ```zig title="" @@ -623,6 +635,12 @@ Consider a function with an input size of $n$: } ``` +=== "Kotlin" + + ```kotlin title="" + + ``` + === "Zig" ```zig title="" @@ -878,6 +896,12 @@ Given a function, we can use these techniques to count operations: } ``` +=== "Kotlin" + + ```kotlin title="" + + ``` + === "Zig" ```zig title="" diff --git a/docs-en/chapter_data_structure/basic_data_types.md b/en/docs/chapter_data_structure/basic_data_types.md similarity index 99% rename from docs-en/chapter_data_structure/basic_data_types.md rename to en/docs/chapter_data_structure/basic_data_types.md index 0eed870eb..0e91f86b2 100644 --- a/docs-en/chapter_data_structure/basic_data_types.md +++ b/en/docs/chapter_data_structure/basic_data_types.md @@ -153,6 +153,12 @@ In other words, **basic data types provide the "content type" of data, while dat bool bools[10]; ``` +=== "Kotlin" + + ```kotlin title="" + + ``` + === "Zig" ```zig title="" diff --git a/docs-en/chapter_data_structure/character_encoding.assets/ascii_table.png b/en/docs/chapter_data_structure/character_encoding.assets/ascii_table.png similarity index 100% rename from docs-en/chapter_data_structure/character_encoding.assets/ascii_table.png rename to en/docs/chapter_data_structure/character_encoding.assets/ascii_table.png diff --git a/docs-en/chapter_data_structure/character_encoding.assets/unicode_hello_algo.png b/en/docs/chapter_data_structure/character_encoding.assets/unicode_hello_algo.png similarity index 100% rename from docs-en/chapter_data_structure/character_encoding.assets/unicode_hello_algo.png rename to en/docs/chapter_data_structure/character_encoding.assets/unicode_hello_algo.png diff --git a/docs-en/chapter_data_structure/character_encoding.assets/utf-8_hello_algo.png b/en/docs/chapter_data_structure/character_encoding.assets/utf-8_hello_algo.png similarity index 100% rename from docs-en/chapter_data_structure/character_encoding.assets/utf-8_hello_algo.png rename to en/docs/chapter_data_structure/character_encoding.assets/utf-8_hello_algo.png diff --git a/docs-en/chapter_data_structure/character_encoding.md b/en/docs/chapter_data_structure/character_encoding.md similarity index 100% rename from docs-en/chapter_data_structure/character_encoding.md rename to en/docs/chapter_data_structure/character_encoding.md diff --git a/docs-en/chapter_data_structure/classification_of_data_structure.assets/classification_logic_structure.png b/en/docs/chapter_data_structure/classification_of_data_structure.assets/classification_logic_structure.png similarity index 100% rename from docs-en/chapter_data_structure/classification_of_data_structure.assets/classification_logic_structure.png rename to en/docs/chapter_data_structure/classification_of_data_structure.assets/classification_logic_structure.png diff --git a/docs-en/chapter_data_structure/classification_of_data_structure.assets/classification_phisical_structure.png b/en/docs/chapter_data_structure/classification_of_data_structure.assets/classification_phisical_structure.png similarity index 100% rename from docs-en/chapter_data_structure/classification_of_data_structure.assets/classification_phisical_structure.png rename to en/docs/chapter_data_structure/classification_of_data_structure.assets/classification_phisical_structure.png diff --git a/docs-en/chapter_data_structure/classification_of_data_structure.assets/computer_memory_location.png b/en/docs/chapter_data_structure/classification_of_data_structure.assets/computer_memory_location.png similarity index 100% rename from docs-en/chapter_data_structure/classification_of_data_structure.assets/computer_memory_location.png rename to en/docs/chapter_data_structure/classification_of_data_structure.assets/computer_memory_location.png diff --git a/docs-en/chapter_data_structure/classification_of_data_structure.md b/en/docs/chapter_data_structure/classification_of_data_structure.md similarity index 100% rename from docs-en/chapter_data_structure/classification_of_data_structure.md rename to en/docs/chapter_data_structure/classification_of_data_structure.md diff --git a/docs-en/chapter_data_structure/index.md b/en/docs/chapter_data_structure/index.md similarity index 100% rename from docs-en/chapter_data_structure/index.md rename to en/docs/chapter_data_structure/index.md diff --git a/docs-en/chapter_data_structure/number_encoding.assets/1s_2s_complement.png b/en/docs/chapter_data_structure/number_encoding.assets/1s_2s_complement.png similarity index 100% rename from docs-en/chapter_data_structure/number_encoding.assets/1s_2s_complement.png rename to en/docs/chapter_data_structure/number_encoding.assets/1s_2s_complement.png diff --git a/docs-en/chapter_data_structure/number_encoding.assets/ieee_754_float.png b/en/docs/chapter_data_structure/number_encoding.assets/ieee_754_float.png similarity index 100% rename from docs-en/chapter_data_structure/number_encoding.assets/ieee_754_float.png rename to en/docs/chapter_data_structure/number_encoding.assets/ieee_754_float.png diff --git a/docs-en/chapter_data_structure/number_encoding.md b/en/docs/chapter_data_structure/number_encoding.md similarity index 100% rename from docs-en/chapter_data_structure/number_encoding.md rename to en/docs/chapter_data_structure/number_encoding.md diff --git a/docs-en/chapter_data_structure/summary.md b/en/docs/chapter_data_structure/summary.md similarity index 100% rename from docs-en/chapter_data_structure/summary.md rename to en/docs/chapter_data_structure/summary.md diff --git a/docs-en/chapter_hashing/hash_algorithm.assets/hash_collision_best_worst_condition.png b/en/docs/chapter_hashing/hash_algorithm.assets/hash_collision_best_worst_condition.png similarity index 100% rename from docs-en/chapter_hashing/hash_algorithm.assets/hash_collision_best_worst_condition.png rename to en/docs/chapter_hashing/hash_algorithm.assets/hash_collision_best_worst_condition.png diff --git a/docs-en/chapter_hashing/hash_algorithm.md b/en/docs/chapter_hashing/hash_algorithm.md similarity index 99% rename from docs-en/chapter_hashing/hash_algorithm.md rename to en/docs/chapter_hashing/hash_algorithm.md index fa57e4a66..cdeb9ea1d 100644 --- a/docs-en/chapter_hashing/hash_algorithm.md +++ b/en/docs/chapter_hashing/hash_algorithm.md @@ -343,6 +343,12 @@ We know that the keys in a hash table can be of various data types such as integ // C does not provide built-in hash code functions ``` +=== "Kotlin" + + ```kotlin title="built_in_hash.kt" + + ``` + === "Zig" ```zig title="built_in_hash.zig" diff --git a/docs-en/chapter_hashing/hash_collision.assets/hash_table_chaining.png b/en/docs/chapter_hashing/hash_collision.assets/hash_table_chaining.png similarity index 100% rename from docs-en/chapter_hashing/hash_collision.assets/hash_table_chaining.png rename to en/docs/chapter_hashing/hash_collision.assets/hash_table_chaining.png diff --git a/docs-en/chapter_hashing/hash_collision.assets/hash_table_linear_probing.png b/en/docs/chapter_hashing/hash_collision.assets/hash_table_linear_probing.png similarity index 100% rename from docs-en/chapter_hashing/hash_collision.assets/hash_table_linear_probing.png rename to en/docs/chapter_hashing/hash_collision.assets/hash_table_linear_probing.png diff --git a/docs-en/chapter_hashing/hash_collision.assets/hash_table_open_addressing_deletion.png b/en/docs/chapter_hashing/hash_collision.assets/hash_table_open_addressing_deletion.png similarity index 100% rename from docs-en/chapter_hashing/hash_collision.assets/hash_table_open_addressing_deletion.png rename to en/docs/chapter_hashing/hash_collision.assets/hash_table_open_addressing_deletion.png diff --git a/docs-en/chapter_hashing/hash_collision.md b/en/docs/chapter_hashing/hash_collision.md similarity index 100% rename from docs-en/chapter_hashing/hash_collision.md rename to en/docs/chapter_hashing/hash_collision.md diff --git a/docs-en/chapter_hashing/hash_map.assets/hash_collision.png b/en/docs/chapter_hashing/hash_map.assets/hash_collision.png similarity index 100% rename from docs-en/chapter_hashing/hash_map.assets/hash_collision.png rename to en/docs/chapter_hashing/hash_map.assets/hash_collision.png diff --git a/docs-en/chapter_hashing/hash_map.assets/hash_function.png b/en/docs/chapter_hashing/hash_map.assets/hash_function.png similarity index 100% rename from docs-en/chapter_hashing/hash_map.assets/hash_function.png rename to en/docs/chapter_hashing/hash_map.assets/hash_function.png diff --git a/docs-en/chapter_hashing/hash_map.assets/hash_table_lookup.png b/en/docs/chapter_hashing/hash_map.assets/hash_table_lookup.png similarity index 100% rename from docs-en/chapter_hashing/hash_map.assets/hash_table_lookup.png rename to en/docs/chapter_hashing/hash_map.assets/hash_table_lookup.png diff --git a/docs-en/chapter_hashing/hash_map.assets/hash_table_reshash.png b/en/docs/chapter_hashing/hash_map.assets/hash_table_reshash.png similarity index 100% rename from docs-en/chapter_hashing/hash_map.assets/hash_table_reshash.png rename to en/docs/chapter_hashing/hash_map.assets/hash_table_reshash.png diff --git a/docs-en/chapter_hashing/hash_map.md b/en/docs/chapter_hashing/hash_map.md similarity index 99% rename from docs-en/chapter_hashing/hash_map.md rename to en/docs/chapter_hashing/hash_map.md index 6a7e47722..18dafbf2c 100755 --- a/docs-en/chapter_hashing/hash_map.md +++ b/en/docs/chapter_hashing/hash_map.md @@ -267,6 +267,12 @@ Common operations of a hash table include initialization, querying, adding key-v // C does not provide a built-in hash table ``` +=== "Kotlin" + + ```kotlin title="hash_map.kt" + + ``` + === "Zig" ```zig title="hash_map.zig" @@ -462,6 +468,12 @@ There are three common ways to traverse a hash table: traversing key-value pairs // C does not provide a built-in hash table ``` +=== "Kotlin" + + ```kotlin title="hash_map.kt" + + ``` + === "Zig" ```zig title="hash_map.zig" diff --git a/docs-en/chapter_hashing/index.md b/en/docs/chapter_hashing/index.md similarity index 100% rename from docs-en/chapter_hashing/index.md rename to en/docs/chapter_hashing/index.md diff --git a/docs-en/chapter_hashing/summary.md b/en/docs/chapter_hashing/summary.md similarity index 100% rename from docs-en/chapter_hashing/summary.md rename to en/docs/chapter_hashing/summary.md diff --git a/docs-en/chapter_introduction/algorithms_are_everywhere.assets/binary_search_dictionary_step1.png b/en/docs/chapter_introduction/algorithms_are_everywhere.assets/binary_search_dictionary_step1.png similarity index 100% rename from docs-en/chapter_introduction/algorithms_are_everywhere.assets/binary_search_dictionary_step1.png rename to en/docs/chapter_introduction/algorithms_are_everywhere.assets/binary_search_dictionary_step1.png diff --git a/docs-en/chapter_introduction/algorithms_are_everywhere.assets/binary_search_dictionary_step2.png b/en/docs/chapter_introduction/algorithms_are_everywhere.assets/binary_search_dictionary_step2.png similarity index 100% rename from docs-en/chapter_introduction/algorithms_are_everywhere.assets/binary_search_dictionary_step2.png rename to en/docs/chapter_introduction/algorithms_are_everywhere.assets/binary_search_dictionary_step2.png diff --git a/docs-en/chapter_introduction/algorithms_are_everywhere.assets/binary_search_dictionary_step3.png b/en/docs/chapter_introduction/algorithms_are_everywhere.assets/binary_search_dictionary_step3.png similarity index 100% rename from docs-en/chapter_introduction/algorithms_are_everywhere.assets/binary_search_dictionary_step3.png rename to en/docs/chapter_introduction/algorithms_are_everywhere.assets/binary_search_dictionary_step3.png diff --git a/docs-en/chapter_introduction/algorithms_are_everywhere.assets/binary_search_dictionary_step4.png b/en/docs/chapter_introduction/algorithms_are_everywhere.assets/binary_search_dictionary_step4.png similarity index 100% rename from docs-en/chapter_introduction/algorithms_are_everywhere.assets/binary_search_dictionary_step4.png rename to en/docs/chapter_introduction/algorithms_are_everywhere.assets/binary_search_dictionary_step4.png diff --git a/docs-en/chapter_introduction/algorithms_are_everywhere.assets/binary_search_dictionary_step5.png b/en/docs/chapter_introduction/algorithms_are_everywhere.assets/binary_search_dictionary_step5.png similarity index 100% rename from docs-en/chapter_introduction/algorithms_are_everywhere.assets/binary_search_dictionary_step5.png rename to en/docs/chapter_introduction/algorithms_are_everywhere.assets/binary_search_dictionary_step5.png diff --git a/docs-en/chapter_introduction/algorithms_are_everywhere.assets/greedy_change.png b/en/docs/chapter_introduction/algorithms_are_everywhere.assets/greedy_change.png similarity index 100% rename from docs-en/chapter_introduction/algorithms_are_everywhere.assets/greedy_change.png rename to en/docs/chapter_introduction/algorithms_are_everywhere.assets/greedy_change.png diff --git a/docs-en/chapter_introduction/algorithms_are_everywhere.assets/playing_cards_sorting.png b/en/docs/chapter_introduction/algorithms_are_everywhere.assets/playing_cards_sorting.png similarity index 100% rename from docs-en/chapter_introduction/algorithms_are_everywhere.assets/playing_cards_sorting.png rename to en/docs/chapter_introduction/algorithms_are_everywhere.assets/playing_cards_sorting.png diff --git a/docs-en/chapter_introduction/algorithms_are_everywhere.md b/en/docs/chapter_introduction/algorithms_are_everywhere.md similarity index 100% rename from docs-en/chapter_introduction/algorithms_are_everywhere.md rename to en/docs/chapter_introduction/algorithms_are_everywhere.md diff --git a/docs-en/chapter_introduction/index.md b/en/docs/chapter_introduction/index.md similarity index 100% rename from docs-en/chapter_introduction/index.md rename to en/docs/chapter_introduction/index.md diff --git a/docs-en/chapter_introduction/summary.md b/en/docs/chapter_introduction/summary.md similarity index 100% rename from docs-en/chapter_introduction/summary.md rename to en/docs/chapter_introduction/summary.md diff --git a/docs-en/chapter_introduction/what_is_dsa.assets/assembling_blocks.png b/en/docs/chapter_introduction/what_is_dsa.assets/assembling_blocks.png similarity index 100% rename from docs-en/chapter_introduction/what_is_dsa.assets/assembling_blocks.png rename to en/docs/chapter_introduction/what_is_dsa.assets/assembling_blocks.png diff --git a/docs-en/chapter_introduction/what_is_dsa.assets/relationship_between_data_structure_and_algorithm.png b/en/docs/chapter_introduction/what_is_dsa.assets/relationship_between_data_structure_and_algorithm.png similarity index 100% rename from docs-en/chapter_introduction/what_is_dsa.assets/relationship_between_data_structure_and_algorithm.png rename to en/docs/chapter_introduction/what_is_dsa.assets/relationship_between_data_structure_and_algorithm.png diff --git a/docs-en/chapter_introduction/what_is_dsa.md b/en/docs/chapter_introduction/what_is_dsa.md similarity index 100% rename from docs-en/chapter_introduction/what_is_dsa.md rename to en/docs/chapter_introduction/what_is_dsa.md diff --git a/docs-en/chapter_preface/about_the_book.assets/hello_algo_mindmap.png b/en/docs/chapter_preface/about_the_book.assets/hello_algo_mindmap.png similarity index 100% rename from docs-en/chapter_preface/about_the_book.assets/hello_algo_mindmap.png rename to en/docs/chapter_preface/about_the_book.assets/hello_algo_mindmap.png diff --git a/docs-en/chapter_preface/about_the_book.md b/en/docs/chapter_preface/about_the_book.md similarity index 100% rename from docs-en/chapter_preface/about_the_book.md rename to en/docs/chapter_preface/about_the_book.md diff --git a/docs-en/chapter_preface/index.md b/en/docs/chapter_preface/index.md similarity index 100% rename from docs-en/chapter_preface/index.md rename to en/docs/chapter_preface/index.md diff --git a/docs-en/chapter_preface/suggestions.assets/code_md_to_repo.png b/en/docs/chapter_preface/suggestions.assets/code_md_to_repo.png similarity index 100% rename from docs-en/chapter_preface/suggestions.assets/code_md_to_repo.png rename to en/docs/chapter_preface/suggestions.assets/code_md_to_repo.png diff --git a/docs-en/chapter_preface/suggestions.assets/download_code.png b/en/docs/chapter_preface/suggestions.assets/download_code.png similarity index 100% rename from docs-en/chapter_preface/suggestions.assets/download_code.png rename to en/docs/chapter_preface/suggestions.assets/download_code.png diff --git a/docs-en/chapter_preface/suggestions.assets/learning_route.png b/en/docs/chapter_preface/suggestions.assets/learning_route.png similarity index 100% rename from docs-en/chapter_preface/suggestions.assets/learning_route.png rename to en/docs/chapter_preface/suggestions.assets/learning_route.png diff --git a/docs-en/chapter_preface/suggestions.assets/pythontutor_example.png b/en/docs/chapter_preface/suggestions.assets/pythontutor_example.png similarity index 100% rename from docs-en/chapter_preface/suggestions.assets/pythontutor_example.png rename to en/docs/chapter_preface/suggestions.assets/pythontutor_example.png diff --git a/docs-en/chapter_preface/suggestions.md b/en/docs/chapter_preface/suggestions.md similarity index 97% rename from docs-en/chapter_preface/suggestions.md rename to en/docs/chapter_preface/suggestions.md index f59b2b989..deeab6813 100644 --- a/docs-en/chapter_preface/suggestions.md +++ b/en/docs/chapter_preface/suggestions.md @@ -156,6 +156,19 @@ */ ``` +=== "Kotlin" + + ```kotlin title="" + /* Header comments for labeling functions, classes, test samples, etc */ + + // Comments for explaining details. + + /** + * Multiline + * comments + */ + ``` + === "Zig" ```zig title="" diff --git a/docs-en/chapter_preface/summary.md b/en/docs/chapter_preface/summary.md similarity index 100% rename from docs-en/chapter_preface/summary.md rename to en/docs/chapter_preface/summary.md diff --git a/docs-en/chapter_stack_and_queue/deque.assets/array_deque_step1.png b/en/docs/chapter_stack_and_queue/deque.assets/array_deque_step1.png similarity index 100% rename from docs-en/chapter_stack_and_queue/deque.assets/array_deque_step1.png rename to en/docs/chapter_stack_and_queue/deque.assets/array_deque_step1.png diff --git a/docs-en/chapter_stack_and_queue/deque.assets/array_deque_step2_push_last.png b/en/docs/chapter_stack_and_queue/deque.assets/array_deque_step2_push_last.png similarity index 100% rename from docs-en/chapter_stack_and_queue/deque.assets/array_deque_step2_push_last.png rename to en/docs/chapter_stack_and_queue/deque.assets/array_deque_step2_push_last.png diff --git a/docs-en/chapter_stack_and_queue/deque.assets/array_deque_step3_push_first.png b/en/docs/chapter_stack_and_queue/deque.assets/array_deque_step3_push_first.png similarity index 100% rename from docs-en/chapter_stack_and_queue/deque.assets/array_deque_step3_push_first.png rename to en/docs/chapter_stack_and_queue/deque.assets/array_deque_step3_push_first.png diff --git a/docs-en/chapter_stack_and_queue/deque.assets/array_deque_step4_pop_last.png b/en/docs/chapter_stack_and_queue/deque.assets/array_deque_step4_pop_last.png similarity index 100% rename from docs-en/chapter_stack_and_queue/deque.assets/array_deque_step4_pop_last.png rename to en/docs/chapter_stack_and_queue/deque.assets/array_deque_step4_pop_last.png diff --git a/docs-en/chapter_stack_and_queue/deque.assets/array_deque_step5_pop_first.png b/en/docs/chapter_stack_and_queue/deque.assets/array_deque_step5_pop_first.png similarity index 100% rename from docs-en/chapter_stack_and_queue/deque.assets/array_deque_step5_pop_first.png rename to en/docs/chapter_stack_and_queue/deque.assets/array_deque_step5_pop_first.png diff --git a/docs-en/chapter_stack_and_queue/deque.assets/deque_operations.png b/en/docs/chapter_stack_and_queue/deque.assets/deque_operations.png similarity index 100% rename from docs-en/chapter_stack_and_queue/deque.assets/deque_operations.png rename to en/docs/chapter_stack_and_queue/deque.assets/deque_operations.png diff --git a/docs-en/chapter_stack_and_queue/deque.assets/linkedlist_deque_step1.png b/en/docs/chapter_stack_and_queue/deque.assets/linkedlist_deque_step1.png similarity index 100% rename from docs-en/chapter_stack_and_queue/deque.assets/linkedlist_deque_step1.png rename to en/docs/chapter_stack_and_queue/deque.assets/linkedlist_deque_step1.png diff --git a/docs-en/chapter_stack_and_queue/deque.assets/linkedlist_deque_step2_push_last.png b/en/docs/chapter_stack_and_queue/deque.assets/linkedlist_deque_step2_push_last.png similarity index 100% rename from docs-en/chapter_stack_and_queue/deque.assets/linkedlist_deque_step2_push_last.png rename to en/docs/chapter_stack_and_queue/deque.assets/linkedlist_deque_step2_push_last.png diff --git a/docs-en/chapter_stack_and_queue/deque.assets/linkedlist_deque_step3_push_first.png b/en/docs/chapter_stack_and_queue/deque.assets/linkedlist_deque_step3_push_first.png similarity index 100% rename from docs-en/chapter_stack_and_queue/deque.assets/linkedlist_deque_step3_push_first.png rename to en/docs/chapter_stack_and_queue/deque.assets/linkedlist_deque_step3_push_first.png diff --git a/docs-en/chapter_stack_and_queue/deque.assets/linkedlist_deque_step4_pop_last.png b/en/docs/chapter_stack_and_queue/deque.assets/linkedlist_deque_step4_pop_last.png similarity index 100% rename from docs-en/chapter_stack_and_queue/deque.assets/linkedlist_deque_step4_pop_last.png rename to en/docs/chapter_stack_and_queue/deque.assets/linkedlist_deque_step4_pop_last.png diff --git a/docs-en/chapter_stack_and_queue/deque.assets/linkedlist_deque_step5_pop_first.png b/en/docs/chapter_stack_and_queue/deque.assets/linkedlist_deque_step5_pop_first.png similarity index 100% rename from docs-en/chapter_stack_and_queue/deque.assets/linkedlist_deque_step5_pop_first.png rename to en/docs/chapter_stack_and_queue/deque.assets/linkedlist_deque_step5_pop_first.png diff --git a/docs-en/chapter_stack_and_queue/deque.md b/en/docs/chapter_stack_and_queue/deque.md similarity index 99% rename from docs-en/chapter_stack_and_queue/deque.md rename to en/docs/chapter_stack_and_queue/deque.md index c2797296b..3fb0a146f 100644 --- a/docs-en/chapter_stack_and_queue/deque.md +++ b/en/docs/chapter_stack_and_queue/deque.md @@ -324,6 +324,12 @@ Similarly, we can directly use the double-ended queue classes implemented in pro // C does not provide a built-in deque ``` +=== "Kotlin" + + ```kotlin title="deque.kt" + + ``` + === "Zig" ```zig title="deque.zig" @@ -389,7 +395,7 @@ As shown in the figure below, similar to implementing a queue with an array, we The implementation only needs to add methods for "front enqueue" and "rear dequeue": ```src -[file]{array_deque}-[func]{} +[file]{array_deque}-[class]{array_deque}-[func]{} ``` ## Applications of Double-Ended Queue diff --git a/docs-en/chapter_stack_and_queue/index.md b/en/docs/chapter_stack_and_queue/index.md similarity index 100% rename from docs-en/chapter_stack_and_queue/index.md rename to en/docs/chapter_stack_and_queue/index.md diff --git a/docs-en/chapter_stack_and_queue/queue.assets/array_queue_step1.png b/en/docs/chapter_stack_and_queue/queue.assets/array_queue_step1.png similarity index 100% rename from docs-en/chapter_stack_and_queue/queue.assets/array_queue_step1.png rename to en/docs/chapter_stack_and_queue/queue.assets/array_queue_step1.png diff --git a/docs-en/chapter_stack_and_queue/queue.assets/array_queue_step2_push.png b/en/docs/chapter_stack_and_queue/queue.assets/array_queue_step2_push.png similarity index 100% rename from docs-en/chapter_stack_and_queue/queue.assets/array_queue_step2_push.png rename to en/docs/chapter_stack_and_queue/queue.assets/array_queue_step2_push.png diff --git a/docs-en/chapter_stack_and_queue/queue.assets/array_queue_step3_pop.png b/en/docs/chapter_stack_and_queue/queue.assets/array_queue_step3_pop.png similarity index 100% rename from docs-en/chapter_stack_and_queue/queue.assets/array_queue_step3_pop.png rename to en/docs/chapter_stack_and_queue/queue.assets/array_queue_step3_pop.png diff --git a/docs-en/chapter_stack_and_queue/queue.assets/linkedlist_queue_step1.png b/en/docs/chapter_stack_and_queue/queue.assets/linkedlist_queue_step1.png similarity index 100% rename from docs-en/chapter_stack_and_queue/queue.assets/linkedlist_queue_step1.png rename to en/docs/chapter_stack_and_queue/queue.assets/linkedlist_queue_step1.png diff --git a/docs-en/chapter_stack_and_queue/queue.assets/linkedlist_queue_step2_push.png b/en/docs/chapter_stack_and_queue/queue.assets/linkedlist_queue_step2_push.png similarity index 100% rename from docs-en/chapter_stack_and_queue/queue.assets/linkedlist_queue_step2_push.png rename to en/docs/chapter_stack_and_queue/queue.assets/linkedlist_queue_step2_push.png diff --git a/docs-en/chapter_stack_and_queue/queue.assets/linkedlist_queue_step3_pop.png b/en/docs/chapter_stack_and_queue/queue.assets/linkedlist_queue_step3_pop.png similarity index 100% rename from docs-en/chapter_stack_and_queue/queue.assets/linkedlist_queue_step3_pop.png rename to en/docs/chapter_stack_and_queue/queue.assets/linkedlist_queue_step3_pop.png diff --git a/docs-en/chapter_stack_and_queue/queue.assets/queue_operations.png b/en/docs/chapter_stack_and_queue/queue.assets/queue_operations.png similarity index 100% rename from docs-en/chapter_stack_and_queue/queue.assets/queue_operations.png rename to en/docs/chapter_stack_and_queue/queue.assets/queue_operations.png diff --git a/docs-en/chapter_stack_and_queue/queue.md b/en/docs/chapter_stack_and_queue/queue.md similarity index 99% rename from docs-en/chapter_stack_and_queue/queue.md rename to en/docs/chapter_stack_and_queue/queue.md index 8c0f25215..cffeb47c5 100755 --- a/docs-en/chapter_stack_and_queue/queue.md +++ b/en/docs/chapter_stack_and_queue/queue.md @@ -302,6 +302,12 @@ We can directly use the ready-made queue classes in programming languages: // C does not provide a built-in queue ``` +=== "Kotlin" + + ```kotlin title="queue.kt" + + ``` + === "Zig" ```zig title="queue.zig" diff --git a/docs-en/chapter_stack_and_queue/stack.assets/array_stack_step1.png b/en/docs/chapter_stack_and_queue/stack.assets/array_stack_step1.png similarity index 100% rename from docs-en/chapter_stack_and_queue/stack.assets/array_stack_step1.png rename to en/docs/chapter_stack_and_queue/stack.assets/array_stack_step1.png diff --git a/docs-en/chapter_stack_and_queue/stack.assets/array_stack_step2_push.png b/en/docs/chapter_stack_and_queue/stack.assets/array_stack_step2_push.png similarity index 100% rename from docs-en/chapter_stack_and_queue/stack.assets/array_stack_step2_push.png rename to en/docs/chapter_stack_and_queue/stack.assets/array_stack_step2_push.png diff --git a/docs-en/chapter_stack_and_queue/stack.assets/array_stack_step3_pop.png b/en/docs/chapter_stack_and_queue/stack.assets/array_stack_step3_pop.png similarity index 100% rename from docs-en/chapter_stack_and_queue/stack.assets/array_stack_step3_pop.png rename to en/docs/chapter_stack_and_queue/stack.assets/array_stack_step3_pop.png diff --git a/docs-en/chapter_stack_and_queue/stack.assets/linkedlist_stack_step1.png b/en/docs/chapter_stack_and_queue/stack.assets/linkedlist_stack_step1.png similarity index 100% rename from docs-en/chapter_stack_and_queue/stack.assets/linkedlist_stack_step1.png rename to en/docs/chapter_stack_and_queue/stack.assets/linkedlist_stack_step1.png diff --git a/docs-en/chapter_stack_and_queue/stack.assets/linkedlist_stack_step2_push.png b/en/docs/chapter_stack_and_queue/stack.assets/linkedlist_stack_step2_push.png similarity index 100% rename from docs-en/chapter_stack_and_queue/stack.assets/linkedlist_stack_step2_push.png rename to en/docs/chapter_stack_and_queue/stack.assets/linkedlist_stack_step2_push.png diff --git a/docs-en/chapter_stack_and_queue/stack.assets/linkedlist_stack_step3_pop.png b/en/docs/chapter_stack_and_queue/stack.assets/linkedlist_stack_step3_pop.png similarity index 100% rename from docs-en/chapter_stack_and_queue/stack.assets/linkedlist_stack_step3_pop.png rename to en/docs/chapter_stack_and_queue/stack.assets/linkedlist_stack_step3_pop.png diff --git a/docs-en/chapter_stack_and_queue/stack.assets/stack_operations.png b/en/docs/chapter_stack_and_queue/stack.assets/stack_operations.png similarity index 100% rename from docs-en/chapter_stack_and_queue/stack.assets/stack_operations.png rename to en/docs/chapter_stack_and_queue/stack.assets/stack_operations.png diff --git a/docs-en/chapter_stack_and_queue/stack.md b/en/docs/chapter_stack_and_queue/stack.md similarity index 99% rename from docs-en/chapter_stack_and_queue/stack.md rename to en/docs/chapter_stack_and_queue/stack.md index 68b24f728..2d72885ca 100755 --- a/docs-en/chapter_stack_and_queue/stack.md +++ b/en/docs/chapter_stack_and_queue/stack.md @@ -296,6 +296,12 @@ Typically, we can directly use the stack class built into the programming langua // C does not provide a built-in stack ``` +=== "Kotlin" + + ```kotlin title="stack.kt" + + ``` + === "Zig" ```zig title="stack.zig" diff --git a/docs-en/chapter_stack_and_queue/summary.md b/en/docs/chapter_stack_and_queue/summary.md similarity index 100% rename from docs-en/chapter_stack_and_queue/summary.md rename to en/docs/chapter_stack_and_queue/summary.md diff --git a/docs-en/index.assets/animation.gif b/en/docs/index.assets/animation.gif similarity index 100% rename from docs-en/index.assets/animation.gif rename to en/docs/index.assets/animation.gif diff --git a/docs-en/index.assets/animation_dark.gif b/en/docs/index.assets/animation_dark.gif similarity index 100% rename from docs-en/index.assets/animation_dark.gif rename to en/docs/index.assets/animation_dark.gif diff --git a/docs-en/index.assets/btn_chinese_edition.svg b/en/docs/index.assets/btn_chinese_edition.svg similarity index 100% rename from docs-en/index.assets/btn_chinese_edition.svg rename to en/docs/index.assets/btn_chinese_edition.svg diff --git a/docs-en/index.assets/btn_chinese_edition_dark.svg b/en/docs/index.assets/btn_chinese_edition_dark.svg similarity index 100% rename from docs-en/index.assets/btn_chinese_edition_dark.svg rename to en/docs/index.assets/btn_chinese_edition_dark.svg diff --git a/docs-en/index.assets/btn_download_pdf.svg b/en/docs/index.assets/btn_download_pdf.svg similarity index 100% rename from docs-en/index.assets/btn_download_pdf.svg rename to en/docs/index.assets/btn_download_pdf.svg diff --git a/docs-en/index.assets/btn_download_pdf_dark.svg b/en/docs/index.assets/btn_download_pdf_dark.svg similarity index 100% rename from docs-en/index.assets/btn_download_pdf_dark.svg rename to en/docs/index.assets/btn_download_pdf_dark.svg diff --git a/docs-en/index.assets/btn_read_online.svg b/en/docs/index.assets/btn_read_online.svg similarity index 100% rename from docs-en/index.assets/btn_read_online.svg rename to en/docs/index.assets/btn_read_online.svg diff --git a/docs-en/index.assets/btn_read_online_dark.svg b/en/docs/index.assets/btn_read_online_dark.svg similarity index 100% rename from docs-en/index.assets/btn_read_online_dark.svg rename to en/docs/index.assets/btn_read_online_dark.svg diff --git a/docs-en/index.assets/comment.gif b/en/docs/index.assets/comment.gif similarity index 100% rename from docs-en/index.assets/comment.gif rename to en/docs/index.assets/comment.gif diff --git a/en/docs/index.assets/hello_algo_header.png b/en/docs/index.assets/hello_algo_header.png new file mode 100644 index 000000000..51e21c54e Binary files /dev/null and b/en/docs/index.assets/hello_algo_header.png differ diff --git a/docs-en/index.assets/hello_algo_mindmap_tp.png b/en/docs/index.assets/hello_algo_mindmap_tp.png similarity index 100% rename from docs-en/index.assets/hello_algo_mindmap_tp.png rename to en/docs/index.assets/hello_algo_mindmap_tp.png diff --git a/docs-en/index.assets/running_code.gif b/en/docs/index.assets/running_code.gif similarity index 100% rename from docs-en/index.assets/running_code.gif rename to en/docs/index.assets/running_code.gif diff --git a/docs-en/index.assets/running_code_dark.gif b/en/docs/index.assets/running_code_dark.gif similarity index 100% rename from docs-en/index.assets/running_code_dark.gif rename to en/docs/index.assets/running_code_dark.gif diff --git a/docs-en/index.md b/en/docs/index.md similarity index 99% rename from docs-en/index.md rename to en/docs/index.md index 591fe676a..9c8b01bed 100644 --- a/docs-en/index.md +++ b/en/docs/index.md @@ -49,8 +49,6 @@ hide:

Feel free to engage in Chinese-to-English translation and pull request review! For guidelines, please see #914.

- -

Quote

diff --git a/mkdocs-en.yml b/en/mkdocs.yml similarity index 98% rename from mkdocs-en.yml rename to en/mkdocs.yml index 903a3841c..1c9183bd7 100644 --- a/mkdocs-en.yml +++ b/en/mkdocs.yml @@ -1,18 +1,19 @@ # Config inheritance -INHERIT: mkdocs.yml +INHERIT: ../mkdocs.yml # Project information site_name: Hello Algo site_url: https://www.hello-algo.com/en/ site_description: "Data Structures and Algorithms Crash Course with Animated Illustrations and Off-the-Shelf Code" -docs_dir: build/docs-en -site_dir: site/en +docs_dir: ../build/en/docs +site_dir: ../site/en # Repository -edit_uri: tree/main/docs-en +edit_uri: tree/main/en/docs version: 1.0.0 # Configuration theme: + custom_dir: ../build/overrides language: en font: text: Roboto diff --git a/overrides/stylesheets/extra.css b/overrides/stylesheets/extra.css index cccaabc20..67f0d38d2 100644 --- a/overrides/stylesheets/extra.css +++ b/overrides/stylesheets/extra.css @@ -207,6 +207,11 @@ body { width: 1.25em; } +/* code block tabs */ +.md-typeset .tabbed-labels>label { + font-size: 0.59rem; +} + /* header banner */ .md-banner { background-color: var(--md-code-bg-color);