GithubHelp home page GithubHelp logo

gargas / java-algorithms-implementation Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 1.14 MB

Automatically exported from code.google.com/p/java-algorithms-implementation

License: Apache License 2.0

Java 100.00%

java-algorithms-implementation's People

Contributors

cinquin avatar nirro01 avatar phishman3579 avatar

java-algorithms-implementation's Issues

An Interval Tree query on range is not guaranteed to return all matches

What steps will reproduce the problem?
        long f = 5;
        long a = 10;
        long c = 30;
        long g = 35;
        long d = 40;
        long b = 45;
        long e = 50;
        IntervalTree.IntervalData<String>  intervalEF = new IntervalTree.IntervalData(f, e, "Interval FE");
        IntervalTree.IntervalData<String>  intervalCG = new IntervalTree.IntervalData(c, g, "Interval CG");
        IntervalTree.IntervalData<String>  intervalCD = new IntervalTree.IntervalData(c, d, "Interval CD");
        IntervalTree.IntervalData<String>  intervalDE = new IntervalTree.IntervalData(d, e, "Interval DE");

        List<IntervalTree.IntervalData<String>> intervals = new ArrayList<>();
        intervals.add(intervalEF);
        intervals.add(intervalCG);
        intervals.add(intervalCD);
        intervals.add(intervalDE);

        IntervalTree<String> tree = new IntervalTree(intervals);

        IntervalTree.IntervalData<String> abquery = tree.query(a, b);

What is the expected output? What do you see instead?

abquery should contain all intervals within the tree but instead it does not 
contain intervalCD. 

What version of the product are you using? On what operating system?
I am using the code from November 11, 2013 on Windows. 

Please provide any additional information below.

Original issue reported on code.google.com by [email protected] on 14 Nov 2013 at 9:50

BTree addition freezes when adding duplicate value

What steps will reproduce the problem?

    public void test() {
        BTree<Integer> t = new BTree<Integer>();
        int[] values = new int[10];
        for (int i = 0; i < values.length; i++)
            values[i] = i;
        for (int i = 0; i < 100; i++)
            t.add(values[i % values.length]);
    }

What is the expected output? What do you see instead?

The test does not return, it enters an infinite loop

What version of the product are you using? On what operating system?
Linux with latest remotes/origin/master 531f287

Original issue reported on code.google.com by [email protected] on 11 Jun 2014 at 6:29

Dijkstra doesn't work

What steps will reproduce the problem?
1. The problem is that dijkstra implementation doesn't remove an element from 
priority queue after cost update hence queue is not up-to-date
2.you can use attached undirected graph as an example 
2. try to search path 1->7 using Graph.CostPathPair<Integer> shortestPath = 
Dijkstra.getShortestPath(g, gverticies.get(0), gverticies.get(6));
3. shortestPath.getCost() == Integer.MAX_INT, which is not correct

What is the expected output? What do you see instead?
path exists with a cost 2599

What version of the product are you using? On what operating system?


Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 8 Jun 2014 at 7:01

Attachments:

ArrayQueue has a NPE

What steps will reproduce the problem?
1. run the following sample code.
ArrayQueue<Integer> queue = new ArrayQueue<Integer>();
        queue.offer(1);
        queue.offer(2);
        queue.offer(3);
        queue.offer(4);
        queue.offer(5);
        queue.poll();
        queue.offer(6);
        queue.offer(7);
        queue.offer(8);
        queue.poll();
        queue.offer(9);
        queue.offer(10);
        queue.offer(11);
        queue.offer(12);
        queue.offer(13);

as you are increasing the lastIndex by 1 after it reaches the last postion it 
has to set to 0 start position
eg: size is 5.
1,-,-,-,-
1,2,-,-,-
1,2,3,-,-
1,2,3,4,-
1,2,3,4,5
now take on
-,2,3,4,5
now size is 4 we have the space to one more element but that should go at 
position 0 not at 6.


What is the expected output? What do you see instead?


What version of the product are you using? On what operating system?


Please provide any additional information below.

Original issue reported on code.google.com by [email protected] on 24 Feb 2013 at 7:13

Prim.java

What steps will reproduce the problem?
1. any graph it has cicle in prim.java
2.
3.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?



Please provide any additional information below.

add to prim.java after "Graph.Edge e = edgesAvailable.remove();"
 this "while(!unvisited.contains(e.getToVertex()) && !unvisited.contains(e.getFromVertex())){
                e = edgesAvailable.remove();
            }"

bye!

Original issue reported on code.google.com by [email protected] on 6 Dec 2012 at 10:09

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.