FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
JavaArithmetic/src/datastructure/set/Main.java at master · sqlcyi2008/JavaArithmetic · GitHub
sqlcyi2008
JavaArithmetic
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
JavaArithmetic
/
src
/
datastructure
/
set
/
Main.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
40 lines (27 loc) · 1.12 KB
Breadcrumbs
JavaArithmetic
/
src
/
datastructure
/
set
/
Main.java
Copy path
File metadata and controls
40 lines (27 loc) · 1.12 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package
datastructure
.
set
;
import
java
.
util
.
ArrayList
;
public
class
Main
{
private
static
double
testSet
(
Set
<
String
>
set
,
String
filename
){
long
startTime
=
System
.
nanoTime
();
System
.
out
.
println
(
filename
);
ArrayList
<
String
>
words
=
new
ArrayList
<>();
if
(
FileOperation
.
readFile
(
filename
,
words
)) {
System
.
out
.
println
(
"Total words: "
+
words
.
size
());
for
(
String
word
:
words
)
set
.
add
(
word
);
System
.
out
.
println
(
"Total different words: "
+
set
.
getSize
());
}
long
endTime
=
System
.
nanoTime
();
return
(
endTime
-
startTime
) /
1000000000.0
;
}
public
static
void
main
(
String
[]
args
) {
String
filename
=
"pride-and-prejudice.txt"
;
BSTSet
<
String
>
bstSet
=
new
BSTSet
<>();
double
time1
=
testSet
(
bstSet
,
filename
);
System
.
out
.
println
(
"BST Set: "
+
time1
+
" s"
);
System
.
out
.
println
();
LinkedListSet
<
String
>
linkedListSet
=
new
LinkedListSet
<>();
double
time2
=
testSet
(
linkedListSet
,
filename
);
System
.
out
.
println
(
"Linked List Set: "
+
time2
+
" s"
);
}
}
Back
|
FazBrowse Home
|
New Git URL