Questions tagged [homework]

Questions requesting help with school homework. This tag lets potential answerers know that they should GUIDE the student in solving the problem, rather than showing a complete solution. CAUTION: Before posting, consider that classmates may be tempted to reuse code from your post. (Read the tag wiki.)

Filter by
Sorted by
Tagged with
5
votes
1answer
4k views

Implementation of Dijkstra's shortest path algorithm

This is my code that implements Dijkstra's single source shortest path algorithm, which is called multiple times to recalculate after graph changes. the graph is a road system of a city and shortest ...
3
votes
1answer
3k views

Abstractness of Shape class

Shape represents an abstract class and the other two classes inherits from it. This looks insufficiently abstract to me. How could I improve it? ...
5
votes
2answers
2k views

Pouring water problem

I just began to study Scala (coming from Python I had quite a few problems with types) and I want to know if my first code to solve a real problem is nicely done or if there is some points that need ...
9
votes
3answers
23k views

Finding points with the shortest distance

This takes in a user specified number of points then finds the two points with the shortest distance. ...
2
votes
4answers
777 views

String-crunching routine

How can this be optimized? ...
4
votes
1answer
2k views

Money class for handling calculations with coins

The code follows the requested format of the output exactly for my assignment. But, for my own personal reference, is there a better way that I could have done anything? Are there any additional tips? ...
3
votes
2answers
442 views

Programming of 3 x 7 trick

The puzzle is: The deck contains 21 unique numbers The numbers should be laid up in rows of 7 (3 rows in total) ask the player to memorize a number to start the game once the game starts, ...
2
votes
1answer
167 views

Destructively appending one list to another

I am implementing a list structure in C. My current function I am working on is a destructive append function that takes two lists and appends the second one onto the end of the first. Right now, it ...
3
votes
3answers
4k views

Iterating through a dictionary in C#

I am trying to get my dictionary to iterate seven times after the dateTime is found. I want to iterate through the next week of objects in my dictionary ...
4
votes
4answers
300 views

is there a better way than replace to write this function?

I am doing my homework and i have done this? Is there any other better way to do this? ...
5
votes
5answers
2k views

String traversal program in C

My task was to write a function in C where a string such as {2210090,34566,87234,564676} would be given as input and the function had to find out the count of ...
2
votes
2answers
2k views

Alphabetically-sorted word lookup

The goal of this code is to save a list of 250000 words with a number that indicates its frequency. The 250000 are sorted alphabetically but the frequency is unsorted. The idea is that a user must ...
3
votes
2answers
247 views

Reflecting and counting points on a 2D grid

First number indicates the number of points, followed by N points (x,y). Then the next number indicates Q num_queries, followed by Q queries: Reflect all points between point i and j both ...
2
votes
3answers
905 views

Is this correct java? Attributes and constructors especially

I'm learning java, although because of work I didn't had much time to go to classes. We had a final work to do but since I'm more familiarised with python I'm not sure if I'm doing java correctly... ...
8
votes
6answers
4k views

Sum of all primes under 2 million

I have this assignment to write the optimized space and time code for finding the sum of all primes under 2 million. I'm using the following function to check if each number is prime: ...
3
votes
2answers
2k views

Menu system and Turtle

I had to do a small application using a menu system and Turtle. I have finished it and worked perfect. Just to make sure, can you please check it if it has done properly? ...
2
votes
3answers
916 views

Permutations Finder Help Number 2

Previous question: Java application for finding permutations efficiently> I have changed quite a bit of code, and need some more reviews. ...
8
votes
1answer
759 views

Java application for finding permutations efficiently

I am an eighth grader with a school project of creating and application in Java that returns the total permutations of two given numbers. It needs to be light and efficient, for later deployment on a ...
6
votes
4answers
1k views

Converting an integer into the written form

For my homework assignment I have to create a class which converts an integer between 0 and 9999 into the written form. For example, 713 would be written as "seven ...
4
votes
1answer
2k views

Sudoku Solver Optimization

I am currently working on a Sudoku solver that should be able to solve a 25 x 25 grid. However, I am experiencing problems optimizing it to run quick enough to actually get a result with any grid ...
15
votes
2answers
1k views

Is this C++ quicksort program okay?

I wrote a quicksort program in C++. Is it okay to implement it this way? Am I using pointers correctly? Is my style okay? Any ideas to speed it up or save memory? ...
7
votes
4answers
16k views

Getting the largest element in an array using recursion

Any suggestions on how to make this code more efficient? ...
4
votes
2answers
1k views

Program with random number generation

I am having trouble with the random number generator. For week 0 only, I want to set the starting number of roaches in House A (totalRoachesInHouseA) to 97 and the ...
5
votes
4answers
2k views

Database schema for Service Order Management project

I'm a student and I've created this MySQL database schema for my Service Order Management academic project. I want to know if I need to improve it and, if so, how I could do that. ...
8
votes
3answers
18k views

Replace multiple occurrences of a character

I try to replace multiple occurrences of a character with a single character. Input: hhiii!!! hooowww aaareee yyyooou??? Output: hi! how are you? ...
5
votes
2answers
6k views

Decimal To Binary using only the basics

Convert a decimal number to binary using only loops, strings, if/else statements. This is my first C++ project and it took me ...
10
votes
5answers
847 views

Verifying if a car is a sports car based on speed and horse power

I have an assignment where I am required to verify if a car is a sports car or not by minimum max speed and minimum horse power. I have finished the program and it works great. I was just wanting to ...
6
votes
2answers
1k views

Garden sprinkler system

I was given this assignment below and wrote the code below that as the solution. My instructor has been blasting me for writing inefficient code for my last several assignments, and rails at me for ...
7
votes
4answers
469 views

Making this password search more intelligent

In a homework, there is an exercise in which I have a script that is used to search for a password. One of the questions is if is possible to make it "more intelligent", and I'm stuck on it. ...
4
votes
1answer
270 views

Lazy look and say sequence

I have been solving a set of online Clojure problems. One of them involves the look and say sequence. ...
5
votes
2answers
23k views

Cash-withdrawal from an ATM

I'm seeking review comments (design, performance, etc.) based on the problem statement: Write a CashWithDrawal function from an ATM which based on user specified amount dispenses bank notes. ...
5
votes
2answers
5k views

pipe 2 linux commands in C

I am writing a simpel program that can basicly do the same as piping two linux commands can do. For example, ls -l | grep vars.sh, this can be done on the Linux ...
1
vote
1answer
113 views

Function that multiplies all numbers between “a” and “b” with do loop

I'm making a function that multiplies all numbers between an "a" input and a "b" input with do loop. If you please, check my function and say what's wrong since I ...
3
votes
1answer
580 views

python: less ugly solution to the intersection of 3 lines in 3 dimensional space

I've tagged this as homework because it was originally a school project, it was accepted but I'm not satisfied with the code. I've used cramers rule to find the intersection of 3 lines in three ...
4
votes
3answers
3k views

“Consecutive Heads” program

So... I have a program in which I want to flip heads three times in the row. What I'm asking for is for proposals of other solutions for this program, in pro way, as You do in natural sense. That's ...
28
votes
6answers
46k views

Class for measuring distance as feet and inches

My homework question states: Develop a class to measure distance as feet (should be int), inches (should be float). ...

1
6 7 8 9
10