1,684 Posted Topics
Re: You're right; this isn't really recursion; you're just making a cute loop (and never returning :-)). Once you get this working properly, the stack datastructure you are currently using will be replaced by the chain of recursive calls (which in a way, can be thought of a datastructure, too). Here … | |
Re: You can tell yourself. You understand how every individual part works, right? So simulate the code by hand, and you'll see where it's going wrong. | |
Re: In C and C++, the 'double' datatype can be used to store approximations of the real numbers. For example, [inlinecode]double x = 3.5;[/inlinecode]. Use doubles to store all your resistances, and then you can do approximate arithmetic on them. These approximations can store about fourteen decimal digits of precision. They're … | |
Re: [QUOTE=qljolly]I have been working on this for the past week and i am almost done but i dont know why my program keeps crashing at the end game check and also it doesnt realize that there is a piece that interrupts the connect four if it were like XXXOX it … | |
Re: I never had a vending machine problem, but I've had airport simulations and matrix classes :-) | |
Re: I don't know how much you know so apologies if I repeat stuff you already know. Your constructor that uses no arguments is not assigning anything as the value of numerator and denominator. For that reason, whatever happened to be stored in memory at the physical location of numerator and … ![]() | |
Re: If you're thinking about "relationships" like association, containment, and such, then you're not thinking about solving the problem. Think about what your program would be doing when running minesweeper, and then the classes that you find convenient to use will fall out directly from the types of objects you're thinking … ![]() | |
Re: [QUOTE=Narue]If you're really interested in being precise, you can work out a detailed analysis based on the increasing inner loop iterations. But that's not always worth it, and certainly not for this question.[/QUOTE] To give an example of what Narue's talking about, it's not too hard to see that the … | |
Re: This is fairly straightforward to write. [url]http://planetmath.org/encyclopedia/CubicFormula.html[/url] | |
Re: Prove it for the cases where N is one less than a power of two. Then, as you add new elements across the new bottom row, find a pattern into how much each individual element contributes to the total possible number of comparisons. | |
Re: lionsh, were you told that this is possible? I have a feeling it isn't possible. | |
Re: = is the assignment operator, not equivalence test operator, and you probably declared a as const. | |
Re: What you do mean, "access their computer"? A computer at home? This is probably not the right forum for this question. | |
Re: What is this disease that people have which causes them to want their PCs to look like Mac OS X? This is the saddest thing ever. | |
Re: First, what if stdin doesn't contain a newline character? You've got an infinite loop, then. Second, your linked list is finishing off with a node whose tail pointer (and character) is uninitialized. Third, if the value passed for N is null, then the caller cannot see the linked list you've … | |
Re: I think a neat, but relatively simple problem, would be to create an reverse Polish notation calculator. It would take a line of input, like, 2 3 + 5 *, and display 25. You'd need to understand what reverse Polish notation is; you can look online, probably Wikipedia. Or try … | |
Re: > Note that you should use square brackets, [ and ], rather than the curly brackets, { and }, in the tags I mentioned. Oh, so you're saying we should use code tags? :D | |
Re: He's talking about parsing sequences of DNA. | |
Re: This requires some basic algebra. 80 = 2m + w, where w is the width of the rectangle, m is the width of the margin. | |
Re: Here is Narue's tutorial on finding O notation bounds, which has had success with some learners: [url]http://eternallyconfuzzled.com/articles/bigo.html[/url] Here is my tutorial, which was helpful to one person looking for a more precise definition. It was written more as a clarification than an introduction. [url]http://shobadobs.com/tuts/big_o.html[/url] There's Wikipedia and MathWorld, but their … | |
Re: [QUOTE=njzillest]I started C++ a few weeks ago.. I want to go to MIT for computer science, and for that i want to learn a few computer languages.[/QUOTE] Go ahead, let the rest of your life be decided by a ninth grader. (Hehehe.) [QUOTE=njzillest]I know how to make loops and random … | |
Re: [QUOTE=degamer106]- How do I get the one's complement operator ~ to work? I've tried inserting it here and there but all i get is smiley faces or some funky symbols. [/QUOTE] The one's complement operator subtracts your number from the maximum possible unsigned integer that can be stored. For example, … | |
Re: Unfortunately, it gives the idiotic FOX News side of the story. Of course, all news channels are idiotic. But I don't get what FOX News has to do with Daniweb. | |
Re: [url]http://eternallyconfuzzled.com/tuts/sorting.html[/url] | |
Re: [QUOTE=Narue]If flipbit doesn't return a value, you need to pass a reference so that any changes are reflected back in the calling function: [code]void flipbit(unsigned& a, unsigned b)[/code][/QUOTE] Yustme, note that what Narue posted is valid C++ code, but not C code (and it looks like you're using C based … | |
Re: The main use of the factorial function is that it's the Hello World of recursive functions. Along with the Fibonacci numbers, it is the first example used in many classes. Computing individual factorials is usually not useful. But understanding the concept may be useful. They are often found in formulas … ![]() | |
Re: [QUOTE=iamthwee]That way [b]we[/b] don't have to correct your silly mistakes.[/QUOTE] dubeyprateek: Please don't consider iamthwee's style of response to be representative of anybody else's attitudes here. | |
Re: If it's a substantial amount of money, then you can afford to buy some extra cheap computers. | |
Re: I've spotted a bug! The google ads have images in them!! Okay, it's just St. Patrick's Day. Never mind... | |
Re: Nice to meet you. Maybe you meant 'else if'? This is not the right forum for your question. | |
Re: You know how to make a simple truth table, right? For example, [code] a | b | a AND b ---+---+--------- F | F | F T | F | F T | T | T F | T | F[/code] If you want to make a truth table for … | |
I'm being shown threaded mode for some reason, while my preferences say otherwise. [edit: Okay, it looks like I can change it.] But still, threaded mode on by default is a bad idea. Threaded discussion structures are a bad idea in general; they only got created in the first place … | |
Re: Write them in English, and don't be wrong, and they'd be much better. ![]() | |
Re: [QUOTE=Narue]Alternatively, if all you need is to print the rounded double, any formatted output option will do it for you (which opens up ideas for those clever workarounds I was talking about).[/QUOTE] Eww! That would just be sick. | |
Re: Um, why would you even [i]expect[/i] this code to work? Do equalsList, precedesList, and stringToList work as advertised? | |
Re: Yes. Of course, I don't care about BASIC :P | |
Re: This depends on the implementation of malloc. | |
Re: It is O(length), but what is the variable s? Is it a string of fixed size? Is it a variable length string? If so, then generally, your running time is O(length * s.length()), because the indexOf method should take O(s.length()) time in the average and worst case. Holding s.length() fixed, … | |
Re: If you learn Java now, you'll be bored during the Java course. Learn Scheme. It's a simple language, and is very powerful (in terms of writing useful programs quickly). You'll have a different perspective on things that will make you consider Java and other object oriented languages to be languages … | |
Re: They're right; it's a lot of theory. You should still study computer science for what you want. (I don't know whether this recommendation comes from my honest assessment of your situation or my desire to sic theoretical classes onto unsuspecting victims.) [quote]-- Web Programming (Web Development using PHP, ASP, .NET, … | |
The End.