What does the following algorithm do? Specifically, what is the meaning of variable b after the algorithm comp
356197
OK, here is what is going on and then the answer:\n\nFirst, assuming that we have the array a (which we assume we do according the problem), then this algorithm is going to look at each item in an array and will assign B a value. The value B holds will be true only if B was true to start and the current item in the array is less than the next.\n\nTherefore if the array A was defined as follows:\n\na[0] = 1\na[1] = 2\na[2] = 3\na[3] = 5\na[4] = 6\na[5] = 8\n\nThe algorithm checks if a[0] <= a[1], and since it is and B is true as well, then B is set to true;\nthen we check a[1] <= a[2], and this is true. Since B is true and this is true, B is set to true. \nthen we check a[2] <= a[3], and this is true. Since B is true and this is true, B is set to true.\nthen we check a[3] <= a[4], and this is true. Since B is true and this is true, B is set to true.\nthen we check a[4] <= a[5], and this is true. Since B is true and this is true, B is set to true.\n\nTherefore it can be determined that as long as the items in the array keep increasing or staying the same (or non-decreasing) then the algorithm will end with B true. So, Answer D is the correct answer.\n\n\nGood luck!
136546
here's an output step by step:\n\nthis is the initial state of deque D\nD :: first -> <- last\n\naddFirst(3)\nD :: first -> 3 <- last\n\naddLast(8)\nD :: first -> 3 8 <- last\n\naddLast(9)\nD :: first -> 3 8 9 <- last\n\naddFirst(5)\nD :: first -> 5 3 8 9 <- last\n\nremoveFirst()\nD :: first -> 3 8 9 <- last\n\nremoveLast()\nD :: first -> 3 8 <- last\n\nfirst()\nfirst = 3\n\naddLast()\nD :: first -> 3 8 <- last\n\nremoveFirst()\nD :: first -> 8 <- last\n\nlast()\nlast = 8\n\nremoveLast()\nD :: first -> <- last\n\nhope this helps...
150391
It is a strings proccessing alg which uses a failure function to improve the run time rather than bm alg\nrun time:m+n\nm:the length of the pattern\nn: the length of the text\nwe use tis algorithm to find the pat string in the text string..\nmore details \nmail me at ziko@math.com\ni can provid a pascal source for it
19284
It's a notational convenience.\n\n1) It helps avoid the problem of running out of unique symbols when working with a large, possibly infinate, set of variables.\n\n2) It provides a way to keep track of ordering in a set of variables when that ordering makes a difference.\n\n3) It makes it possible to express the values of a sequence of variables when their value depends on their position in the sequence. An example would be the Fibonacci sequence where each number in the sequence is the sum of the two previous numbers (the first two being defined as 1). It can be expressed as: \n\na(sub)1 = 1\na(sub)2 = 1\na(sub)n = a(sub)(n-1) + a(sub)(n-2)
554827
Well, I suppose you want a program that computes the trace of a matrix. The trace is simply the sum of the elements in the diagonol in a matrix. I won't show it to you with OOP since there's no reason to.\n\nint trace(int matrix[][],int numrows,int numcols) {\n\nint tracetotal = 0;\n\nif (numcols != numrows) {\nstd::cout<<"Error: Can't compute trace. Not square matrix.&#92;n";\nexit(1);\n}\n\nfor (int i = 0; i < numrows; i++) {\ntracetotal+=matrix[i][i];\n}\n\nreturn tracetotal;\n}
978671
[i]  = I\n[d]s = does (without the s it would be do)\n[t]  = to or the\n[o] = of\n\nAnyway I think all the [ ] are suppose to be abbreviations and these are the most likely.◘
573287
Algorithm\n - a step by step description of a specific solution to a known problem.\n\nFor example, there are any number of algorithms (ways) of sorting information.  The bubble-sort algorithm isn't very efficient but is simple.  Binary sort is more efficient but more complex.\n\nBy understanding the way a solution works before even thinking about programming it you can identify the one most appropriate for your situation.  Different algorithms will require more space, more time, or more complexity.  \n\nYou can understand them and their trade-offs as concepts.  Then when you are ready to program the solution (apply the algorithm) you have a very good chance of getting it right.
48168
D. If a variable some times equal to its both of the bounds, it will be mentioned or written as [a,b] generally called as values between a and b inclusive of a and b both, as per the case mentioned here, the variable can take any value between a and b inclusive of a, so a<= variable < b written as [a,b[
121228
here is a simple program algo\n\nprogram quad\nbegin\nvar\n     declare variables;\nget variable values of a,b,c for equation ax2+bx+c=0\nd=)b*b)-4*a*c;\nif(d<0)\nbegin\n\n   root are imaginary;\nend\nelse\n\n    root1=b(sqrt(d))/2a;\n    root2=-b(sqrt(d))/2a;\n ( note : formula i am not sure make changes as per required)\nprint the value of root1 and root2;\nend
253055
Off the top of my head, don't hate me if there are errors...\n\nclass MyVar\n{\npublic:\n  int a;\n  MyVar ( MyVar& src )\n  { a = src.a; }\n}\n\n...\nMyVar p;\np.a = 5;\nMyVar q(p);\n// q.a==5 is true
350177
Sometimes adding some indents will help figure out what's going on.  In your algorithm, you have a lot of nested if and while statements, so space them out like this first to see how each is related to each other (I'm using periods because Yahoo won't show spaces):\n\ni <- 0\nwhile (i < n) do\n...j <- i+1\n...m <- a[i]\n...while (j < n) do\n......if (m > a[j]) then\n.........m <- a[j]\n......end if\n......j <- j + 1\n...end while\n...b[i] <- m\n...i <- i + 1\nend while\n\nYour i is a counter that starts with 0, and your j is a counter that starts with 1.  j will always be more than i.\n\nThe "while (i < n) do" line limits this algorithm to 3 loops, since n is 3.\n\nDirectly after this statement, j is established as a counter, and m is defined to be the i-th element of your matrix.  The next while statement then compares m (the i-th element in the matrix) to the element after this (using j to read the next element).\n\nIf m is larger, then the if statement makes m take on the smaller value.  If m is smaller, nothing happens and j is indexed to the next value.  Then the process repeats itself.  If we get to the end of the matrix and m isn't replaced anymore, it becomes the i-th value in matrix B.  After this, i is indexed to the next element in matrix A and the entire process is repeated once again, until all of matrix A has been checked.\n\nThe result then is that through m, matrix A is sorted least to greatest and is written into matrix B, which is answer (d).
319998
http://www.math.iitb.ac.in/resources/manuals/algorithms.html click d link to know. It may be helpful to u.
250990
The problem with calculating running time of an algorithm is that there are so many variables which affect running time (far beyond just cpu speed and RAM size).  It is impossible to come up with a accurate calculation from these variables.\n\nBig O is useful because it calculates relative effeciency, regardless of hardware outside conditions, and size of test data.\n\nIn order to come up with actual numbers, the ONLY accurate way is to actually run the algorithm and time it.
184225
Lets examin the first output case you have, f.fact(3):\nThe first layer of this function call will have result = fact(3-1)*n.  This will of course call another layer of the fact function with result = fact(2-1)*n, and this will then call fact on 1. \n\nSince the base case for the recusion is 1, 1 will be returned.  And the function call will return values in reverse order.  So result = fact(2-1)*n will no be result = 1*2.  Which will then be returned to the function that called it, result =fact(3-1)*n is now result = 2*3. and that value is finally returned.\n\nThe key to understanding recursion is knowing what the basecase is.  If you can find the base case then evaluating the recursion is simply.  Just follow the function all the way through until you hit that base case, then work your back out example... 1 -> 2 -> 3 -> 4  then to get out we'd go 3 -> 2 -> 1.\n\nHopefully this helps.
993077
not that I know...you might have to wright your own algorithm!\n\nouch...have fun!\n\nbut check links!!
157926
Choose the most repeated operation and determine of what its repeat is dependent on (amount of input data).\n\nFor example: for (int i=0; i<N; i++) { /* do something */ )\nHas complexety N because /* do something */ is repeated N times. Here N is supplied to the algorightm.\n\nFor example: Two nested loops on of N and another of M operations have complexity of N*M.\n\nYou can ignore constant additions and substractions if they dont depend on the amount of the input data (as the are constant).\n\nFor example if you initialize an array of 100 elements in the begining of the algorithem, you can ignore it instead of include it as 100+N for example :)
838865
What language is this?  It looks like the result of a night of unbridled passion between C, C++, and Java!\n\nSo, you know that "x->y" is equivalent to "(*x).y", right? So, even though you never used . directly, it's apparently what the compiler is seeing. Of course, . can only be used with a struct, and it is complaining that you are using it with something that is not a struct. However, the error is confusing, since the problem is really caused by a problem with pointers.\n\n Consider b[10]  (and b[9]).  b is a pointer to blocks. The [ ] operator dereferences this pointer, so that b[10] has type block, not block *.  Since -> can only be used with pointers (block *), the compiler generates an error. \n\nThink carefully about what you want to do, draw a picture on paper, and make sure your types all make sense.  Good luck.