krahets / hello-algo

《Hello 算法》:动画图解、一键运行的数据结构与算法教程。支持 Python, Java, C++, C, C#, JS, Go, Swift, Rust, Ruby, Kotlin, TS, Dart 代码。简体版和繁体版同步更新,English version ongoing
https://www.hello-algo.com
Other
97.79k stars 12.39k forks source link

Add Kotlin code support for English Time Complexity section of the doc #1432

Closed eyedol closed 3 months ago

eyedol commented 3 months ago

If this pull request (PR) is associated with coding or code transpilation, please attach the relevant console outputs to the PR and complete the following checklist:

Changes here are mostly code. Added Kotlin support to the English translation of Time Complexity doc. The code support is for both the code snippets in the en/docs/chapter_computational_complexity/time_complexity.md and the Kotlin code for time_complexity.

Console output of running: java -jar en/codes/kotlin/build/test.jar

Input data size n = 8
Number of constant complexity operations = 100000
Number of linear complexity operations = 8
Number of linear complexity operations (traversing the array) = 8
Number of quadratic order operations = 64
Number of quadratic order operations (bubble sort) = 84
Number of exponential complexity operations (implemented by loop) = 255
Number of exponential complexity operations (implemented by recursion) = 255
Number of logarithmic complexity operations (implemented by loop) = 3
Number of logarithmic complexity operations (implemented by recursion) = 3
Number of linear logarithmic complexity operations (implemented by recursion) = 32
Number of factorial complexity operations (implemented by recursion) = 40320

I'd appreciate a review and possible merge. Thank you.

Note: This is an initial PR to add Kotlin code support for the English translations. I'll add more as I progress with PR merges.

krahets commented 3 months ago

Thanks for the PR! Currently, we're not ready to translate other programming languages into English.

eyedol commented 3 months ago

No problem. Thanks for letting me know.