Homework means the question is requesting help with school homework. This lets potential answerers know that they SHOULD guide the student in solving the problem, and SHOULD NOT simply show the complete answer.

learn more… | top users | synonyms

0
votes
0answers
47 views

Would appreciate feedback on college project

would appreciate some feedback regarding best practices on the following code which is a college project. What should go in the controller and what in the views? How to attach and remove the views to ...
3
votes
1answer
133 views

Homework assignment needs review

Will someone look over my code for an exercise I was assigned. The program runs, but my instructor is pretty tough at grading. Anything I can improve on? The exercise is as follows: Create a class ...
5
votes
1answer
228 views

Everything's done, just need to write in a different way [closed]

Hey guys, the goal of my assignment is simple, here it is: Write a program that converts a given text to "Pig Latin". Pig Latin consists of removing the first letter of each word in a sentence ...
3
votes
1answer
202 views

Review my Java hash table implementation?

For class, I was asked to write a (linear probing) hash table in Java. (I was also asked to write a linear-chaining hash table, which is why I named this one HashtableB as opposed to just Hashtable.) ...
2
votes
4answers
97 views

How to Improve Stack Class C++ Implementation

This question is about improving my C++ coding skills. I was asked to implement a simple Static Integer Stack in C++ as an assignment. I've come up with the following code: class myStaticIntStack { ...
3
votes
1answer
881 views

Java multithreaded file server and client. Emulate TCP over UDP

This is for homework. My task was similar to my last assignment but this time I had to do it with UDP instead of TCP. This basically means I had to emulate TCP over UDP. Multithreading was an ...
-2
votes
1answer
65 views

PHP: what does this code do? [closed]

can somebody please explain this code for me in simple steps. thanks in advance $text = 'we need to send products ACE66765, ACE33453, and ace72345 back to the customer.'; $regex = ...
5
votes
1answer
720 views

Java multi-thread file server and client.

This is for homework. My task was to build a multi-thread file server and a client that can upload or download a named file over sockets. It is assumed that the client will finish after its operation ...
3
votes
2answers
168 views

Where to start refactoring?

I am currently programming, but i messed up my code, what is the best way to clean my code. I really need to know this, next week i must be done with the assignment, but the teacher said that the ...
0
votes
3answers
203 views

code from my class seems sloppy and confusing, am I crazy? [closed]

This is the example code for the next project for my intro class. The assignment is to add an "edit method" to this program. Some of my concerns are why the methods are returning Integers, that ...
1
vote
1answer
73 views

Please review C for Nios-2 IRQ handling

