Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
3487495e
Commit
3487495e
authored
Sep 22, 2010
by
Robert Griesemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
suffixarray: cleanup per suggestion from Roger Peppe
R=rsc CC=golang-dev
https://golang.org/cl/2213045
parent
ad9042bd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
12 deletions
+6
-12
src/pkg/index/suffixarray/suffixarray.go
src/pkg/index/suffixarray/suffixarray.go
+6
-12
No files found.
src/pkg/index/suffixarray/suffixarray.go
View file @
3487495e
...
...
@@ -43,9 +43,9 @@ func New(data []byte) *Index {
for
i
,
_
:=
range
sa
{
sa
[
i
]
=
i
}
x
:=
&
i
ndex
{
data
,
sa
}
sort
.
Sort
(
x
)
return
(
*
Index
)(
x
)
x
:=
&
I
ndex
{
data
,
sa
}
sort
.
Sort
(
(
*
index
)(
x
)
)
return
x
}
...
...
@@ -75,7 +75,7 @@ func (x *Index) search(s []byte) int {
// Lookup returns an unsorted list of at most n indices where the byte string s
// occurs in the indexed data. If n < 0, all occurrences are returned.
// The result is nil if s is empty, s is not found, or n == 0.
// Lookup time is O((log(N) + len(res))*len(s)) where N is the
// Lookup time is O((log(N) + len(res
ult
))*len(s)) where N is the
// size of the indexed data.
//
func
(
x
*
Index
)
Lookup
(
s
[]
byte
,
n
int
)
[]
int
{
...
...
@@ -102,14 +102,8 @@ func (x *Index) Lookup(s []byte, n int) []int {
}
// index is like Index; it is only used to hide the sort.Interface methods
type
index
struct
{
data
[]
byte
sa
[]
int
}
// index implements sort.Interface
// index is used to hide the sort.Interface
type
index
Index
func
(
x
*
index
)
Len
()
int
{
return
len
(
x
.
sa
)
}
func
(
x
*
index
)
Less
(
i
,
j
int
)
bool
{
return
bytes
.
Compare
(
x
.
at
(
i
),
x
.
at
(
j
))
<
0
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment