All Questions
13 questions
1
vote
2
answers
200
views
integer log base 10 function without using java.lang.Math?
I am assigned to a task of creating a function int logBase10Estimate(int n) that returns the log of a number base 10. The answer is integer part only.(w/o using the Math class)
Is this okay?
...
4
votes
1
answer
307
views
Drawing consecutive rectangles with an algorithm
I have an assignment to draw rectangles that get larger and larger each time I draw them. Just like shown below. I've labeled them TL = Top Left, TR = Top Right, BL = Bottom Left, BR = Bottom Right. ...
1
vote
0
answers
487
views
java - A* search algorithm
I'm having trouble with my homework implementing A* search algorithm in java, I'm given the graph, origin and destination, I had to follow some specific tasks in the homework so the code might be a ...
3
votes
1
answer
3k
views
Optimizing Needleman-Wunsch algorithm in Java
For a class assignment, I was required to implement the Needleman-Wunsch algorithm in Java. I have already completed the assignment but I was wondering if there were any algorithmic (or even syntactic)...
0
votes
1
answer
462
views
Adding two extremely large numbers using a custom data structure
I have an implementation to add 2 extremely large numbers, greater than the ceiling provided by long, e.g. 1238913893838383813813813813838... I created a LinkedList ...
2
votes
3
answers
2k
views
Java Brute-Force Algorithms Homework
I'm taking an algorithms class this semester and this homework seemed pretty easy. Easy usually means something is wrong. Not always, though. Through testing, this application successfully answered ...
5
votes
1
answer
22k
views
Java Connect Four "Four in a row" detection algorithms
I am making a connect four type game for my end of the year project in my programming class. I am about to start building off of the console based version I have made and add a GUI, but I feel sort ...
4
votes
1
answer
1k
views
Displaying a randomly sized array as a table
This program creates an integer array with a random size of 5-50 elements (inclusive). It then fills the array with random numbers between 0 - 100 (inclusive). The interesting part comes when I then ...
1
vote
1
answer
211
views
Search/sort/create functionality, implements bubblesort and sequential search
I've moved my main() to the bottom of the code block in order to fit it all in one class for this submission. Is there a better way to do it?
...
2
votes
1
answer
2k
views
Binary HeapSort and Ternary HeapSort implementation
This is my take on binary and ternary heapsort implementation for a university assignment. The code works but I wonder if there are any mistakes or things to improve.
...
20
votes
3
answers
75k
views
Java implementation of spell-checking algorithm
This little program was written for an assignment in a data structures and algorithms class. I'll just note the basic requirements:
Given an inputted string, the program should check to see if it ...
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\$
...
2
votes
2
answers
12k
views
Conversion of expression from Prefix to Postfix notation (Problem with precedence) [closed]
I have been attempting to write a code that converts Prefix expressions to Postfix expressions.
So far here's what I have made (note that I am new and hence it may not be efficient!)
...