3
votes
3answers
1k views

Trying to make recursive code designed to find objects with even references tidier

As the title says, I'm trying to make my code less horrible looking! For a university practical, I've to use recursive methods to return the even references in a collection of Integer objects stored ...
7
votes
2answers
288 views

Is this non-recursive mergesort efficient and a good way to simulate the recursive version?

My teacher assigned us to do the recursive version of mergesort, yet I heard that the non-recursive version (bottom up) is a bit tougher, so I decided to this one as well. My main concerns are: ...
6
votes
2answers
499 views

How can I avoid unchecked cast warning in my generic recursive Iterator?

It's somewhat odd that Java's collection framework has no iterator for recursive data structures. Since I needed something like this, I wrote my own. First off, I need recursive elements: ...
4
votes
2answers
244 views

Numeric expression parser - calculator

In particular, if someone could describe a better way to go from the tokenized list to the Expression tree, it would be super helpful. I would like to get rid of the casting in the parser but am not ...
3
votes
1answer
91 views

Better way to create samples

I've done this piece of code for creating all possible samples without repetitions, but I think that it is a so heavy algorithm because every time I call this recursive function I create a new vector ...
0
votes
1answer
66 views

Solving a Recursive Maze method [closed]

Given any map such as the one below, 1 for path and 0 for walls, can you guys review my code and see what I am doing wrong. My code is supposed to return an arrayList of the positions that it passed ...