Hello 算法 1.2.0 繁体中文 Kotlin 版Hello 演算法 Kotlin 語言版 作者:靳宇棟(@krahets) 程式碼審閱:陳東輝(@curtishd) Release 1.2.0 2024‑12‑06 序 兩年前,我在力扣上分享了“劍指 Offer”系列題解,受到了許多讀者的鼓勵與支持。在與讀者交流期間,我 最常被問到的一個問題是“如何入門演算法”。漸漸地,我對這個問題產生了濃厚的興趣。 兩眼一抹黑地刷題似乎是最受歡 maxHeap.add(_val) // 從底至頂堆積化 siftUp(size() - 1) } /* 從節點 i 開始,從底至頂堆積化 */ fun siftUp(it: Int) { // Kotlin 的函式參數不可變,因此建立臨時變數 var i = it while (true) { // 獲取節點 i 的父節點 val p = parent(i) // 當“越過根節點”或“節點無須修復”時,結束堆積化 從頂至底堆積化 siftDown(0) // 返回堆積頂元素 return _val } /* 從節點 i 開始,從頂至底堆積化 */ fun siftDown(it: Int) { // Kotlin 的函式參數不可變,因此建立臨時變數 var i = it while (true) { // 判斷節點 i, l, r 中值最大的節點,記為 ma val l = left(i) val0 码力 | 382 页 | 18.79 MB | 10 月前3
Julia 1.11.4customization for specific iterators.CHAPTER 9. FUNCTIONS 82 Julia 1.9 ... in non-final position of an assignment requires Julia 1.9 Slurping in assignments can also occur in any other position. As opposed packages while keeping as many versions of packages already installed as possible. Julia 1.9 This only affects Julia 1.9 and above. 30.3 Network transport JULIA_NO_VERIFY_HOSTS JULIA_SSL_NO_VERIFY_HOSTS the messages are via @debug. However, due to caching of binary code, the cache rejection since v1.9 is more strict and users may need to set the JULIA_CPU_TARGET environment variable appropriately to0 码力 | 2007 页 | 6.73 MB | 3 月前3
Julia 1.11.5 Documentationcustomization for specific iterators.CHAPTER 9. FUNCTIONS 82 Julia 1.9 ... in non-final position of an assignment requires Julia 1.9 Slurping in assignments can also occur in any other position. As opposed packages while keeping as many versions of packages already installed as possible. Julia 1.9 This only affects Julia 1.9 and above. 30.3 Network transport JULIA_NO_VERIFY_HOSTS JULIA_SSL_NO_VERIFY_HOSTS the messages are via @debug. However, due to caching of binary code, the cache rejection since v1.9 is more strict and users may need to set the JULIA_CPU_TARGET environment variable appropriately to0 码力 | 2007 页 | 6.73 MB | 3 月前3
Julia 1.11.6 Release Notescustomization for specific iterators.CHAPTER 9. FUNCTIONS 82 Julia 1.9 ... in non-final position of an assignment requires Julia 1.9 Slurping in assignments can also occur in any other position. As opposed packages while keeping as many versions of packages already installed as possible. Julia 1.9 This only affects Julia 1.9 and above. 30.3 Network transport JULIA_NO_VERIFY_HOSTS JULIA_SSL_NO_VERIFY_HOSTS the messages are via @debug. However, due to caching of binary code, the cache rejection since v1.9 is more strict and users may need to set the JULIA_CPU_TARGET environment variable appropriately to0 码力 | 2007 页 | 6.73 MB | 3 月前3
Julia 1.12.0 Beta4customization for specific iterators.CHAPTER 9. FUNCTIONS 82 Julia 1.9 ... in non-final position of an assignment requires Julia 1.9 Slurping in assignments can also occur in any other position. As opposed packages while keeping as many versions of packages already installed as possible. Julia 1.9 This only affects Julia 1.9 and above. JULIA_PKG_GC_AUTO If set to false, automatic garbage collection of packages The auto value for $JULIA_NUM_THREADS requires Julia 1.7 or above. Julia 1.9 The x,y format for threadpools requires Julia 1.9 or above. JULIA_THREAD_SLEEP_THRESHOLD If set to a string that starts with0 码力 | 2057 页 | 7.44 MB | 3 月前3
Julia 1.12.0 Beta3customization for specific iterators.CHAPTER 9. FUNCTIONS 82 Julia 1.9 ... in non-final position of an assignment requires Julia 1.9 Slurping in assignments can also occur in any other position. As opposed packages while keeping as many versions of packages already installed as possible. Julia 1.9 This only affects Julia 1.9 and above. JULIA_PKG_GC_AUTO If set to false, automatic garbage collection of packages The auto value for $JULIA_NUM_THREADS requires Julia 1.7 or above. Julia 1.9 The x,y format for threadpools requires Julia 1.9 or above. JULIA_THREAD_SLEEP_THRESHOLD If set to a string that starts with0 码力 | 2057 页 | 7.44 MB | 3 月前3
julia 1.12.0 beta1customization for specific iterators.CHAPTER 9. FUNCTIONS 82 Julia 1.9 ... in non-final position of an assignment requires Julia 1.9 Slurping in assignments can also occur in any other position. As opposed packages while keeping as many versions of packages already installed as possible. Julia 1.9 This only affects Julia 1.9 and above. JULIA_PKG_GC_AUTO If set to false, automatic garbage collection of packages The auto value for $JULIA_NUM_THREADS requires Julia 1.7 or above. Julia 1.9 The x,y format for threadpools requires Julia 1.9 or above. JULIA_THREAD_SLEEP_THRESHOLD If set to a string that starts with0 码力 | 2047 页 | 7.41 MB | 3 月前3
julia 1.13.0 DEVcustomization for specific iterators.CHAPTER 9. FUNCTIONS 82 Julia 1.9 ... in non-final position of an assignment requires Julia 1.9 Slurping in assignments can also occur in any other position. As opposed packages while keeping as many versions of packages already installed as possible. Julia 1.9 This only affects Julia 1.9 and above. JULIA_PKG_GC_AUTO If set to false, automatic garbage collection of packages The auto value for $JULIA_NUM_THREADS requires Julia 1.7 or above. Julia 1.9 The x,y format for threadpools requires Julia 1.9 or above. JULIA_THREAD_SLEEP_THRESHOLD If set to a string that starts with0 码力 | 2058 页 | 7.45 MB | 3 月前3
julia 1.10.10the precise handling and customization for specific iterators. Julia 1.9 ... in non-final position of an assignment requires Julia 1.9CHAPTER 8. FUNCTIONS 77 Slurping in assignments can also occur in any packages while keeping as many versions of packages already installed as possible. Julia 1.9 This only affects Julia 1.9 and above. 29.3 Network transport JULIA_NO_VERIFY_HOSTS / JULIA_SSL_NO_VERIFY_HOSTS the messages are via @debug. However, due to caching of binary code, the cache rejection since v1.9 is more strict and users may need to set the JULIA_CPU_TARGET environment variable appropriately to0 码力 | 1692 页 | 6.34 MB | 3 月前3
Julia 1.10.9the precise handling and customization for specific iterators. Julia 1.9 ... in non-final position of an assignment requires Julia 1.9CHAPTER 8. FUNCTIONS 77 Slurping in assignments can also occur in any packages while keeping as many versions of packages already installed as possible. Julia 1.9 This only affects Julia 1.9 and above. 29.3 Network transport JULIA_NO_VERIFY_HOSTS / JULIA_SSL_NO_VERIFY_HOSTS the messages are via @debug. However, due to caching of binary code, the cache rejection since v1.9 is more strict and users may need to set the JULIA_CPU_TARGET environment variable appropriately to0 码力 | 1692 页 | 6.34 MB | 3 月前3
共 11 条
- 1
- 2













