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.
2
votes
0answers
34 views
Building an efficient bubble sort function
I've been asked to create a bubble sort function that checks whether the array has been filled sorted before all passes are complete, thereby avoiding unnecessary passes. This is to involve ...
4
votes
2answers
99 views
“Set” your expectations low for this ADT
For my third assignment in CS2, I was given the following:
A set is a special bag that does not allow duplicates. Specify each
operation for a set of objects by stating its purpose, by ...
3
votes
1answer
35 views
Perceptron algorithm
This is the Perceptron algorithm, I wrote this implementation with my friend. It gets the job done, but it's quite dirty, perhaps one of you stylish hackers might help me beautify this beast.
This ...
14
votes
4answers
979 views
Smart as a bag of rocks
For my second project in CS2, I was given the following assignment:
Implement a new ADT called a bag with receipts.
The specification for the class of bag with receipts differs from a
...
2
votes
0answers
26 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. If there is a better way to do it?
...
8
votes
2answers
167 views
Symmetric Square
I was given an assignment to ensure that a list was symmetric.
I built it in a way that worked and it passed the tests. But I wanted to see if it could've been written more efficiently and still ...
2
votes
4answers
69 views
Concatenate two arrays generated randomly
I have written the code to concatenate two arrays . Please let me know of any loopholes in the written code.
...
5
votes
3answers
259 views
Optimizing this Knight's Tour
My assignment in CS was to make a knight's tour application that could solve the problem from any starting position. I had just finished the code so excuse the lack of deeply descriptive comments. My ...
3
votes
2answers
252 views
Shuffle the elements of the array randomly
I have written the code to shuffle the elements of the array. Please let me know of any loopholes in the written code.
...
11
votes
4answers
1k views
To understand what recursion is, you must first understand recursion
This is the second assignment for my CS2 course:
Write a recursive C++ function writeLine() that writes a character repeatedly to form a line of n ...
7
votes
3answers
397 views
RPN calculator in C
I had to write a RPN calculator in C as one of my homework problems, but if someone could critique my code and suggest any improvements, that would be fantastic! I haven't added any overflow errors or ...
6
votes
3answers
362 views
Harvard CS50 Problem Set 1: greedy change-making algorithm
The goal of this code is to take dollar or cents input from the user and give out minimum number of coins needed to pay that between quarters, dimes, nickels and pennies. If this code can be ...
10
votes
4answers
641 views
Knowledge is power
Resurrecting my C++ saga, I was given this project for my CS2 class:
This problem considers several ways to compute \$ x^n \$ for some \$ n
\ge 0 \$.
Write an iterative function ...
-1
votes
2answers
87 views
Cycles of pointers
I'm really inexperienced with cycles, so I want to make this code shorter. As far as I know, I've made a recursive cycle.
...
10
votes
2answers
1k views
It's almost Friday, right?
This is my final post for my CS1 saga. Mostly all I had to do was just "class-ify" my past project in this post. Here are the requirements:
Make all data members private and use constructors, ...