<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # package suffixarray `import "index/suffixarray"` suffixarrayb包通過使用內存中的后綴樹實現了對數級時間消耗的子字符串搜索。 用法舉例: ``` // 創建數據的索引 index := suffixarray.New(data) // 查找切片s offsets1 := index.Lookup(s, -1) // 返回data中所有s出現的位置 offsets2 := index.Lookup(s, 3) // 返回data中最多3個所有s出現的位置 ``` ## Index * [type Index](#Index) * [func New(data []byte) \*Index](#New) * [func (x \*Index) Bytes() []byte](#Index.Bytes) * [func (x \*Index) Read(r io.Reader) error](#Index.Read) * [func (x \*Index) Write(w io.Writer) error](#Index.Write) * [func (x \*Index) Lookup(s []byte, n int) (result []int)](#Index.Lookup) * [func (x \*Index) FindAllIndex(r \*regexp.Regexp, n int) (result [][]int)](#Index.FindAllIndex) ## type [Index](https://github.com/golang/go/blob/master/src/index/suffixarray/suffixarray.go#L28 "View Source") ``` type Index struct { // 內含隱藏或非導出字段 } ``` Index類型實現了用于快速子字符串搜索的后綴數組。 ### func [New](https://github.com/golang/go/blob/master/src/index/suffixarray/suffixarray.go#L35 "View Source") ``` func New(data []byte) *Index ``` 使用給出的[]byte數據生成一個\*Index,時間復雜度O(N\*log(N))。 ### func (\*Index) [Bytes](https://github.com/golang/go/blob/master/src/index/suffixarray/suffixarray.go#L165 "View Source") ``` func (x *Index) Bytes() []byte ``` 返回創建x時提供的[]byte數據,注意不能修改返回值。 ### func (\*Index) [Read](https://github.com/golang/go/blob/master/src/index/suffixarray/suffixarray.go#L98 "View Source") ``` func (x *Index) Read(r io.Reader) error ``` 從r中讀取一個index寫入x,x不能為nil。 ### func (\*Index) [Write](https://github.com/golang/go/blob/master/src/index/suffixarray/suffixarray.go#L137 "View Source") ``` func (x *Index) Write(w io.Writer) error ``` 將x中的index寫入w中,x不能為nil。 ### func (\*Index) [Lookup](https://github.com/golang/go/blob/master/src/index/suffixarray/suffixarray.go#L190 "View Source") ``` func (x *Index) Lookup(s []byte, n int) (result []int) ``` 返回一個未排序的列表,內為s在被索引為index的切片數據中出現的位置。如果n&lt;0,返回全部匹配;如果n==0或s為空,返回nil;否則n為result的最大長度。時間復雜度O(log(N)\*len(s) + len(result)),其中N是被索引的數據的大小。 ### func (\*Index) [FindAllIndex](https://github.com/golang/go/blob/master/src/index/suffixarray/suffixarray.go#L212 "View Source") ``` func (x *Index) FindAllIndex(r *regexp.Regexp, n int) (result [][]int) ``` 返回一個正則表達式r的不重疊的匹配的經過排序的列表,一個匹配表示為一對指定了匹配結果的切片的索引(相對于x.Bytes())。如果n&lt;0,返回全部匹配;如果n==0或匹配失敗,返回nil;否則n為result的最大長度。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看