File tree Expand file tree Collapse file tree 9 files changed +441
-39
lines changed
test/java/com/blaxswan/algorithm Expand file tree Collapse file tree 9 files changed +441
-39
lines changed Original file line number Diff line number Diff line change 2
2
xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
3
3
<modelVersion >4.0.0</modelVersion >
4
4
5
- <groupId >com.blaxswan.fundamental </groupId >
5
+ <groupId >com.blaxswan.algorithm </groupId >
6
6
<artifactId >data-structure</artifactId >
7
7
<version >1.0-SNAPSHOT</version >
8
8
<packaging >jar</packaging >
14
14
<project .build.sourceEncoding>UTF-8</project .build.sourceEncoding>
15
15
</properties >
16
16
17
+ <build >
18
+ <plugins >
19
+ <plugin >
20
+ <groupId >org.apache.maven.plugins</groupId >
21
+ <artifactId >maven-compiler-plugin</artifactId >
22
+ <configuration >
23
+ <source >1.6</source >
24
+ <target >1.6</target >
25
+ </configuration >
26
+ </plugin >
27
+ </plugins >
28
+ </build >
29
+
17
30
<dependencies >
18
31
<dependency >
19
32
<groupId >junit</groupId >
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ package com .blaxswan .algorithm ;
2
+
3
+ import com .blaxswan .algorithm .heap .BinaryHeap ;
4
+ import com .blaxswan .algorithm .heap .BinaryHeapArray ;
5
+
6
+ import java .util .Random ;
7
+
8
+ /**
9
+ * Hello world!
10
+ *
11
+ */
12
+ public class App
13
+ {
14
+ public static void main (String [] args ) {
15
+ HeapFoo ();
16
+ }
17
+
18
+ private static void HeapFoo (){
19
+ final BinaryHeapArray <Integer > heapArray = new BinaryHeapArray <Integer >(BinaryHeap .OrderingType .MAX );
20
+
21
+ final Random random = new Random ();
22
+ int i ;
23
+ String sep = "" ;
24
+ for (i = 0 ; i < 1500 ; i ++){
25
+ int randomInt = random .nextInt (1000 );
26
+ System .out .print (sep + randomInt );
27
+ sep = ", " ;
28
+
29
+ heapArray .add (randomInt );
30
+ }
31
+
32
+ System .out .println ();
33
+ System .out .println ();
34
+ System .out .println (heapArray .toString ());
35
+ }
36
+ }
Original file line number Diff line number Diff line change
1
+ package com .blaxswan .algorithm .heap ;
2
+
3
+ public interface BinaryHeap <T extends Comparable <T >> extends IHeap <T > {
4
+
5
+ enum HeapType {
6
+ Tree ,
7
+ Array
8
+ }
9
+
10
+ enum OrderingType {
11
+ MIN ,
12
+ MAX
13
+ }
14
+
15
+ T [] getHeap ();
16
+ }
You can’t perform that action at this time.
0 commit comments