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
-2
votes
0answers
35 views

Grade Calculation [closed]

Develop a smart application as Student Grade Calculator(SGC). Create a class Student with following private attribute : int id, String name, marks(integer array), float average and char grade. ...
2
votes
2answers
99 views
20
votes
6answers
4k views

Can I slim this UTF8-encoding program?

Below is my entire program. You can read what it does thanks to the comments and specifications in particular. My question is: can it be improved? Would it be possible, for example, to avoid writing ...
1
vote
0answers
16 views

Parametrized cache simulation in C

This is an assignment known as a Cachelab from CMU 15-213. The full writeup for the lab can be found here, the handout I'm working against - here. All in all, the task is to emulate a cache, given the ...
2
votes
1answer
54 views

Code duplication

I wrote a function that merges two linked lists but I seem to have some code duplication I'm not sure what to do with: ...
3
votes
1answer
64 views

C# Quicksort Assignment

For my CS minor I was assigned to implement the Quicksort algorithm in C#. I gave it a go and found that I like the implementation of the algorithm more than Mergesort. Now that I've got my Quicksort ...
2
votes
2answers
79 views

Prefix expression evaluator [C++] [closed]

Here's my code for this' weeks homework I had. The code should take an expression , preferably in prefix notation ( otherwise throws exception ), that evaluate prefix expression. I've given three ...
1
vote
2answers
68 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? ...
12
votes
3answers
1k views

Implementing a rectangle class

First I've to indicate that this is my homework. An example of a given input is: s1 = {'p1': (x1, y1), 'p2': (x2, y2)} where all names and coordinations are ...
5
votes
3answers
1k views

Dollar value of coins and calculating interest compounded annually

I've made this program to do a few integer calculations. Do the methods for converting the numbers look good? Do you have any other basic tips? ...
5
votes
3answers
819 views

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 ...
0
votes
1answer
833 views

Go homework interview challenge for Storj

Last December I interviewed with Storj and was unsuccessful after my code challenge. Storj were good enough to pay me for the time it took to complete the challenge, but have refused to give any kind ...
2
votes
1answer
81 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:...
3
votes
2answers
9k views

Circular Queue Implementation Using Array in java

Here is my code of Array Implementation of Queue in java. ...
6
votes
3answers
3k views

Huffman Code in C++

This is my version of the Huffman Codes. ...
3
votes
1answer
2k 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)...
7
votes
2answers
13k views

'Snakes and Ladders' game

I made this game of snakes and ladders for school, and it has to have: Multiple players Player Names Random Dice roll Snakes and ladders (obviously!) Subroutines It is currently 124 lines, ...
5
votes
2answers
204 views

File Based AVL Tree

For class I have to write a program that reads (plaintext) numbers from a file, and inserts them into an AVL tree stored in another (binary) file. I cannot have more than about 10 nodes in memory at ...
5
votes
1answer
117 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 ...
11
votes
8answers
17k views

Return a string without the first two characters

I'm new to Java and am trying to solve a scenario. Even though I've succeeded and it works, I've just wondered if there was a more practical way of doing this task. Is there a quicker or more ...
5
votes
2answers
7k views

Quiz programme for GCSE

I made a quiz programme for my GCSE Computer Science NEA. I just want to make sure it is OK to submit. There are also 5 files: Usernames, Passwords, Song Names, Artist Names and High Scores. Any ...
0
votes
1answer
38 views

Spaceship Operation in for Lexicographic Comparison

I have written a program in Java 8 using BlueJ. There is just one function of type byte that accepts two String values and return 1 if the first word comes before the second in alphabetical order, and ...
4
votes
3answers
106 views

Personal HTML page for beginner CS lab

I'm completely new at programming and have started to study computer science this fall. Our first lab is going to require us to make a very simple web page like the picture LAB attached. I was ...
5
votes
3answers
462 views

SICP Exercise 1.3: Sum of squares of two largest numbers out of three

The exercise 1.3 of the book Structure and Interpretation of Computer Programs asks the following: Exercise 1.3. Define a procedure that takes three numbers as arguments and returns the sum of the ...
2
votes
1answer
47 views

Naive implementation of sort inplace

I had the following assignment for the Python 101 course I'm taking in my university. ...
7
votes
1answer
78 views

Cis 194: Homework 3 (Histogram)

I am following CIS 194: Introduction to Haskell (Spring 2013) online to teach myself Haskell. Following is my response to third exercise of Homework 3, namely Histogram. In which ways I could improve ...
1
vote
1answer
89 views

Optimizing Hash Table

I am trying to write my own implementation of a hash table (hash map) in C++. It turns out that my code is unoptimized as I can't pass performance tests. Can you please give some advice for ...
6
votes
2answers
10k views

Two-player dice game for NEA task computer science (Updated)

