why does everyone gets so heated up..when it comes to turbo C++ compiler...can someone give me reasons
It is not a C++ compiler.
why does everyone gets so heated up..when it comes to turbo C++ compiler...can someone give me reasons
It is not a C++ compiler.
although this question is basically related to a data structure, still I think that a good progrmmer should be able to answer it. My question is that "is it possible to determine the order in which some ( numbers or characters etc ) are arrived for insertion into a min or max heap ( if we are given that heap )." I think that its answer is yes as there can be so many combinations that we can describe in this regard, but my tutor says that it is not possible, I will be very thank ful for any serious reply.
If only insertion has happened, you are correct in that there are a non-zero number of combinations in this regard.
For example, suppose your min-heap has three elements, looking like
X
/ \
Y Z
where X < Y < Z. Suppose your insertion algorithm fills the bottom row from left-to-right. It's either that or right-to-left. First I'll assume that you made only three insertions with no deletions.
There are six possible orders of input: X Y Z, X Z Y, Y X Z, Y Z X, Z Y X, Z X Y. Whenever Z comes before Y, the following heap results.
X
/ \
Z Y
Therefore, if you have the heap
X
/ \
Y Z
and X < Y < Z, then you know that Y was inserted before Z was. Generally speaking, I think you can only derive the …
They're called "plugins." Winamp has them.
What is your question.
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 adding nodes, proving the inequality.
Actually, Dev C++ is what I'm currently using.
What version? Older versions came with an older, non-conformant compiler. Get the newest version.
Pure genius Dark!
Here is the same in Python ...
print "Hello, World! I am writing in the Python programming language"
How are your C# efforts coming along?
Lies! You replaced the word Ruby with Python!
Maybe that sounded a bit harsh. I don't mean to be inflammatory or offensive.
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, making it sound, as if it were, written, by Captain Kirk.
True. For added fun, consider the Saturn processor in the HP48, with a 4 bit bus size, 4 bit word size, 3-5 word relative and absolute memory addresses (with nibble-addressable memory), 64-bit registers, 20-bit registers, a 16-bit register, a 12-bit register........
Now let's see you predict the values for various sizeofs :-)
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.
Actually, I have had this sort of question, and it was appropriate for the class I was taking. It doesn't help anyone understand programming, but it helps some understand how integers are represented, or why they are represented the way that they are.
bcoz i was not able to do it
Really? How long did you try? If you tried again for the same length of time, would you necessarily not be able to solve the problem then? If you can't be creative enough and effortful enough to solve this problem, how will you ever be creative enough to come up with solutions to harder problems?
The benefit of this problem is that in solving it, you'll improve your creativity. Yes, creativity is learned. Well, conditioned, maybe. At least the problem-solving kind of creativity is. Anyway, this skill is important to your ability in the arena of computer programming, and you might as well get good at it now, or else you'll suck forever.
I would feel more comfortable trusting sizeof(void*) than sizeof(int).
I'm tempted to trust sizeof(size_t) too, but you never know...
Is const void* p the same as a null pointer? Why would i use it?
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.
I have a small problem. I want to make a basic page with an image in the upper right hand corner with the text wrapping around it. I cannot seem to figure this out. I am not a newbie to web design so I feel like a dunce..... :sad:
You want the image to be a background image.
Now, learn HTML and CSS, or else you will be lost and confused for the rest of your web design spree.
Heck, it's even legal to download material protected by copyright law... if you have the author's permission. For example, I just downloaded J_Search's post.
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. The percent sign is given special interpretation, and %s makes the subroutine insert the characters of a string.
Other characters can be used behind the percent sign for different meaning. For example, %d will draw the decimal representation of an integer. E.g.
sprintf(DirString, "%s/cl_log.csv %d", DirName, 478);
The first insertion code, %s, corresponds to DirName, and the second, %d, corresponds to 478. The character array pointed to by DirString will be just like it was in the code you provided, except with " 478" on the end.
You can see a ludicrously (and usefully) in-depth description of all the printf and sprintf options at http://www.acm.uiuc.edu/webmonkeys/book/c_guide/2.12.html#printf, but it does not have any examples.
Multiply the two numbers.
This makes no sense. There are two hundred numbers, and 10000 plausible combinations of them.
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?
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, there are other interpretations, such as dot product, or piecewise product. Or do you wish to perform matrix multiplication?
Unless you better explain what type of multiplication you want to do, you're not going to get a good answer.
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.
f(n) = n + 1000
g(n) = n*n
The first question could have multiple answers.
Assuming they meant "for all n", the answer is definitely not quadratic. The runtime doubles, but only when the input size multiplies by one thousand! If it were quadratic, the runtime would double when the input size multiplies by 1.414. Just find the ration of n^2 to (1.414n)^2.
Generally, we have the relationship: f(1000n) = 2 f(n). What functions fit that relationship?
It grows a lot slower than quadratic. This means that the function is in O(n^2). But it also happens to be in O(n), and some even smaller bounds. (For being in O(n^2) means that the function grows no faster than n^2. If f(x) = x, then f(x) is in O(x^2).)
One function that fits the first equation is f(n) = n^(0.010034333189).
Because then, f(1000n) = 1000^(0.010034333189) * n^(0.010034333189) = 2*(n^0.010034333189) = 2 f(n).
If that relationship they gave only applies to a specific value of n, and not all values of n, well, then you could fit almost any type of function to those two data points. You could let f(n) = 2^n. Then at the point n = 1/999, it would be true that f(1000n) = 2 f(n), and it would not be true anywhere else.
I don't know if this is all very relevant to your exam, but that's my take on the first question.
The second is not even a question or problem, it's just a statement of …
You need to be clear about where your output begins and ends. Your program prints out "This is from slp.pl\n\n"?
Use a different programming language :)
MACROS? What does this acronym stand for?
Use an empty while loop.
What is preventing you from doing this yourself?
Thanks for giving the wrong answer. The outer loop gets executed 1 + floor(log N) times.
The time complexity is not O(N*N).
[Edit: Erm, sorry for being snippy. Anyway, in the outer loop, I gets halved, not decremented, each time. The time complexity is O(N log N).]
#1: Are you just guessing? The answer is yes, but it also is no.
#2: This is a question?
Do you know what it means for two functions to grow at the same speed and for one function to grow faster than another?
The notation O(f) denotes the set of all functions that grow at the same speed as or slower than f. E.g. if the amount of time your program takes to run is 20n*n + 2n + 5, it turns out that your program runs in O(n*n) time, because the function (20n*n + 2n + 5) grows at the same rate as the function (n*n). It is also true that your program runs in O(n*n*n) time, because (20n*n + 2n + 5) grows slower than the cube of n. But saying O(n*n) is more informative. Generally, when people want to know the algorithm time complexity of a program or subroutine, they want to know how long it runs, with respect to some input value. You could give them an exact equation down to the microsecond, but that's not very useful, considering that it'd only be determined for one computer. So it's better to say "the running time grows quadratically with respect to the input size" than "the running time is about 20n^2 + 5n + 2 microseconds." And to say the former, you'd usually use "the running time is O(n^2)."
Sophisticated approach: add hyphenation. <-- may take years to get right!
Heh. If I ever see hyphenation like quantifier-
s again, well, I guess nothing bad will happen, but we'll see :)
Use an array of strings and look up the string.
Java is not purely OOP. It has primitives. (But still a good post, thanks.)
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 more to prevent abnormally poorly spaced lines, using a dynamic programming algorithm. I have never looked at the algorithm; I just know that's what it uses.
TeX uses the 'smart' kind of algorithm, so take a look at http://tex.loria.fr/tex-source/tex-source.html
It depends on your personality. I figure that after learning C++ you're likely to have more of an idea of what is really 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 could have been.
(I presume that eventually you'll end up knowing both the languages anyway, so I'm ignoring any end benefits that the languages have.)
Suppose you want to measure the thickness of a sheet of paper. Don't put a ruler next to the sheet of paper and use a microscope; put a ruler next to a stack of one hundred sheets of paper and use your eyes.
Since this is a pointer to the object, *this dereferences this pointer.
If you say 2*x, compilers will generally use the same code as x << 1. They're smart enough for that.
#include <string>
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.
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 singly-linked, meaning that given a certain node in the list, you can move forward, but not backwards.
There are many 'big Oh's for these functions. In particular, in each case, f(n) is in O(f(n)).
If actual thinking fails, run through the code by hand for various values of N and notice a pattern.
Ok, I'm having trouble attaching anything.
If you use an actual array, &array[0] is just a weird way of saying array.
#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 *) x) << std::endl;
noaddrop y[1];
std::cout << ((char *)(y + 1)) - ((char *) y) << std::endl;
return 0;
}
Learn Perl, and then replace the above description of a program's layout with actual code.
That's not a perl script; that's a bunch of tab separated values.
What does 'abt' mean?
Think about how to solve the problem?
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 file; you're storing them in memory.
One of your error records might contain information like:
Error code: ax332z
Timestamp: 4730728704
Priority: 0
push_back and pop_back are both constant time, efficient operations anyway. The only time I find lists useful is when I have a bunch of iterators sitting around, pointing at specific nodes of the list.