Skip to main content

All Questions

2 votes
1 answer
109 views

Optimizing minHeap implementation

I have implemented a java class for minHeap but it is not working as fast as I want . I want some help to change it to work faster in insertion or deleting the minimum node. Here is my implementation:...
K.N's user avatar
  • 121
4 votes
1 answer
199 views

Parsing weather station XML on raspberry pi

This if for a school project that is all about getting the most performance possible out of a relatively weak computer. For this project we have received a weather station report generator that ...
Bobeliciousbob's user avatar
1 vote
2 answers
290 views

Optimize printing massive strings to System.out with respect to time

I need to cut the time it takes to print a large string by ~50%. I went from using s1 + s2 to using StringBuilder, and instead ...
abc556's user avatar
  • 11
0 votes
2 answers
2k views

Data structure to count occurrences of words

I have some code for a assignment where the main marks are awarded based on efficiency. The program uses a given wordgenerator which generates random words and adds them to a user-made data structure. ...
Andy Orchard's user avatar
2 votes
2 answers
178 views

My spaceship is slow to explode after being hit by the asteroid

I am making a game for my computer science class. My professor's requirements are: Write a Processing program that draws a triangle in the middle of the window. Rotate the triangle when the left and ...
Ping Lin's user avatar
13 votes
5 answers
4k views

Enter my Matrix

Here is my next Java assignment: create a Matrix class that can add and multiply two matrices together. I was given some code as a skeleton and then fleshed it out ...
syb0rg's user avatar
  • 21.9k
6 votes
3 answers
2k views

Optimizing this Knight's Tour

My assignment in CS was to make a knight's tour application that could solve the problem from any starting position. I had just finished the code so excuse the lack of deeply descriptive comments. My ...
insertmynamethere's user avatar
8 votes
2 answers
3k views

Finding the longest Collatz sequence cycle

I wrote a program to calculate Collatz sequences for initial numbers between 1 and a given integer i, then find the one with the largest cycle length. My code is ...
dan's user avatar
  • 81
3 votes
1 answer
233 views

Hangman game background image possibly inefficient

I'm making a Hangman game and it seems that my code doesn't provide me much freedom with using layouts. I added an image to my JFrame then I added a ...
Anon's user avatar
  • 137
0 votes
1 answer
121 views

Processing a string from the console

How can I make this program run faster? On enter, I have a string from the console. For example: 1 1 7 3 2 0 0 4 5 5 6 2 1 On exit, it will be ...
Alex's user avatar
  • 11
2 votes
2 answers
1k views

In-order Predecessor BST review

I was referred here from StackOverflow, so here is what I posted over there: So, for an assignment, I have to construct a binary search tree, plus an assortment of related functions. I have them all ...
Adam R's user avatar
  • 23
5 votes
1 answer
4k views

How is my quarterly sales statistics program?

Am I making good use of a 2-D array? Is this code inefficient? I am supposed to receive input from 6 departments for 4 quarterly periods in Java. My assignment asks: Quarterly Sales Statistics ...
eruano57's user avatar
  • 171
3 votes
3 answers
4k views

Approximating sines and cosines using up to five terms of the Taylor series

I have one programming question: The sine and cosine of \$x\$ can be computed as follows: \$\sin(x) = x - \frac{x^3}{3!} + \frac{x^5}{5!} - \frac{x^7}{7!} + \frac{x^9}{9!} - \dots\$ ...
Rahul Kulhari's user avatar
4 votes
2 answers
2k views

Searching through a contact list for given criteria

I have been staring at this code for awhile now and I am thinking there is a way to optimize it (namely the if-else statement ...
user2778322's user avatar
1 vote
3 answers
279 views

Primes Tester for speed performance

I was given a homework assignment in Java to create classes that find Prime number and etc (you will see in code better). ...
Alaev's user avatar
  • 45

15 30 50 per page