Self-learning programming week 6

Self-learning programming week 6

Am I supposed to be able to figure this out by myself? Am I retarded? Should I just go get a manual job?

Attached: nobrain.png (682x733, 37K)

Is it OK to lookup the solution, understand it, re-implement it or should I spend however long it takes to find it myself

Attached: 1545789924624.jpg (645x729, 48K)

ill just sell my computer and go teach english in china then

Attached: 1545788655702.png (324x362, 45K)

Am I also a brainlet? In the example, how is the answer 2? Should it not be 1 since only one operation was required; the act of filling the second jug with the contents of the third jug (8 - 3 = 5). The first jug started empty, so that doesn't have any action.

Attached: 1517170539354.jpg (480x480, 22K)

Pretty sure branch and bound is the way to go. No way you'll find this by yourself.

Pick up a book and read.

The second jug holds five liters though. You have to go C -> A to get the three liters and them pour them into B.

A,B,C
[3,5,8]

>water is poured from one jug to another until one of the jugs is either empty or full
1. Pour C into A
2. Pour A into B

Oh lol I didn't read the part about fully emptying the jug. Thought you could half empty them

Never look at the solution for these kinds of exercises, you'll learn nothing.

make a decision tree, give up when you reach a certain depth.
:^)

Attached: 1424853067487.jpg (222x221, 26K)

just use backtracking( its pretty fast with heuristics).

Being able to pour a custom amount would make the problem pretty trivial. You'd always either have 1 or 2 as answer and "No solution" would only occur when the total liters don't match up with C's capacity.

Pick up a book on algorithms and data structures. Don’t just bang your hands on the keyboard thinking you’re supposed to reinvent every wheel to be good at devving.

If your only up to that on week 6 you should give up, it's not for you. Sounds harsh but its true. Having a hard time with something this simple is also another indicator but can ussually be ignored because I'm optimistic that people can understand anything but it shouldn't take this long. Sorry.

Drop this shit and start web dev. You are only one app away to become the next Bill Jobes. Then you can employ as many faggot software engineers as you want and screw them out of their money playing the pajeet card and have the white soi cucks suck your dick for being such a generous master

you should be able to do something like this on the first day senpai

Breadth first search.
It's okay to look up the general solution, the more algorithms you understand the easier it will become to understand these problems and even come up with the solutions yourself.

doesn't this shit require an understanding of maths? op prolly doesn't have that background

What page is this?

This is a non-trivial problem, and is meant to make you think deeply about how to apply data structures to solve problems. Do not be discouraged if the answer to this problem does not magically appear to you. This is a problem that is famous for a reason, and requires an understanding of some pretty important algorithms. You are on the right track. Looking at papers published on this topic (yes, there are ACADEMIC PAPERS published on this topic --- that's how non-trivial it is) would be a good step. By all means, look up the solution to this problem after giving it some thought.

I guarantee you most employed developers will be looking up how to implement a solution to this problem, and not just shitting out the 100 lines of code that could go into this.

I wouldn't even think of this as a math problem, because you'd be thinking about it in terms of topology. Definitely think about this as a CS problem that is strongly rooted in algorithms. Sure that's math, but you won't be writing a fucking proof to do this.

Hard problem for average webdeveloper.

Solution use brute force to explore everything possibility or some math formula with modulo.

Search recursivity

I would just brute force this or google it honestly.

Basic as hell problem that can be trivially solved through bruteforcing and a stack to record visited nodes. If you cannot figure BFS by yourself without looking it up you lack basic problem solving skills.

I've done some problems with time constraints where you have to use A* to stay under the computation time limit.

Attached: IMG_0170.jpg (1280x720, 73K)

shit like this has nothing to do with programming

just figure out a project for yourself, a program that you would use for something and just start making it

I could never solve this with code. and even with brute forcing, when you have a lengthy solution how would you know it was optimized?

Woz and John Carmack could code this. Bill Gates and Steve Jobs no fucking way.

0 0 20
0 17 3
8 9 3
0 9 11
8 1 11
0 1 19
1 0 19
1 17 2
8 10 2
0 10 10

This is an undergraduate level programming exercise, and you should be able to program this if you expect to work in the industry. Also, the solution using BFS has been experimentally proven to be complete and optimal. Like most topics in science, you use the empirical research and publications to develop your solution (or prove it) when possible.

You sir are a gentleman and a scholar.

This is literally Hanoi towers

except it's literally not.

Why can't you just pour from C into B directly?

The cups are of limited capacity. You'll reach a previous state quite quickly, the tree should be really shallow.

The problem states that every time you pour into a jug you have to fill it all the way up

I loathe these problems. They are so trivial and detached from any real world usage that I feel literally zero motivation to work through them.
How hard would it be to take a REAL problem and give that as an exercise? Harder for the teacher, obviously, but way better for the student.
No I don't give a fucking crap about your god damned jugs that have to be either filled or emptied. The rules don't make any sense. The only jugs I give a fuck about are my wife's triple Ds.

>How hard would it be to take a REAL problem and give that as an exercise?

writing exercises or exam questions that actually test your understanding is a skill that few ever master. I had exactly one EE class where they tested understanding rather than rote memorization.

It appears that in this case, if you know BFS it's kinda trivial, and if you don't, you spend a few hours developing it. anything that is basically brute force tests very little.

no it does not. If jug A can hold 10 but has 5, and jug B holds 1, then you are emptying B into A rather than filling A

Either you already know that you have to use BFD and you do it or you google the problem and you learn that you have to use BFD and you do it. The problem is so boring that a student cannot feel motivated and will treat it as a chore rather than a learning experience

wut is bfd?

Autocorrect. Phoneposting right now, or should I say shitposting perhaps. Quite literally

>The problem is so boring that a student cannot feel motivated and will treat it as a chore rather than a learning experience
Change degree then. The market is already over saturated with bad developer, there is no point in continuing if you hate what you're doing.

where is this from

>the future of the white male