Related: Please review assembly for Nios 2 interrupts /* * Main C program for nios2int 2012-10-31 * Assignment 6: Interrupts from * timer_1 and de2_pio_keys4 */ /* Include header file for ...
1
vote
0answers
227 views

Please review assembly for Nios 2 interrupts

This is homework for which we have prepared Nios 2 assembly and C: ######################################## # Definitions of device-addresses # and important constants. # # de2_pio_keys4 - 0x840 ...
5
votes
5answers
1k views

Finding repeating numbers in an array

I want to search through an array of n numbers and find the numbers that are repeated. So far I have this code, which does the job, but I find it to be a rather cumbersome method, but I can't seem to ...
2
votes
2answers
150 views

Optimization of exponentiation

I'm writing some crypto code, and as part of it, we have to implement modular exponentiation. I have it working, both with the right-to-left binary method and with the Montgomery formula. While ...
6
votes
4answers
332 views

Not sure how to check my solution

This is a assignment question from school: Write a method called licencePlate that takes an array of objectionable words and returns a random licence plate that does not have any of those words in it. ...
0
votes
1answer
320 views

Reverse a linked list [closed]

Problem: create a linked list and reverse the list appending with '<-'. Example, if the linked list is [1,2,3,4,5,6], so the result is 5 <- 4 <- 3 <- 2 <- 1. Here is the code class ...
4
votes
3answers
111 views

Is my code dealing with the presented problem the right way?

I finished this program to print a 2D array, I got the right output, but I'm not sure if I did what was being asked in the problem below. My code to deal with the presented problem: package ...
4
votes
3answers
423 views

A simple array-based Stack class in Java, what are my mistakes?

I have created a simple array-based Stack class with some methods like the actual Stack in Java. I am testing this for mistakes, but since I am learning Java and my tests may not be as comprehensive ...
4
votes
2answers
114 views

Ordinary Data Processing Task in Haskell: Vague Misgivings

This is an ordinary data processing task: read a list of dates and amounts (for example, deposits and withdrawals from a bank account) and report the date on which the lowest balance was recorded and ...
6
votes
4answers
1k views

C++, simple function to determine the circumference and area of a circle

First off I would like to state that this is a homework assignment. However, I am not looking for you to complete anything for me. I code I am posting is the completed homework assignment. However, ...
0
votes
1answer
183 views

Am I doing this right? Merging 2 ordered source arrays into one destination array

My instructions were: Add a merge() method to the OrdArray class in the orderedArray.java program (Listing 2.4) so that you can merge two ordered source arrays into an ordered destination ...
3
votes
2answers
191 views

Format names to title case

So I'm writing a program to format names to title case and display them in alphabetic order. Any advice please? And how can i add more methods? public static void main (String [] args) { ...
7
votes
4answers
694 views

Payroll calculator

First I tried to fetch this program as close to pseudo code where I must follow all imported items, all method definitions, and all defined variables; anything else was my choice. After I created ...
4
votes
2answers
153 views

Understanding the use of for loops as counting loops in homework review [closed]

Newbie here, first time programmer. I have a homework assignment that I am working on. Instructions: Write an application that allows input of an integer n between 1 and 71, and (using a for or ...
4
votes
3answers
234 views

Haskell: Nearest Neighbour classification algorithm

The following code is from a university assignment of mine to write a classification algorithm (using nearest neighbour) to classify whether or not a given feature set (each feature is the frequency ...
12
votes
6answers
1k views

HashSet and TreeSet

I got some homework in which I had to take the novel War and Peace and put it into a HashSet and TreeSet respectively. I had to time it, to check differences and my question is whether my ...
1
vote
1answer
2k views

Producer-consumer in C using pthread_barrier

We're preparing for an exam at the moment, and our lecturer has given us a sample problem to work on. I have it completed, but would like to know a) If it is actually doing what it's supposed to, and ...
2
votes
3answers
159 views

C inner product function without using array subscripting

As part of a question designed to help us understand the relationship between pointers and arrays in C, I've been asked to write an inner product function that doesn't use any array subscripting. ...
3
votes
1answer
137 views

Scheme, first timer first program, simple list removal technique

I have started my hand at writing some scheme code. I am trying to get the first n primes. I plan to do so but first getting a list from 2 to m, and doing the following algorithm. Remove the first ...
1
vote
2answers
358 views

How can i Improve this program C++

int n; int *array[9]; bool isUsed[10] = {0}; for(int i = 0; i < 9; i++) { cout << "Enter Number " << (i + 1) << endl; cin >> n; if((n >= 0) && (n ...
3
votes
2answers
145 views

How to optimize and shorten this SQL query?

I'm doing a sort of exercise where I'm given a question, and I have to answer it by writing a sql query using a database that I was given. This is the question: What is the cheapest fare for a ...
4
votes
1answer
395 views

First C program is too slow

I finally got my first C program to work, and it turns out to be too slow! Any critique, especially on optimization, would be much appreciated. Thanks for wading through my code! /** * File: ...
3
votes
2answers
122 views

PHP function to compare two Roman numerals

This was for an assignment. I had to write a function to compare two roman numerals. This had to return true only if the second number was larger than the first and had to be done without converting ...
4
votes
2answers
956 views

Inversion count using merge sort

count = 0 def merge_sort(li): if len(li) < 2: return li m = len(li) / 2 return merge(merge_sort(li[:m]), merge_sort(li[m:])) def merge(l, r): global count result = [] ...
2
votes
2answers
424 views

Is there a better design I can use for this code?

I am trying to solve this problem: We were given two countries namely Brazil and Argentina. Both had one inventory each with 100 ipods in them. The cost of ipod in Brazil was 100/unit and in ...
3
votes
2answers
178 views

Homework Review - Storing three integer values

Consider an 8-bit complier, in which we have an integer of size, say 2-words i.e. 16-bits or 2 bytes. You need to store three integer values which are supposed to be as: Name Range Size ...
0
votes
4answers
211 views

Insertion vs Selection

I currently have a selection sorting algorithm, but need some help turning it into a insertion sort, I understand a insertion sort if faster? The hand array is full, and it needs to sort from lowest ...
9
votes
6answers
2k views

Just checking - does my code look good? Rock+Paper+Scissors

Doing some homework and just curious if everything I've done looks good and/or if you'd suggest I modify something to keep with "javaese" Thanks! Here's the code: import java.util.Scanner; import ...
3
votes
2answers
111 views

Can someone check if my code follows the instructions of the given assignment?

I would like someone to check if I followed the instructions of the assignment. I find the instructions a little confusing. Here is the assignment: Dynamic character arrays str and add contain ...
3
votes
3answers
365 views

JavaScript Objects- Can you confirm?

Ok, I am in a JavaScript class, and I have no desire for anyone to do my schoolwork, I have already done what I think is correct, I am just hoping someone can take a look and tell me if I am close, or ...
13
votes
9answers
1k views

Most efficient way in C++ to strip strings

If I want to strip a string completely of its whitespaces, punctuation and numbers (i.e. anything that is not A-Z, a-z), what is the most efficient way of doing it in C++? I tried this: string ...
0
votes
0answers
78 views

Python 2.7 - Abstract Programming [duplicate]

Possible Duplicate: Can I make the class more abstract? import math class Point: def __init__(self,x,y): self.x = x self.y = y def move(self,x,y): self.x += x self.y += y ...
3
votes
1answer
721 views

Design+code review of an implementation of Dijkstra's shortest path algo

this is my code that implements dijkstra's single source shortest path algorithm (as submission to a coding forum hence tag:homework) which is called multiple times to recalculate after graph changes. ...
2
votes
1answer
142 views

Can I make the class more abstract?

import math class Point: def __init__(self,x,y): self.x = x self.y = y def move(self,x,y): self.x += x self.y += y def __str__(self): return ...
3
votes
1answer
491 views

Pouring Water = My first scala code

This is my first time in CodeReview, I'd hope like something like that existed and voila, a fellow StackExchange site has already been done. I just began to study Scala (coming from Python I had ...
3
votes
3answers
231 views

Missed lab, wondering how this bit of Java code could be improved anyway?

I'm not able to get feedback on this because I forgot about the lab due date, but I'd appreciate some critique anyway. It takes in a user specified number of points then finds the two points with the ...
0
votes
4answers
261 views

A string crunching routine… input to the routine is “aabbccdef” and output “a2b2c2def” or input: “a4bd2g4” and output: “aaaabddgggg”

here is the code that I've written...but I'm sure it can be optimized...any suggestions??? char *crunch(char *s) { char *temp,buff[MAX]; int repeat,count,i,j,k; if (*s == '\0') return ...
1
vote
2answers
284 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, ...
1
vote
1answer
92 views

Optimized Python code

Suppose we have a data set, ls=(0.3,1.4,1.6,2.3,3.2,4.7) Find the count of values within intervals of 2. I have to implement this functionality in python whose c code looks like this: ...
2
votes
1answer
121 views

Is my function failproof?

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 ...

1 2