1,684 Posted Topics
Re: Your base case would be a tree of height zero (with one node); your nth case would be a tree of height n, and you'd use strong induction. You could prove equality for the special case of a full tree -- unfull trees can be made into full trees by … | |
| |
Re: [QUOTE=chrisbliss18]It's funny, but almost all of sunnypalsingh's questions sound like questions that an idiot teacher would ask. Knowing the answer to such questions doesn't help anyone understand programming and definately doesn't help a programmer develop good technique.[/QUOTE] Actually, I have had this sort of question, and it was appropriate for … | |
Re: I would feel more comfortable trusting sizeof(void*) than sizeof(int). I'm tempted to trust sizeof(size_t) too, but you never know... | |
Re: This tutorial is very bad, because it defecates code on the reader without teaching anything. And some of the code, like the image example, is wrong. Somebody who reads this tutorial would end up pushing buttons without knowing what he was doing. Also, the way there are, too many, commas, … | |
Re: [QUOTE=bumsfeld]Is const void* p the same as a null pointer? Why would i use it?[/QUOTE] No, that's a pointer named p. You might use it for holding the memory address of something. For example, memcpy takes a const void* argument. | |
Re: Do something in a Unix-like operating system in a language different from C# that is not under a Microsoft framework. You'd learn a lot more that way, wouldn't you? | |
Re: If you're using C++, sprintf is not the right tool. Now here's the answer. The second argument is a format string. The sprintf subroutine copies the format string to the bytes of memory pointed to by DirString. The thing is, it replaces "%s" with the contents of the string DirName. … | |
Re: You need to be WAAAAAAAY more clear. Multiplication of two integers or floating point approximations is well-defined and everybody knows what you mean. Multiplication of arrays is not. Do you want to make a multiplication table? That's one interpretation, and since you mentioned a two-dimensional array, that seems possible. However, … | |
Re: Yeah, it is basically the same thing as a class. Keeping 'struct' in the language kept C++ a near-superset of C, since C contained structs. The real mystery to me is why they added 'class' in the first place. I guess it was to make the language seem more object-oriented. | |
Re: #1: Are you just guessing? The answer is yes, but it also is no. #2: This is a question? | |
Re: MACROS? What does this acronym stand for? Use an empty while loop. | |
Re: If actual thinking fails, run through the code by hand for various values of N and notice a pattern. | |
Re: There are various text justification algorithms, some better than others. For example, one simply asks, "How many words can I fit on the first line?" and then spreads those words evenly on the first line. Then it looks at the rest of the words. A smart text justification algorithm does … | |
Re: It depends on your personality. I figure that after learning C++ you're likely to have more of an idea of what is [i]really[/i] going on in your computer program than you are with Java. Since I was uncomfortable without that knowledge, C++ was a better match for me than Java … | |
Re: If you say 2*x, compilers will generally use the same code as x << 1. They're smart enough for that. | |
Re: Make a chess playing program. You could make one in 3 days, but with a whole year you could try making it learn. | |
Re: Since [font=monospace]this[/font] is a pointer to the object, [font=monospace]*this[/font] dereferences this pointer. | |
Re: The "two way" part of its name means that you can iterate in both directions. That is, if you have an iterator pointing at a particular element of the list, you can move the iterator to the previous element or to the following element. Other styles of linked lists are … | |
Re: Also, I recommend learning about the use of 'classes' and 'ids' involving CSS, since trying to use CSS without classes or ids is like trying to play the piano without any fingers. | |
Re: There are many 'big Oh's for these functions. In particular, in each case, f(n) is in O(f(n)). | |
Re: If you use an actual array, &array[0] is just a weird way of saying array. [code]#include <iostream> class hiddenaddr { public: void* operator &()const { return NULL;} }; class noaddrop { private: void* operator &()const; }; int main() { hiddenaddr x[1]; std::cout << ((char *)(x + 1)) - ((char *) … | |
Re: That's not a perl script; that's a bunch of tab separated values. | |
Re: An error record is a record of an error. Consider, for example, a web server. Some errors can happen, such as a File Not Found error, or a Permanent Redirect. You need to create a structure that holds this sort of error. Apache would store these errors in a log … | |
Re: To remove the nth element, just use begin() + n as the iterator. | |
Re: First of all, you passed p_beginning to the function and then tried to use k_beginning. Your code compiles? Second, you expect us to have a crystal ball that can read your mind. What does "add_before_element" mean? Do you want to add before the element containing 'number'? Or do you want … | |
Re: Are you looking to use a program that edits text solely from the command line? | |
Re: Make it more "powerful"? Exactly what do you mean? | |
Re: There is no practical purpose for this. Therefore, this is a homework problem. Therefore, show what you've tried, and if you demonstrate thought, you might get help. | |
Re: Suppose you have the scrambled string, "urcoppnei". You want to be able to quickly go from scrambled string to unscrambled. How? Sort the letters of the string in increasing order. That gives us "ceinoppru". Now take every word in the dictionary, and sort their letters in increasing order. Put this … | |
Re: You can't change the ordering of a map. You want to copy the contents of your map to a datatype such as a vector, and then sort the vector by the value. You can do this using iterators. | |
Re: Think carefully about how you store your data; and use floats when doubles aren't needed, shorts and chars when they suffice; and avoid memory leaks; and perhaps trade running time for memory. Process files incrementally instead of loading them all at once, whenever you can. | |
Re: [font=monospace]myIter - myVec.begin()[/font] would be a start. | |
Re: [quote=rkahn144]I want to take control of my visitors' computers.[/quote] Write a Web browser that supports this somehow, and then ask your users to download this Web browser, and see if they like it. | |
Re: #1 has a solution but #2, without a set of base cases, is only solvable (I assume the "solution" that you want is for T to be defined in closed form) for one value of n. | |
Re: [QUOTE=server_crash]Anyways, I'm just plain sick of hearing about it. It's all over the news. I just don't get why that women and other people let the war have so much affect on them. Why don't they let it go, support what's going on and shut up?[/QUOTE] Absolutely, man! Ignorance is … | |
Re: For convenience, let f(n) = 6 * (2 ^ n) + n ^ 2. What is this really saying? For all values of n that are reasonably large (greater than n0), show that f(n) is bounded by two multiples of g(n). Then c1 <= f(n) / g(n) <= c2. In … | |
Re: This article said, "Lots of people use HTML incorrectly, so therefore, use XHTML!" There's a gaping hole in that argument. Coding HTML to the standards while closing closable tags is just as effective as using XHTML. Not that there's anything wrong with XHTML. But this particular argument is rather flaky. | |
Re: Suppose you've got [code]for (i = 0; i < N + 1; ++i) { for (j = 0; i < N - 2; ++j) { some_constant_time_function(i,j); } }[/code] The total number of times some_constant_time_function() would be called is (N + 1)*(N - 2), is it not? Which expands to N^2 … | |
Re: [QUOTE=Drowzee]the answer to number 3 (assuming the number is an integer) is to use the modulous operator, %. [code] if(!(numbername%2)) cout<<numbername<<" is a power of 2."<<endl; [/code][/QUOTE] Um, no. This only tells if the number is a [i]multiple[/i] of 2. For power of 2, that'd be (!(x & (x - … | |
Re: [QUOTE=shashankk]Can anyone pl. mail turbo c++ setup as attachment to[/QUOTE] I would recommend free software that exists and you can use for free, but you don't deserve it. | |
Re: Use 1 and c as your starting points; they'll always work, because the square root will always be between them. You can't really pick any fraction of c, like c/2, without testing its resulting sign first. And if you do that, well, you've already started the bisection process. So 1 … | |
Re: Maybe try writing down only the things you need to remember. It's not like you need to record a transcript of the lecture. | |
Re: I suppose you'll run into problems if the word ends up being "superconductors", or "Lackawannanians", or "indistinguishable", or "incomprehensible". | |
Re: [QUOTE=lemkam]I've got a bit of a problem that I could use some help with. There appear to be an extensive number of sites that are linking to mine, but are using an incorrect link to do so. Aside from searching Google, Yahoo, etc. with the phrase "link:www.mysite.org" and then checking … | |
![]() | Re: [QUOTE=iamthwee]Hi everione, my next assinement is 2 do with classes. I dun no what they are tho and why u will use them? Can any1 explain them to me I would B greatfull.[/QUOTE] You're taking a class and you want us to do work for you because you didn't feel … |
The End.