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.)
505
questions
-1
votes
0answers
22 views
Create an hash table from .txt file and counting the collisions [closed]
I have homework about hash tables. Introduction of teacher and where did I stuck in below:
Insert 1000 password list into a hash table with an appropriate hash function. It would be better if the ...
3
votes
3answers
133 views
Remove duplicates from array and save it to another one
So I have been tasked to make an array without duplicated values from another existing array.
So I did it, but I want to know is there some other better way to do that.
Example input/output:
...
-1
votes
2answers
74 views
Remove duplicates from array and save it to another one [duplicate]
I have been tasked to make an array without duplicated values from another existing array.
So I did it, but I want to know is there some other better way to do that.
Example input/output
...
8
votes
1answer
88 views
Parenthesis-realigning program
This is my code for an assignment. The task is to take a user input in form of a sequence of parenthesis' followed by an E to mark its end and determine whether it is a correct sequence (as an example ...
6
votes
4answers
671 views
Tax Calculator (using OOP techniques)
I was wondering if you'd be able to review my basic Tax Calculator that incorporates OOP techniques. I'd greatly appreciate it if you didn't mention about my variable naming convention i.e. Hungarian ...
5
votes
1answer
73 views
Find all the digits in a string
S is a given character string, then I have to find all the digits characters of S. Did I make it unnecessarily complicated?
<...
6
votes
1answer
76 views
Given a byte string S of length l, obtain the string D of length l-1 as D(i) = S(i) * S(i+1)
Given a byte string S of length l, obtain the string D of length l-1 as D(i) = S(i) * S(i+1) (each element of D is the product of two consecutive elements of S).
...
5
votes
2answers
46 views
Pushing local repository to remote repository using python Github
The code should do the following in order:
It should download/clone the public Github repository locally.
It should remove all the git history (and branches)
Use the Github API to create a new Github ...
3
votes
2answers
112 views
Blackjack script in Python
Recently I had a python test and, unfortunately, I failed. I'm going to re-do my test and the teacher gave me the tip to work more efficiently and clean. To practice this I made a blackjack game about ...
21
votes
5answers
5k views
Count all vowels in string
For a homework assignment, I was asked to complete this CodeStepByStep problem. It's coded correctly and gave me a right answer. I'm just wondering if there's an easier way to solve this problem ...
2
votes
0answers
41 views
Faster algorithm/language for substring sliding window replacement
I had a sample file with a long string >50M like this.
...
6
votes
3answers
4k views
2
votes
1answer
71 views
c++ array. Looking for better solution
So i got an task from school.
Which ask's me to write a program tad creates an 2d array with 11 rows and 5 columns.
In which the first column starts with 2.0 and increments by 0.1 all the way up to 3....
4
votes
3answers
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?
...
7
votes
5answers
2k views
Egg size Prompt Box
So I am currently doing an Assignment where I have to make a code that when someone opens the page, they input the weight of an egg and it comes back with what "size" it is.
I got the code ...
4
votes
1answer
101 views
Basic Integer Matrix Implementation
I need to write a CustomBasicMatrix class implementation for college.
This includes basic operations such as int and ...
11
votes
1answer
916 views
Customization of memory class C++
I have implemented a customized memory allocation class template for an assignment. Codes are commented; Hopefully it's clear. I would love to know if there is any way to make the code more optimized.
...
9
votes
2answers
1k views
C Implementation of atof
I'm a beginner at C.
I'm currently implementing atof to build a raytracer, however I'm still learning how to efficiently write programs.
Assignement
Instructions
The program takes a scene description ...
13
votes
2answers
29k views
Perfect Hashing Implementation
I'm building a hash table for this problem:
Implement a class for storing a set of integers:
...
5
votes
2answers
175 views
C++ Practice on STL templates and algorithms
I have implemented the following program below for an assignment for practice on STL templates and algorithms. All I'm doing is implementing the code for the printing of empty files, un-empty files, ...
9
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:
...
1
vote
1answer
877 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 ...
5
votes
3answers
118 views
Hotel booking with multiple options. Improvement through subclasses?
The code below runs perfectly fine as I want it to. I'd like to create more subclasses to get a better overview over the whole code. Can I place the setter and getter as well as the methods into the ...
5
votes
2answers
106 views
Follow up to “C simple hashcons data structure”
This is a follow-up question to my previous question
I have modified the code according to the feedback I got from here and my Professor. However, my Professor is still not happy with the final code. ...
5
votes
2answers
181 views
C simple hashcons data structure
I wrote this hashcons data structure in C and it works correctly. It uses larger twin primes as the capacity and double hashing (open addressing). Page 614 of "Data Structures and Other Objects ...
28
votes
6answers
49k 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). ...
4
votes
3answers
2k views
Student Grade Calculation
Develop a smart application as Student Grade Calculator(SGC).
Create a class Student with following private attribute :
int id, ...
7
votes
1answer
243 views
Parsing a sequence of bits out of a bit field
For homework, I had to parse CPUID instruction output in C, which required a lot of specific bit-manipulation like:
(eax & CACHE_LEVEL) >> 5
I ...
2
votes
2answers
113 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 ...
2
votes
0answers
33 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
60 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
71 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
206 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
80 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
2k 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
824 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 ...
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
10k views
Circular Queue Implementation Using Array in java
Here is my code of Array Implementation of Queue in java.
...
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
14k 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
217 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
134 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
9k 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
39 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
109 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
466 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
63 views
Naive implementation of sort inplace
I had the following assignment for the Python 101 course I'm taking in my university.
...