This post has been edited by dtg715: 26 May 2010 - 11:07 PM
60 Replies - 52574 Views - Last Post: 06 November 2012 - 11:14 AM
#46
Re: Assignments and Challenges
Posted 26 May 2010 - 10:56 PM
#47
Re: Assignments and Challenges
Posted 11 June 2010 - 08:57 AM
/*
We want to make a row of bricks that is goal inches long. We have a number of small bricks (1 inch each) and big bricks (5 inches each). Return true if it is possible to make the goal by choosing from the given bricks. This is a little harder than it looks and can be done without any loops.
makeBricks(3, 1, 8) → true
makeBricks(3, 1, 9) → false
makeBricks(3, 2, 10) → true
*/
This is the starting code you are given:
public boolean makeBricks(int small, int big, int goal) {
}
Now, tell me if I'm reading this wrong, but it seems to me that the third example call to makeBricks should return false. From how I understand it, it says there are 3 small bricks (of 1 inch in size) and 2 big bricks (of 5 inches in size) for a goal length of 10 inches. Obviously, the 3 small bricks and 2 big bricks will reach 13 inches in length, therefore returning false.
I have two ideas regarding this. My first is that I'm reading it wrong and that the question is asking for something other than what I think. My second is that the question might be assigning a minimum length to goal and that all rows that reach longer lengths are acceptable. That would make the third call to makeBricks return true, as shown in the example. Anyone care to enlighten me?
Lastly, if I should have put this post somewhere else, I apologize.
*EDIT* I understand it. I can choose any number of bricks from the given assortment. So, in that third call, I'm given the 3 small bricks and 2 big bricks but can choose how to use them to reach a goal of 10 inches.
This post has been edited by raine36: 11 June 2010 - 09:02 AM
#48
Re: Assignments and Challenges
Posted 06 August 2010 - 04:57 AM
UC Berkeley's CS 61B data structures course using Java is pretty good. The homework and projects for the course can be found here.
The complete set of lectures to go along with the homework(38 in all) can be found here.
I have been following along and doing the homework on and off when I have spare time(which has been sparse lately). The prof is great imo, great resource for those that want to learn on their own.
#49
Re: Assignments and Challenges
Posted 16 August 2010 - 02:35 PM
My last post made no sense, I apologize. I feel dumb because I am not able to grasp the idea of fake code. I get stuck on writing the fake code because I can not run a program and test the result to be able to fix the problems. I am just beginning the whole programming as a college student scene.
#50
Re: Assignments and Challenges
Posted 16 August 2010 - 04:36 PM
codecutter, on 16 August 2010 - 01:35 PM, said:
The idea is to suppress language-specific details to be able to focus on the problem at hand. It's a great technique of dealing with complexity - which is a major issue that computer science deals with.
#51
Re: Assignments and Challenges
Posted 21 August 2010 - 09:05 PM
#52
Re: Assignments and Challenges
Posted 27 August 2010 - 03:30 AM
#53
Re: Assignments and Challenges
Posted 27 October 2010 - 03:21 PM
Attached File(s)
-
CC2010 A0910 Coursework-Moderated.doc (59.5K)
Number of downloads: 167
#54
Re: Assignments and Challenges
Posted 26 January 2011 - 09:44 PM
salindor, on 03 November 2008 - 06:44 PM, said:
Construct the following geographic patterns:
x xx xxx xxxx
xxxxx xxxx xxx xx x
____x ___xx __xxx _xxxx xxxxx
xxxxxxxxxx xxxx__xxxx xxx____xxx xx______xx x________x
You are only allowed the following print (you can always modify for a different langauge other than c/c++) statements:
printf('x');
printf('_');
printf('\n');
The first two patterns are only allowed one printf('x') and one printf('\n') statement
The second pattern is only allowed one of each printf statement
The final pattern only allows two printf('x') and one printf(' ') and printf('\n') statement
Normally I tell them to use a space instead of an underscore, but I was having a strange problem with the space on the second triangle where one line refused to respond like everything else.
Salindor
I like this one. If you want a real challenge, though, you could do it like the assignment I just had (thought it was a little much for week 4 of my first programming class, but maybe not). Allow the user to determine the number of rows in the tree pattern...use stars for the tree (instead of the underscores you have above) and spaces for the white space around it. Prompt for the number of lines and reprompt if the user enters a number that is not allowed (we limited to 1 through 30, inclusive). The number of stars in each line is equal to that line's line number plus the line number of the preceding line. So, if I was on line 5, then I would have 5+4 stars on that line. After the tree is made, prompt the user to decide whether to make another.
This is an awesome assignment to learn loops. I used FOR, WHILE and DO...WHILE loops. It was way fun. Here is a link to the code if you want to check it out (yes, I wrote this...It might not be elegant, but it works.
The code I wrote is in post #12.
codecutter, on 16 August 2010 - 02:35 PM, said:
My last post made no sense, I apologize. I feel dumb because I am not able to grasp the idea of fake code. I get stuck on writing the fake code because I can not run a program and test the result to be able to fix the problems. I am just beginning the whole programming as a college student scene.
dude! I can't write pseudocode either. Instead, I use flow charts. My prof doesn't care how we get the right answer as long as we actually do get the right answer. Have you tried just writing it as if it was step-by-step instructions? Isn't that pretty much what pseudocode is? (You could make a flowchart and then translate it to fake code.....)
#55
Re: Assignments and Challenges
Posted 03 February 2011 - 12:13 PM
Side note -- if your program isn't sequential you can't do step-by-step for it. It works great until you have to deal with modules or functions.
This post has been edited by -=m0n1k3r=-: 03 February 2011 - 12:15 PM
#56
Re: Assignments and Challenges
Posted 04 June 2011 - 09:33 AM
#57
Re: Assignments and Challenges
Posted 08 June 2011 - 06:02 PM
IT programs usually involves company systems which mostly just include updating and deleting from database. Computations tend to be simpler.
But in Mathematics, there's a lot of Mathematical equtions to program. The most practical ones are those that compute for insurance in Actuarial Mathematics. It's not that hard though.
The more difficult ones are those in Numerical Analysis and Calculus.
I created programs before converting types of notations, then computing for Newton's Advancing formulas and other formulas in numerical analysis.
In calculus,I created a program computing using Newton's Approximation. The user inputs an equation then the program computes for the roots, the maxima, and minima. Then it graphs the roots.
I had no idea of GDI+ that time so I had a hard time creating the graph but I was really glad to finish it.
I had just a problem regarding infinite loops since there are a lot of conditions to consider in difficult formulae such as the Newton's Approximation and I was really glad to solve it.
If you have seen a difficult to solve math equation or an equation which repeats solutiion several times before getting the final result, try programming it. I am sure it will be really challenging.
#58
Re: Assignments and Challenges
Posted 05 September 2011 - 11:48 AM
Its fun if you are a beginner and helps with the easy things.
But this is for everyone so use it and learn.
Do not worry if you are new, everybody starts somewhere!
As far as I know the site features Java and Python.
High level languages
This post has been edited by :(D):(P):: 05 September 2011 - 11:51 AM
#59
Re: Assignments and Challenges
Posted 14 November 2011 - 08:37 PM
#60
Re: Assignments and Challenges
Posted 10 October 2012 - 03:25 AM
ajaymatrix, on 17 May 2008 - 05:42 AM, said:
http://www.spoj.pl
http://icpcres.ecs.b...du/onlinejudge/
http://www.topcoder.com/tc
I was about to post requesting for beginner stuff in C when I was your post. I haven't really gone through all the stuff but I'm liking SPOJ already.
thanks very much
|
|

New Topic/Question
Reply




MultiQuote









|