marioluan / java-data-structures Goto Github PK
View Code? Open in Web Editor NEWData structures written in Java.
License: MIT License
Data structures written in Java.
License: MIT License
Today, I'm using a fixed length for the array.
Set<String> alphabet = Set.of("a", "b", "c");
API:
API:
Try to run:
$ docker-compose up
Recreating java-data-structures_intellij_1 ... done
Starting java-data-structures_gradle_1 ... done
Attaching to java-data-structures_gradle_1, java-data-structures_intellij_1
gradle_1 | Starting a Gradle Daemon, 1 incompatible and 2 stopped Daemons could not be reused, use --status for details
intellij_1 | No protocol specified
intellij_1 |
intellij_1 | Start Failed: Failed to initialize graphics environment
intellij_1 |
intellij_1 | java.awt.AWTError: Can't connect to X11 window server using ':0' as the value of the DISPLAY variable.
intellij_1 | at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
intellij_1 | at sun.awt.X11GraphicsEnvironment.access$200(X11GraphicsEnvironment.java:65)
intellij_1 | at sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:115)
intellij_1 | at java.security.AccessController.doPrivileged(Native Method)
intellij_1 | at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:74)
intellij_1 | at java.lang.Class.forName0(Native Method)
intellij_1 | at java.lang.Class.forName(Class.java:264)
intellij_1 | at java.awt.GraphicsEnvironment.createGE(GraphicsEnvironment.java:103)
intellij_1 | at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:82)
intellij_1 | at sun.awt.X11.XToolkit.<clinit>(XToolkit.java:127)
intellij_1 | at java.lang.Class.forName0(Native Method)
intellij_1 | at java.lang.Class.forName(Class.java:264)
intellij_1 | at java.awt.Toolkit$2.run(Toolkit.java:860)
intellij_1 | at java.awt.Toolkit$2.run(Toolkit.java:855)
intellij_1 | at java.security.AccessController.doPrivileged(Native Method)
intellij_1 | at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:854)
intellij_1 | at java.awt.Toolkit.getEventQueue(Toolkit.java:1736)
intellij_1 | at java.awt.EventQueue.isDispatchThread(EventQueue.java:1071)
intellij_1 | at javax.swing.SwingUtilities.isEventDispatchThread(SwingUtilities.java:1361)
intellij_1 | at javax.swing.text.StyleContext.reclaim(StyleContext.java:454)
intellij_1 | at javax.swing.text.StyleContext.addAttribute(StyleContext.java:311)
intellij_1 | at javax.swing.text.html.StyleSheet.addAttribute(StyleSheet.java:578)
intellij_1 | at javax.swing.text.StyleContext$NamedStyle.addAttribute(StyleContext.java:1501)
intellij_1 | at javax.swing.text.StyleContext$NamedStyle.setName(StyleContext.java:1312)
intellij_1 | at javax.swing.text.StyleContext$NamedStyle.<init>(StyleContext.java:1259)
intellij_1 | at javax.swing.text.StyleContext.addStyle(StyleContext.java:107)
intellij_1 | at javax.swing.text.StyleContext.<init>(StyleContext.java:87)
intellij_1 | at javax.swing.text.html.StyleSheet.<init>(StyleSheet.java:166)
intellij_1 | at javax.swing.text.html.HTMLEditorKit.getStyleSheet(HTMLEditorKit.java:391)
intellij_1 | at com.intellij.util.ui.UIUtil.<clinit>(UIUtil.java:103)
intellij_1 | at com.intellij.ide.plugins.PluginManager.start(PluginManager.java:78)
intellij_1 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
intellij_1 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
intellij_1 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
intellij_1 | at java.lang.reflect.Method.invoke(Method.java:498)
intellij_1 | at com.intellij.ide.Bootstrap.main(Bootstrap.java:39)
intellij_1 | at com.intellij.idea.Main.main(Main.java:78)
intellij_1 |
java-data-structures_intellij_1 exited with code 3
gradle_1 | :help
gradle_1 |
gradle_1 | Welcome to Gradle 4.5.1.
gradle_1 |
gradle_1 | To run a build, run gradle <task> ...
gradle_1 |
gradle_1 | To see a list of available tasks, run gradle tasks
gradle_1 |
gradle_1 | To see a list of command-line options, run gradle --help
gradle_1 |
gradle_1 | To see more detail about a task, run gradle help --task <task>
gradle_1 |
gradle_1 | BUILD SUCCESSFUL in 21s
gradle_1 | 1 actionable task: 1 executed
java-data-structures_gradle_1 exited with code 0
Output of DISPLAY variable:
$ echo $DISPLAY
:0
I am using Ubuntu 18.04.
What can be wrong setuped?
TODO
After I moved to docker, it started to happen.
Looks like there's a better approach to deletion: https://github.com/kevin-wayne/algs4/blob/master/src/main/java/edu/princeton/cs/algs4/LinearProbingHashST.java#L190
:checkstyleMain[ant:checkstyle] [INFO] /home/gradle/src/main/java/io/github/marioluan/datastructures/Node.java:16:14: Variable 'data' must be private and have accessor methods. [VisibilityModifier]
[ant:checkstyle] [INFO] /home/gradle/src/main/java/io/github/marioluan/datastructures/Node.java:21:20: Variable 'next' must be private and have accessor methods. [VisibilityModifier]
[ant:checkstyle] [INFO] /home/gradle/src/main/java/io/github/marioluan/datastructures/Node.java:26:20: Variable 'prev' must be private and have accessor methods. [VisibilityModifier]
[ant:checkstyle] [INFO] /home/gradle/src/main/java/io/github/marioluan/datastructures/graph/Digraph.java:55: Comment matches to-do format 'TODO'. [TodoComment]
[ant:checkstyle] [INFO] /home/gradle/src/main/java/io/github/marioluan/datastructures/graph/Undirected.java:56: Comment matches to-do format 'TODO'. [TodoComment]
[ant:checkstyle] [INFO] /home/gradle/src/main/java/io/github/marioluan/datastructures/graph/search/BreadthFirstSearch.java:34: Comment matches to-do format 'TODO'. [TodoComment]
[ant:checkstyle] [INFO] /home/gradle/src/main/java/io/github/marioluan/datastructures/graph/search/ConnectedComponents.java:43: Comment matches to-do format 'TODO'. [TodoComment]
[ant:checkstyle] [INFO] /home/gradle/src/main/java/io/github/marioluan/datastructures/graph/search/Paths.java:25: Comment matches to-do format 'TODO'. [TodoComment]
[ant:checkstyle] [INFO] /home/gradle/src/main/java/io/github/marioluan/datastructures/priority/queue/MaxBinaryHeap.java:10: Comment matches to-do format 'TODO'. [TodoComment]
[ant:checkstyle] [INFO] /home/gradle/src/main/java/io/github/marioluan/datastructures/symboltable/BinarySearchTree.java:487: Comment matches to-do format 'TODO'. [TodoComment]
Broken test:
// spec from #get method
describe("when key does not exist", () -> {
it("returns null", () -> {
assertNull(this.subject.get(String.valueOf(RANDOM.nextInt())));
});
});
Error message:
io.github.marioluan.datastructures.symboltable.hash.LinearProbingHashTableTest > when key does not exist.returns null FAILED
java.lang.ArrayIndexOutOfBoundsException
Looks like some random integer is causing issue.
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when it is not empty.returns false FAILED
java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when it is not empty.returns its @size FAILED
java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when key is not null.does not throw null pointer FAILED
java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when value is null.removes the key from table FAILED
java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when value is null.decrements size by 1 FAILED
java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when value is not null.updates the key from table FAILED
java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when value is not null.does not updates its size FAILED
java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when value is null.removes the key from table FAILED
java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when value is null.decrements size by 1 FAILED
java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when value is not null.updates the key from table FAILED
java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when value is not null.does not updates its size FAILED
java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when value is null.does not add the key to table FAILED
java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when value is not null.adds the key to table FAILED
java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when value is not null.increments size by 1 FAILED
java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when key is not null.does not throw null pointer FAILED
java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when table is empty.returns null FAILED
java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when key exists.returns the value paired with it FAILED
java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when key does not exist.returns null FAILED
java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when key exists.returns the value paired with it FAILED
java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when key does not exist.returns null FAILED
java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when key is at the top of the bucket.removes the key from table FAILED
java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when key is at the middle/bottom of the bucket.removes the key from table FAILED
java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when the buckets have a single element.returns the keys from the table FAILED
java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when the buckets have multiple elements.returns the keys from the table FAILED
java.lang.ArithmeticException
233 tests completed, 24 failed, 10 skipped
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.