Sorting Algorithm

Implemented and benchmarked 12 sorting algorithms under various input conditions.



๐Ÿ’ฌ Thoughts

What I enjoyed most about the sorting algorithm project was seeing just how many different ways there are to solve what seems like the same problem. Thereโ€™s no โ€œbestโ€ sorting algorithm โ€” each one has its strengths depending on the situation, whether itโ€™s input size, distribution, or memory constraints.

It was also fascinating to realize that even something as old and โ€œsolvedโ€ as sorting is still an active area of research, with ideas like hybrid sorting (e.g. TimSort) used in modern languages like C++ and Python. I used to take built-in sort functions for granted, but now I see the layers of design behind them.

Studying lesser-known algorithms like Library Sort through actual papers was honestly hard โ€” especially figuring out the rebalancing logic โ€” but that made it more satisfying. It wasnโ€™t just copy-pasting theory; I had to implement, debug, and understand the weird edge cases on my own.

Also, using Overleaf for the first time felt like writing a real paper โ€” start to finish, with figures, tables, and everything. That gave me a strong sense of completion, way more than a normal homework writeup.

In the end, this project reminded me that even for problems we โ€œunderstand,โ€ thereโ€™s still depth left to explore โ€” and solving them well still takes engineering, not just theory.


๐Ÿ’ฌ ๋А๋‚€ ์ 

์ด๋ฒˆ ์ •๋ ฌ ์•Œ๊ณ ๋ฆฌ์ฆ˜ ํ”„๋กœ์ ํŠธ์—์„œ ๊ฐ€์žฅ ์žฌ๋ฐŒ์—ˆ๋˜ ๊ฑด, ๊ฐ™์€ ์ •๋ ฌ ๋ฌธ์ œ๋ผ๋„ ์•Œ๊ณ ๋ฆฌ์ฆ˜์ด ์ •๋ง ๋‹ค์–‘ํ•˜๋‹ค๋Š” ์ ์ด์—ˆ๋‹ค. ๋ฌด์กฐ๊ฑด ๋น ๋ฅธ ๊ฒŒ ์ข‹์€ ๊ฒŒ ์•„๋‹ˆ๋ผ, ์ƒํ™ฉ(๋ฐ์ดํ„ฐ ๋ถ„ํฌ, ๋ฉ”๋ชจ๋ฆฌ ์ œ์•ฝ, ์ž…๋ ฅ ํฌ๊ธฐ ๋“ฑ)์— ๋”ฐ๋ผ ๊ฐ๊ฐ ์žฅ๋‹จ์ ์ด ๋‹ค๋ฅด๋‹ค๋Š” ๊ฒŒ ์‹ ๊ธฐํ–ˆ๋‹ค.

๋˜, ์ •๋ ฌ์ฒ˜๋Ÿผ ๊ณ ์ „์ ์ด๊ณ  โ€œ์ด๋ฏธ ๋‹ค ์—ฐ๊ตฌ๋œ ๊ฒƒ ๊ฐ™์€ ์ฃผ์ œโ€์—๋„ ์•„์ง๊นŒ์ง€ ํ•˜์ด๋ธŒ๋ฆฌ๋“œ ์•Œ๊ณ ๋ฆฌ์ฆ˜์ฒ˜๋Ÿผ ์ƒˆ๋กœ์šด ์‹œ๋„๋“ค์ด ์ด์–ด์ง€๊ณ  ์žˆ๋‹ค๋Š” ์‚ฌ์‹ค์ด ๋†€๋ผ์› ๋‹ค. C++์ด๋‚˜ Python ํ‘œ์ค€ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์— ๋“ค์–ด ์žˆ๋Š” TimSort๋„ ์ด๋ฒˆ์— ์ฒ˜์Œ ์ œ๋Œ€๋กœ ์›๋ฆฌ๋ฅผ ์•Œ๊ฒŒ ๋˜์—ˆ๊ณ , ๊ทธ๋™์•ˆ์€ ๊ทธ๋ƒฅ .sort() ์จ๋„ ๋‹น์—ฐํ•œ ๊ฑธ๋กœ ์ƒ๊ฐํ–ˆ๋Š”๋ฐ, ๊ทธ ์•ˆ์—๋„ ์ˆ˜๋งŽ์€ ์ตœ์ ํ™”๊ฐ€ ์žˆ๋‹ค๋Š” ๊ฑธ ๊นจ๋‹ฌ์•˜๋‹ค.