This is a game for two users who roll 2 dice 5 times. If the total of dice is even the player gains 10 points; if it is odd, they lose 5. If there is a draw after five rounds then both users will ...
2
votes
1answer
690 views

Salaries exercise

Hey there guys, I have just completed an exercise for uni and I would really like some feedback as I'm pretty new to using java. Areas that I could especially use some input in this instance: ...
5
votes
2answers
140 views

Binary search guess game in C++

I'm trying to write a program where computer attempts to guess a number entered by user. Computer should keep asking until guessed number will be equal to user number. If you know what can be ...
4
votes
3answers
98 views

A custom String class implementation

This is my first implementation of a "container" using the Rule of Five, any feedback I'll gladly accept. I've tried to make it as Exception-Safe as possible. I've made it for an assignment. Header <...
3
votes
1answer
55 views

Converting an input of space delimited integers to a list

tablou = input("Enter values delimited by space: ") b = tablou.split() t = [] # initial list with int() contents for l in b: r = int(l) t.append(r) I ...
7
votes
3answers
313 views

Optimizing Conway's Game of Life in C++

How could I further optimize my implementation of Conway's Game of Life? And how would you critique my current strategies? I'm taking a C++ optimization class, the deadline has passed and my ...
8
votes
3answers
9k views

Simple array-based Stack class in Java

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, my tests may not be as comprehensive as ...
11
votes
4answers
3k views

Python Bingo game that stores card in a dictionary

I am super proud of this python bingo game I wrote. I am posting it here to make get some help reviewing it to make sure I'm using the best practices. This is for a class, and my professor is a ...
0
votes
1answer
448 views

The Game of Pig in JavaScript

I've implemented the game of Pig in JavaScript. My implementation has the following rules: Two players take turns playing in rounds. In a round, the player rolls a single die as many times as they ...
6
votes
3answers
160 views

Taking out number of subarrays from an array which contains all the distinct elements of that array

I am a beginner in C. My teacher gave me a homework problem in which a user would provide an array with its size. What we have to do is:- 1) Take out all the distinct elements from that array. ...
6
votes
2answers
1k views

Count the frequency of items in an array

The question is: Write a program that prompts the user to input ten values between 80 and 85 and stores them in an array. Your program must be able to count the frequency of each value appears in ...
6
votes
1answer
235 views

CIS 194 Homework 2: Parsing an error log

Here is another reference solution, that I discovered after writing my own: https://insight.io/github.com/beloglazov/haskell-course/blob/HEAD/hw2.hs I am following this lecture course as a ...
4
votes
0answers
76 views

Python program for address normalization and geocoding

This is a school project I have been working on. I have created a program utilizing Tkinter, and I was hoping to get some feedback on the way I have gone about things. I feel like it is pretty messy ...
7
votes
3answers
380 views

Sierpinski turtle triangle

I am working through Programming Fundamentals with Python on Udacity. The assignment was to create a recursive triangle. I am happy with the output, but I am hoping for feedback on the actual ...
4
votes
2answers
86 views

Draw an outline of an upward-pointing triangle

I am beginner in C++ and I was given this assignment by my teacher. The assignment is to print the following shape: ...
4
votes
2answers
114 views

RSS feed viewer in Clojure

This semester a classmate and I visited a course on functional programming in our university. For grading, we've to submit a small project which should be written in Clojure and make use of functional ...
4
votes
2answers
2k views

Using C++ to check if string s is subsequence of string t

The problem I want to solve is very simple: Given a string s and a string t, check if s is subsequence of t. there is only lower case English letters in both s and t. t is potentially a very long (...
2
votes
1answer
147 views

Game of life using NumPy

I'm trying to improve my Game of life program for school in Python, to be able to run it quicker. So if you have some ideas, I will be glad to hear them. My current code: ...
6
votes
2answers
2k views

2 player dice game, where even total gains points and odd total loses points NEA task computer science

This is a game for two users who roll 2 dice 5 times. If the total of dice is even the player gains 10 points if it is odd, they lose 5. If there it is a draw after five rounds then the both users ...
-2
votes
1answer
42 views

A game that deals a high card to one of two players [closed]

So for my class, I have to design a game that will deal out one card to for each player. I also need to use functions to accomplish this one for the high card game, and another for the face value of ...
2
votes
1answer
1k views

Insect combinatorics challenge

Below is the problem taken from Berkeley's Cs61A page here Question 9: Insect Combinatorics* Consider an insect in an M by N grid. The insect starts at the bottom left corner, (0, 0), and ...
4
votes
1answer
388 views

Getting saddle points of a matrix

My homework assignment: Write a function called saddle that finds saddle points in the input matrix M. For the purposes of this problem, a saddle point is defined as an element whose value is ...
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. ...

1
2 3 4 5
10