|
I love how the first post on every problem is someone doing it in assembly.
|
# ¿ Mar 29, 2015 18:26 |
|
|
# ¿ May 14, 2024 23:18 |
|
If the nodes aren't marked as visited then they will never finish.
|
# ¿ Apr 25, 2015 15:47 |
|
I'm not quite sure what you mean by that. Which nodes are being put into the queue? In what order are they being put in? How are you using the queue?
|
# ¿ Apr 25, 2015 16:48 |
|
That runs in O(V+E) time, but it doesn't color the graph. It merely verifies that it is colored.
Dr. Stab fucked around with this message at 17:11 on Apr 25, 2015 |
# ¿ Apr 25, 2015 17:03 |
|
I'm just a little confused because that's not BFS or DFS. If they needed to actually do one of those to generate a 2-coloring, you couldn't just visit the nodes in an arbitrary order.
|
# ¿ Apr 25, 2015 17:14 |
|
LeftistMuslimObama posted:OK, how does this solution sound: I don't think this is quite right, or at least isn't clear to me. What do you do if the correct path requires edges that were in previously checked paths?
|
# ¿ Jun 24, 2015 19:19 |
|
sarehu posted:Uhhh... But O(E/2) = O(E) which means O(E) + O(E/2) + O(E/4) + ... = O(E) + O(E) + O(E) + ... = O(E log E). What was really meant was O(E + E/2 + E/4...), but is pretty clear as it was written. While you're technically true, it's not useful to the discussion at hand. e: in case you're actually confused, the series asymptotically approaches 2E.
|
# ¿ Jun 26, 2015 20:52 |
|
Don't actually generate the numbers and count all the bits. Try to figure out a pattern and calculate the sum. Like: 1 bit: 1 2 bits: 4 3 bits: 12 Is there some pattern you can use here? Think about defining each term in terms of the previous term. e:Wait, derp. You're going up to 10^16, and not 2^16? Well, you can apply the result from the problem that I thought it was to get the solution to the actual problem. Dr. Stab fucked around with this message at 11:45 on Jul 10, 2015 |
# ¿ Jul 10, 2015 11:21 |
|
Hadlock posted:Has anyone written anything of great interest using Rust yet? I really don't see this being the case. It's not like there's some fundamental difference between the two. Atom looks and feels a lot like sublime. The real argument is atom/sublime vs vi.
|
# ¿ Oct 16, 2015 05:36 |
|
22 Eargesplitten posted:Induction: The shortest path between any two points will also contain the shortest path between any two points on the path. You want to prove that? Because that's easy. Say you have a shortest path from A to C that passes through some arbitrary point B. Assume the path used from B to C is not shortest. That is, there exists some shorter path from B to C. Then we can construct a path from A to C through B using our shortest path from B to C that is shorter than the given shortest path from A to C, a contradiction.
|
# ¿ Nov 8, 2015 06:44 |
|
I'm not sure what you mean by redistribution, but it seems like what you want is GPL. Rolling your own license is a very bad idea, and you should avoid doing that if you can help it.
|
# ¿ Mar 13, 2016 16:59 |
|
I would just go with the one that conveys the intended meaning the best, which will almost always be "if (foo == 0)"
|
# ¿ Apr 10, 2016 19:08 |
|
I'm not really an expert on what's best for that situation, but I can't imagine php being the right choice unless you already have a lot of experience with it. What language/framework is best for you depends on exactly what your needs are and what you are familiar with. Running github on your own server seems like huge overkill for what I assume to be a personal project. Most repository hosting services (including github) allow you make your own private repositories on their servers for free (whereas github enterprise starts at $2500/year + the cost of hosting your own server). In terms of version control for Unity, Unity 5 has a tool called UnityYAMLMerge. It allows you to resolve conflicts on scene and prefab files. You should integrate it into your git configuration.
|
# ¿ Jun 1, 2016 16:21 |
|
So, it looks like what you're trying to do is something like this.code:
e: to clarify what you were doing: You initialized build to an array with one element, that element being a dictionary defining your attributes. Then, you iterated over that one element, checked to see if your type parameter was the dictionary, then added a copy of the dictionary as a key to the dictionary, with the value being whatever you passed into value. e2: Looking back at your original post. It sounds like you're having trouble with making this persist. Where are you storing the state of your current build? Because right now, that function defines a local variable and doesn't return anything, so that build doesn't exist outside the life of that function. Dr. Stab fucked around with this message at 17:46 on Sep 26, 2016 |
# ¿ Sep 26, 2016 17:22 |
|
Yeah, I do some stuff that works on a data set of every card ever printed in magic the gathering, and that poo poo is super small. Also, I think the same text copy pasted a few thousand times probably gzips a lot better than the actual thing. But, it will probably still be under a meg. MTG JSON, which is what I'm using, zips to just under a meg. The only thing you should need to download as required is card images. It'll probably end up being slower if you have to make an http request for every single card file. Also, Pokemon cards may feel like they're simple, but there's some very tricky effects in there. You could get 95% of cards implemented in a snap once you have the basic rules set up, but those few remaining cards will end up making this a massive undertaking, especially once you realize that those cards also happen to be the ones that people want to play with.
|
# ¿ Jan 26, 2017 07:38 |
|
it is posted:Thanks for the suggestions guys, I'm pretty sure I know where I'm going with this. There's still cards like ninja boy or even garbodor that are trickier than you may think to in a modular way.
|
# ¿ Feb 1, 2017 18:18 |
|
UML is a very broad thing. It's a standard for drawing a large number of kinds of diagrams for specifying software. You'll have to be a bit more specific. I'm assuming they want you to draw a class diagram, but I'm not sure.
|
# ¿ Feb 2, 2017 01:58 |
|
That looks exactly right.
|
# ¿ Feb 2, 2017 02:22 |
|
You need to fetch in order to see changes to the upstream.
|
# ¿ Mar 1, 2017 19:01 |
|
Peristalsis posted:So the value here is that committing locally triggers runs of the test suite that you might not otherwise make? (Again, I'm genuinely curious.) No, it means you get a more granular history to bisect on when trying to identify the source of a bug. e: A pretty big deal with local history is that you can branch locally. Make some experimental changes to your feature, abandon them, and maybe come back to them later. No need to add a new feature branch to the main repository for your little 10 minute digression. Dr. Stab fucked around with this message at 22:51 on Mar 6, 2017 |
# ¿ Mar 6, 2017 22:44 |
|
The cyclic buffer idea is best, but you just store the index of the head rather than a pointer. Also, it should be wrapped in a class so that you don't need to worry about offsetting the head everywhere you use it and can just ask for the nth value as though it were the other implementation.
|
# ¿ May 22, 2017 22:01 |
|
Eela6 posted:No. It will, though (assuming you're using real words and not just the arbitrary string "well, actually" repeated over and over again). Letters in English are not remotely uniformly distributed. Wouldn't a non-uniform distribution be more likely to have this method give you a wrong answer? If you assume that the letters are uniformly distributed, then the top 5 letters are most likely correct. But if, like in a language, letters appear in clusters, you're more likely to have weird outlier scenarios. Like, eg, if a tenth of all words started with "qwert" and "qwert" didn't appear anywhere else, those letters would be very frequent, but also be a good candidate for the best set. I know that's a contrived scenario, but I just mean to demonstrate that uniform distribution would help rather than hinder this approach. Also, I really don't agree with this idea considering that the original problem is not especially unfeasible. An 83 fold speedup is cool, but not at the expense of correctness, especially since you can run the brute force solution for the same amount of time and get a similar result.
|
# ¿ May 29, 2017 19:20 |
|
Saying "just use the first 12" is an approximation. It happened to be right in this particular instance, but that's not the same. I could easily throw another set of words at it that would break it. Now, if your algorithm actually performed that calcuation, and chose which letters to exclude based on that then that would be another thing. Also, your idea here gives me a better idea. As you're iterating, whenever you find a candidate letter set, cull all letters with higher frequency from consideration. You'll probably save a bit more computation this way versus culling once ahead of time using a a rough upper bound.
|
# ¿ May 30, 2017 00:07 |
|
Eela6 posted:Okay. Give me a set of ten thousand or more unique English words that breaks this.* I was responding specifically to the fact that you were saying that it wasn't an approximation. You made an assumption, and did some calculation to demonstrate that it was correct. I'm not trying to poo poo you because you made an optimizing assumption about the real world behaviour of the problem. I'm just saying that it's a different thing than a program that solves for any instance.
|
# ¿ May 30, 2017 01:49 |
|
Eela6 posted:And I'm saying that claiming you could easily build a list that beats it is different from actually doing so You also added the caveat that the list needs to be very large and use english words. I'm not sure exactly what you're trying to prove but you're being a gigantic dick here. Are you saying that you don't actually believe that it's possible to synthesize an instance that doesn't work, or are you just trying to win some argument that you think you're having? I'm still not sure why you're being so hostile in asking for this, but here's a rough idea of what I was thinking for my algorithm: code:
e: Also you really seem to care about the example instance I was thinking of, so something like this: https://pastebin.com/j9y70An5 It doesn't meet your restrictions but that's the sort of thing I was thinking of. Again, I wasn't saying that there's anything wrong with solving it as though it were a real world problem. I'm wasn't trying to poo poo on you in any way. It's just a different thing. Dr. Stab fucked around with this message at 02:32 on May 30, 2017 |
# ¿ May 30, 2017 02:24 |
|
Eela6 posted:Sure! I am relatively confident you will not be able to build a solution; but if that's not the case, I'd love to see it. I'm not sure what I did to slight you, but gently caress you too I guess.
|
# ¿ May 30, 2017 02:40 |
|
Eela6 posted:It was this entire post: Again, this is the sort of thing I was thinking of: https://pastebin.com/j9y70An5 Here, the most common 4 letters are part of the set.
|
# ¿ May 30, 2017 02:51 |
|
Yes I totally understand that you made an assumption about the real world behaviour of the problem. I'm not disputing that. There must be something really off about the apparent tone of my posts, because I was just trying to discuss the problem. I wasn't trying to challenge your intelligence or anything. I was just responding to what you said here: quote:I'm not 'efficiently approximating', I'm getting the correct answer. to say that, no, it was an approximation. You made an assumption about the nature of the problem, specifically that the program would only be applied to sufficiently large lists of english words. Like there's nothing wrong with a solution that's quote:(assuming you're using real words and not just the arbitrary string "well, actually" repeated over and over again) but then when you say "actually no it's universally correct" that's a different thing.
|
# ¿ May 30, 2017 03:27 |
|
Liberally apply <marquee> tags and don't let anyone tell you otherwise.
|
# ¿ Jul 11, 2017 17:43 |
|
Linear Zoetrope posted:Just to make sure my intuition is correct, it's impossible to uniformly randomly choose m distinct instances from n things iteratively (that is, without knowing n upfront), correct? To get one state at random, it seems pretty obvious to me. At step n, 1/nth of the time, choose the current state, otherwise keep previously held state. Getting more states shouldn't be impossible, but I can't think of a precise method right now. e: at step n, 3/nths of the time, update a previously chosen state to the present state. Easy peasy. Dr. Stab fucked around with this message at 20:30 on Jul 11, 2017 |
# ¿ Jul 11, 2017 20:23 |
|
Sedro posted:Can't you store the selection in a cell and use it to compute both the background color and the sum? You can, but he didn't. So, it doesn't help at this point.
|
# ¿ Sep 8, 2017 00:40 |
|
AgentCow007 posted:Is there anything legitimately useful/productive that you can do with recursion, or is it just retarded mental gymnastics for CompSci classes? I don't imagine there's a lot of money to be made checking strings for palindromes or calculating Fibonacci numbers. Recursion is very useful and it pays to be able to think about problems in that way. Also, you'll get along with people better if you don't call things retarded.
|
# ¿ Dec 20, 2017 17:48 |
|
Dominoes posted:I'm new to open-source collaboration. What do you do with your local code after you merge someone's PR on Github? Deleting and git-cloning the local code would work; is there a more elegant way? Why can you just pull?
|
# ¿ Dec 23, 2017 23:25 |
|
git pull and git push are two pretty useful commands to learn. They're what let you talk to remote repositories, such as the one on github. If you initialized your repository with a clone, then you should be able to run "git pull" with no additional parameters to pull any changes to the master branch, assuming that you don't have any conflicts with the github repository and your directory is clean (no uncommitted work). For a fork and pr based workflow with no branches, accepting a pr would look like 1. "git push" to bring your github master up to date with your local. 2. At this point I would download the pr and review it, but let's just say that it's fine for now 3. Accept the pull request on github 4. "git pull" to bring your local repository up to date with the one on github.
|
# ¿ Dec 24, 2017 00:23 |
|
I'd assume online blackjack would reshuffle after every hand and eliminate the edge from counting cards.
|
# ¿ Jan 6, 2018 03:16 |
|
underage at the vape shop posted:Why is this returning an empty string?If you print the values its getting them correctly. Java Strings are immutable. Nothing ever changes a string in place. Using code:
|
# ¿ May 9, 2018 13:11 |
|
Uhh Nope posted:Haha you nailed it, I am stuck on 1.7. The assumption "z <= n" is where n is introduced. The assumption step is saying "assume that the algorithm is correct for case z=n, and all cases z<n" for some arbitrary n Then, to prove by induction, you prove that, given the above assumption, the algorithm gives correct answer for case z=n+1. That, combined with the fact that you know the algorithm is correct for z=0, means that the algorithm is correct for z=1. Then, since it's correct for z=0 and z=1, it's correct for z=2, and so on down the number line into infinity. It's not really a great first example because it has a bunch of little wrinkles, but that's the crux of what you're trying to do when you prove something via induction. Dr. Stab fucked around with this message at 23:50 on Oct 16, 2018 |
# ¿ Oct 16, 2018 23:47 |
|
leper khan posted:I already gave the tip. If you took the time to read and comprehend my short post, you would see that. Look at and reason about your data layout and optimize for cache misses. I'm happy you got to feel like you brutally owned that noob, but that's actually not something you can do at the same time that you're helping them. Pick one of the two.
|
# ¿ Apr 14, 2019 18:35 |
|
You need a solid basis in mathematics if you want to be a computer scientist. You need at least some understanding of set theory to understand the basics of the theory of computation. You don't need to be a computer scientist at all to be a world class programmer.
|
# ¿ Nov 27, 2019 17:00 |
|
|
# ¿ May 14, 2024 23:18 |
|
Pakistani Brad Pitt posted:Thanks for all of the very quick answers (and the detail, KillHour/Dominoes)! Even in that case, rather that throw around bill objects, I would just make a MoneySupply object, with properties like num20, num100, etc. Then, you can write methods like totalMoney() or canMakeExactChange(). Then, give each player and the bank their own MoneySupply. The idea here is that all the code that cares about fiddling with money goes in the money class, and other classes only need to think about money in a broad sense. e: also, later, if you decide you need individual bill objects, you can just change the implementation of the MoneySupply class and not have to touch a bunch of different places. Dr. Stab fucked around with this message at 20:20 on May 25, 2020 |
# ¿ May 25, 2020 20:18 |