Library Sort ๊ฐ™์ด ์ž˜ ์•Œ๋ ค์ง€์ง€ ์•Š์€ ์•Œ๊ณ ๋ฆฌ์ฆ˜์€ ๋…ผ๋ฌธ ๋ณด๊ณ  ๊ตฌํ˜„ํ•˜๋Š” ๊ฒŒ ์ง„์งœ ์–ด๋ ค์› ๋‹ค. ๊ฐญ ์žฌ๋ฐฐ์น˜ ๋กœ์ง ๊ฐ™์€ ๊ฑด ๋””๋ฒ„๊น…ํ•˜๋ฉด์„œ ์ดํ•ดํ•ด์•ผ ํ–ˆ๊ณ , ์ค‘๊ฐ„์— ์ž˜๋ชป๋œ ๊ตฌํ˜„ ๋•Œ๋ฌธ์— ์ •ํ™•๋„๋„ ๋‚ฎ๊ฒŒ ๋‚˜์™€์„œ ์—„์ฒญ ๊ณ ์ƒํ–ˆ๋‹ค. ๊ทธ๋ž˜๋„ ๋‚ด๊ฐ€ ์ง์ ‘ ๋…ผ๋ฌธ ๋ณด๊ณ  ๊ตฌํ˜„ํ•˜๊ณ , ๋…ผ๋ฌธ์ฒ˜๋Ÿผ ์ž‘์„ฑํ•ด์„œ ์ •๋ฆฌํ•œ ๊ณผ์ • ์ž์ฒด๊ฐ€ ๋ฟŒ๋“ฏํ–ˆ๋‹ค.

Overleaf ์ฒ˜์Œ ์จ๋ดค๋Š”๋ฐ, ๊ทธ๋ƒฅ ๊ณผ์ œํ•˜๋Š” ๋А๋‚Œ์ด ์•„๋‹ˆ๋ผ ์ง„์งœ ๋…ผ๋ฌธ ์“ฐ๋Š” ๋А๋‚Œ์ด๋ผ ์™„์„ฑํ•˜๊ณ  ๋‚˜๋‹ˆ๊นŒ ์„ฑ์ทจ๊ฐ๋„ ํ›จ์”ฌ ์ปธ๋‹ค.

์ •๋ ฌ์ด๋ผ๋Š” ์ต์ˆ™ํ•œ ๋ฌธ์ œ๋„ ํŒŒ๊ณ ๋“ค๋‹ค ๋ณด๋ฉด ๊ฒฐ๊ตญ ์ด๋ก  + ๊ตฌํ˜„ + ์ตœ์ ํ™”๊ฐ€ ๋‹ค ๋“ค์–ด๊ฐ€๋Š” ์ข…ํ•ฉ ๋ฌธ์ œ๋ผ๋Š” ๊ฑธ ๋‹ค์‹œ ๋А๊ผˆ๋‹ค. ๋‹จ์ˆœํžˆ ์ •๋‹ต๋งŒ ๊ตฌํ•˜๋Š” ๊ฒŒ ์•„๋‹ˆ๋ผ, ์กฐ๊ฑด์— ๋”ฐ๋ผ ์ข‹์€ ์„ ํƒ์„ ํ•˜๋Š” ๊ฒƒ ์ž์ฒด๊ฐ€ ์•Œ๊ณ ๋ฆฌ์ฆ˜ ์„ค๊ณ„๋ผ๋Š” ๊ฑธ ๋ฐฐ์šด ๊ฒƒ ๊ฐ™๋‹ค.