@@ -5,9 +5,6 @@ Algorithms and Data Structures implemented in Java
5
5
6
6
This is a collection of algorithms and data structures which I've implement over the years in my academic and professional life. The code isn't overly-optimized but is written to be correct and readable. The algorithms and data structures are well tested and, unless noted, are believe to be 100% correct.
7
7
8
- <<<<<<< HEAD
9
- * Created by Justin Wetherell
10
- =======
11
8
## Table of Contents
12
9
- [ Data Structures] ( #data-structures )
13
10
- [ Mathematics] ( #mathematics )
@@ -20,7 +17,6 @@ This is a collection of algorithms and data structures which I've implement over
20
17
21
18
## * Created by Justin Wetherell
22
19
23
- >>>>>>> c0d476f8e48bd15f03ff6c83905785ddd922e873
24
20
* For questions use: http://groups.google.com/forum/#!forum/java-algorithms-implementation
25
21
* Google: http://code.google.com/p/java-algorithms-implementation
26
22
* Github: http://github.com/phishman3579/java-algorithms-implementation
@@ -35,46 +31,6 @@ This is a collection of algorithms and data structures which I've implement over
35
31
# What's been implemented:
36
32
37
33
## Data Structures
38
- <<<<<<< HEAD
39
- * AVL Tree
40
- * B-Tree
41
- * Binary Heap [ backed by an array or a tree]
42
- * Binary Search Tree
43
- * Compact Suffix Trie [ backed by a Patricia Trie]
44
- * Disjoint Set
45
- * Fenwick Tree [ Binary Indexed Tree (BIT)]
46
- * Graph
47
- + Undirected
48
- + Directed (Digraph)
49
- * Hash Array Mapped Trie (HAMT)
50
- * Hash Map (associative array)
51
- * Interval Tree
52
- * Implicit Key Treap
53
- * KD Tree (k-dimensional tree or k-d tree)
54
- * List [ backed by an array or a linked list]
55
- * Matrix
56
- * Patricia Trie
57
- * Quad-Tree (Point-Region or MX-CIF)
58
- * Queue [ backed by an array or a linked list]
59
- * Radix Trie (associative array) [ backed by a Patricia Trie]
60
- * Red-Black Tree
61
- * Segment Tree
62
- * Skip List
63
- * Splay Tree
64
- * Stack [ backed by an array or a linked list]
65
- * Suffix Tree (Ukkonen's algorithm)
66
- * Suffix Trie [ backed by a Trie]
67
- * Treap
68
- * Tree Map (associative array) [ backed by an AVL Tree]
69
- * Trie
70
- * Trie Map (associative array) [ backed by a Trie]
71
-
72
- ## Mathematics
73
- * Distance
74
- + chebyshev
75
- + euclidean
76
- * Division
77
- =======
78
34
* [ AVL Tree] ( src/com/jwetherell/algorithms/data_structures/AVLTree.java )
79
35
* [ B-Tree] ( src/com/jwetherell/algorithms/data_structures/BTree.java )
80
36
* [ Binary Heap (backed by an array or a tree)] ( src/com/jwetherell/algorithms/data_structures/BinaryHeap.java )
@@ -113,36 +69,16 @@ This is a collection of algorithms and data structures which I've implement over
113
69
+ chebyshev
114
70
+ euclidean
115
71
* [ Division] ( src/com/jwetherell/algorithms/mathematics/Division.java )
116
- >>>>>>> c0d476f8e48bd15f03ff6c83905785ddd922e873
117
72
+ using a loop
118
73
+ using recursion
119
74
+ using shifts and multiplication
120
75
+ using only shifts
121
76
+ using logarithm
122
- <<<<<<< HEAD
123
- * Multiplication
124
- =======
125
77
* [ Multiplication] ( src/com/jwetherell/algorithms/mathematics/Multiplication.java )
126
- >>>>>>> c0d476f8e48bd15f03ff6c83905785ddd922e873
127
78
+ using a loop
128
79
+ using recursion
129
80
+ using only shifts
130
81
+ using logarithms
131
- <<<<<<< HEAD
132
- + using FFT
133
- * Primes
134
- + is prime
135
- + prime factorization
136
- + sieve of eratosthenes
137
- + co-primes (relatively prime, mutually prime)
138
- + greatest common divisor
139
- - using Euclid's algorithm
140
- - using recursion
141
- * Permutations
142
- + strings
143
- + numbers
144
- * Modular arithmetic
145
- =======
146
82
+ [ Fast Fourier Transform] ( src/com/jwetherell/algorithms/mathematics/FastFourierTransform.java )
147
83
* [ Primes] ( src/com/jwetherell/algorithms/mathematics/Primes.java )
148
84
+ is prime
@@ -156,23 +92,16 @@ This is a collection of algorithms and data structures which I've implement over
156
92
+ strings
157
93
+ numbers
158
94
* [ Modular arithmetic] ( src/com/jwetherell/algorithms/mathematics/Modular.java )
159
- >>>>>>> c0d476f8e48bd15f03ff6c83905785ddd922e873
160
95
+ add
161
96
+ subtract
162
97
+ multiply
163
98
+ divide
164
99
+ power
165
- <<<<<<< HEAD
166
-
167
- ## Numbers
168
- * Integers
169
- =======
170
100
* [ Knapsack] ( src/com/jwetherell/algorithms/mathematics/Knapsack.java )
171
101
* [ Ramer Douglas Peucker] ( src/com/jwetherell/algorithms/mathematics/RamerDouglasPeucker.java )
172
102
173
103
## Numbers
174
104
* [ Integers] ( src/com/jwetherell/algorithms/numbers/Integers.java )
175
- >>>>>>> c0d476f8e48bd15f03ff6c83905785ddd922e873
176
105
+ to binary String
177
106
- using divide and modulus
178
107
- using right shift and modulus
@@ -184,20 +113,12 @@ This is a collection of algorithms and data structures which I've implement over
184
113
- using logarithm
185
114
- using bits
186
115
+ to English (e.g. 1 would return "one")
187
- <<<<<<< HEAD
188
- * Longs
189
- =======
190
116
* [ Longs] ( src/com/jwetherell/algorithms/numbers/Longs.java )
191
- >>>>>>> c0d476f8e48bd15f03ff6c83905785ddd922e873
192
117
+ to binary String
193
118
- using divide and modulus
194
119
- using right shift and modulus
195
120
- using BigDecimal
196
- <<<<<<< HEAD
197
- * Complex
198
- =======
199
121
* [ Complex] ( src/com/jwetherell/algorithms/numbers/Complex.java )
200
- >>>>>>> c0d476f8e48bd15f03ff6c83905785ddd922e873
201
122
+ addition
202
123
+ subtraction
203
124
+ multiplication
@@ -206,38 +127,6 @@ This is a collection of algorithms and data structures which I've implement over
206
127
207
128
## Graphs
208
129
* Find shortest path(s) in a Graph from a starting Vertex
209
- <<<<<<< HEAD
210
- - Dijkstra's algorithm (non-negative weight graphs)
211
- - Bellman-Ford algorithm (negative and positive weight graphs)
212
- * Find minimum spanning tree
213
- - Prim's (undirected graphs)
214
- - Kruskal's (undirected graphs)
215
- * Find all pairs shortest path
216
- - Johnsons's algorithm (negative and positive weight graphs)
217
- - Floyd-Warshall (negative and positive weight graphs)
218
- * Cycle detection
219
- - Depth first search while keeping track of visited Verticies
220
- * Topological sort
221
- * A* path finding algorithm
222
- * Maximum flow
223
- - Push-Relabel
224
-
225
- ## Search
226
- * Get index of value in array
227
- + Linear
228
- + Quickselect
229
- + Binary [ sorted array input only]
230
- + Lower bound [ sorted array input only]
231
- + Upper bound [ sorted array input only]
232
- + Optimized binary (binary until a threashold then linear) [ sorted array input only]
233
- + Interpolation [ sorted array input only]
234
-
235
- ## Sequences
236
- * Find longest common subsequence (dynamic programming)
237
- * Find longest increasing subsequence (dynamic programming)
238
- * Find number of times a subsequence occurs in a sequence (dynamic programming)
239
- * Find i-th element in a Fibonacci sequence
240
- =======
241
130
- [ Dijkstra's algorithm (non-negative weight graphs)] ( src/com/jwetherell/algorithms/graph/Dijkstra.java )
242
131
- [ Bellman-Ford algorithm (negative and positive weight graphs)] ( src/com/jwetherell/algorithms/graph/BellmanFord.java )
243
132
* Find minimum spanning tree
@@ -272,31 +161,10 @@ This is a collection of algorithms and data structures which I've implement over
272
161
* [ Find longest increasing subsequence (dynamic programming)] ( src/com/jwetherell/algorithms/Sequences/LongestIncreasingSubsequence.java )
273
162
* [ Find number of times a subsequence occurs in a sequence (dynamic programming)] ( src/com/jwetherell/algorithms/Sequences/SubsequenceCounter.java )
274
163
* [ Find i-th element in a Fibonacci sequence] ( src/com/jwetherell/algorithms/Sequences/FibonacciSequence.java )
275
- >>>>>>> c0d476f8e48bd15f03ff6c83905785ddd922e873
276
164
+ using a loop
277
165
+ using recursion
278
166
+ using matrix multiplication
279
167
+ using Binet's formula
280
- <<<<<<< HEAD
281
- * Find total of all elements in a sequence
282
- + using a loop
283
- + using Triangular numbers
284
- * Largest sum of contiguous subarray (Kadane's algorithm)
285
- * Longest palindromic subsequence (dynamic programming)
286
-
287
- ## Sorts
288
- * American Flag Sort
289
- * Bubble Sort
290
- * Counting Sort (Integers only)
291
- * Heap Sort
292
- * Insertion Sort
293
- * Merge Sort
294
- * Quick Sort
295
- * Radix Sort (Integers only)
296
- * Shell's Sort
297
-
298
- ## String Functions
299
- =======
300
168
* [ Find total of all elements in a sequence(Arithmetic Progression)] ( src/com/jwetherell/algorithms/Sequences/ArithmeticProgression.java )
301
169
+ using a loop
302
170
+ using Triangular numbers
@@ -316,7 +184,6 @@ This is a collection of algorithms and data structures which I've implement over
316
184
317
185
## String Functions
318
186
### [ String Functions] ( src/com/jwetherell/algorithms/strings/StringFunctions.java )
319
- >>>>>>> c0d476f8e48bd15f03ff6c83905785ddd922e873
320
187
* Reverse characters in a string
321
188
+ using additional storage (a String or StringBuilder)
322
189
+ using in-place swaps
@@ -331,13 +198,7 @@ This is a collection of algorithms and data structures which I've implement over
331
198
+ using in-place symetric element compares
332
199
* Subsets of characters in a String
333
200
* Edit (Levenshtein) Distance of two Strings
334
- <<<<<<< HEAD
335
- * KMP (Knuth–Morris–Pratt) Algorithm - Length of maximal prefix-suffix for each prefix
336
- * String rotations
337
- =======
338
201
* [ KMP (Knuth–Morris–Pratt) Algorithm - Length of maximal prefix-suffix for each prefix] ( src/com/jwetherell/algorithms/strings/KnuthMorrisPratt.java )
339
202
* [ String rotations] ( src/com/jwetherell/algorithms/strings/Rotation.java )
340
- >>>>>>> c0d476f8e48bd15f03ff6c83905785ddd922e873
341
203
+ Findin lexicographically minimal string rotation
342
204
+ Findin lexicographically maximal string rotation
343
-
0 commit comments