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.5 Documentation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1840 105.7 High-level Overview of the Native-Code Generation Process . . . . . . . . . . . . . . 1841 105.8 Julia Functions . . . . . . . . Arithmetic, which can handle operations on numeric values that cannot be represented effectively in native hardware representations, but at the cost of relatively slower performance. The following are Julia's Julia also defines the types Int and UInt, which are aliases for the system's signed and unsigned native integer types respectively: # 32-bit system: julia> Int Int32CHAPTER 5. INTEGERS AND FLOATING-POINT0 码力 | 2007 页 | 6.73 MB | 3 月前3
Julia 1.11.6 Release Notes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1840 105.7 High-level Overview of the Native-Code Generation Process . . . . . . . . . . . . . . 1841 105.8 Julia Functions . . . . . . . . Arithmetic, which can handle operations on numeric values that cannot be represented effectively in native hardware representations, but at the cost of relatively slower performance. The following are Julia's Julia also defines the types Int and UInt, which are aliases for the system's signed and unsigned native integer types respectively: # 32-bit system: julia> Int Int32CHAPTER 5. INTEGERS AND FLOATING-POINT0 码力 | 2007 页 | 6.73 MB | 3 月前3
Julia 1.11.4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1840 105.7 High-level Overview of the Native-Code Generation Process . . . . . . . . . . . . . . 1841 105.8 Julia Functions . . . . . . . . Arithmetic, which can handle operations on numeric values that cannot be represented effectively in native hardware representations, but at the cost of relatively slower performance. The following are Julia's Julia also defines the types Int and UInt, which are aliases for the system's signed and unsigned native integer types respectively: # 32-bit system: julia> Int Int32CHAPTER 5. INTEGERS AND FLOATING-POINT0 码力 | 2007 页 | 6.73 MB | 3 月前3
julia 1.13.0 DEV. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1893 106.7 High-level Overview of the Native-Code Generation Process . . . . . . . . . . . . . . 1894 106.8 Julia Functions . . . . . . . . Arithmetic, which can handle operations on numeric values that cannot be represented effectively in native hardware representations, but at the cost of relatively slower performance. The following are Julia's Julia also defines the types Int and UInt, which are aliases for the system's signed and unsigned native integer types respectively: # 32-bit system: julia> Int Int32CHAPTER 5. INTEGERS AND FLOATING-POINT0 码力 | 2058 页 | 7.45 MB | 3 月前3
Julia 1.12.0 RC1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1891 106.7 High-level Overview of the Native-Code Generation Process . . . . . . . . . . . . . . 1892 106.8 Julia Functions . . . . . . . . Arithmetic, which can handle operations on numeric values that cannot be represented effectively in native hardware representations, but at the cost of relatively slower performance. The following are Julia's Julia also defines the types Int and UInt, which are aliases for the system's signed and unsigned native integer types respectively: # 32-bit system: julia> Int Int32CHAPTER 5. INTEGERS AND FLOATING-POINT0 码力 | 2057 页 | 7.44 MB | 3 月前3
Julia 1.12.0 Beta4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1890 106.7 High-level Overview of the Native-Code Generation Process . . . . . . . . . . . . . . 1891 106.8 Julia Functions . . . . . . . . Arithmetic, which can handle operations on numeric values that cannot be represented effectively in native hardware representations, but at the cost of relatively slower performance. The following are Julia's Julia also defines the types Int and UInt, which are aliases for the system's signed and unsigned native integer types respectively: # 32-bit system: julia> Int Int32CHAPTER 5. INTEGERS AND FLOATING-POINT0 码力 | 2057 页 | 7.44 MB | 3 月前3
Julia 1.12.0 Beta3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1890 106.7 High-level Overview of the Native-Code Generation Process . . . . . . . . . . . . . . 1891 106.8 Julia Functions . . . . . . . . Arithmetic, which can handle operations on numeric values that cannot be represented effectively in native hardware representations, but at the cost of relatively slower performance. The following are Julia's Julia also defines the types Int and UInt, which are aliases for the system's signed and unsigned native integer types respectively: # 32-bit system: julia> Int Int32CHAPTER 5. INTEGERS AND FLOATING-POINT0 码力 | 2057 页 | 7.44 MB | 3 月前3
julia 1.12.0 beta1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1881 105.7 High-level Overview of the Native-Code Generation Process . . . . . . . . . . . . . . 1882 105.8 Julia Functions . . . . . . . . Arithmetic, which can handle operations on numeric values that cannot be represented effectively in native hardware representations, but at the cost of relatively slower performance. The following are Julia's Julia also defines the types Int and UInt, which are aliases for the system's signed and unsigned native integer types respectively: # 32-bit system: julia> Int Int32CHAPTER 5. INTEGERS AND FLOATING-POINT0 码力 | 2047 页 | 7.41 MB | 3 月前3
julia 1.10.10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1559 101.7 High-level Overview of the Native-Code Generation Process . . . . . . . . . . . . . . 1560 101.8 Julia Functions . . . . . . . . Arithmetic, which can handle operations on numeric values that cannot be represented effectively in native hardware representations, but at the cost of relatively slower performance. The following are Julia's Julia also defines the types Int and UInt, which are aliases for the system's signed and unsigned native integer types respectively: # 32-bit system: julia> Int Int32 julia> UInt UInt32 # 64-bit0 码力 | 1692 页 | 6.34 MB | 3 月前3
共 26 条
- 1
- 2
- 3













