how we can check efficiency of an Algorithm?
111654
I am going to answer this assuming a literal question.\n\nIn other words, I assume that you are interested in the efficiency of an *algorithm*, not the speed of a given algorithm running on a given processor having been compiled by a given compiler.\n\nIn this context, you need to learn how to compute algorithm complexity using o-notation:\n\nhttp://en.wikipedia.org/wiki/Big_o_notation\n\nThis is not a simple concept to describe in a 5 minute discussion. Perhaps you are best off looking into some algorithms textbooks or taking an undergraduate course in algorithms.\n\nBasically what this technique does is study roughly how long an algorithm will take when the size of data approaches infinity. This gives you an idea what to expect. For instance, if you double the number of numbers going into an algorithm, does the amount of time double? Does it less than than double? Does it more than double? All three answers are possible, depending on the chosen algorithm.\n\nA good place to start to investigate this is to look at sorting techniques. They have been extensively analyzed for complexity, and there are a number of good sources.\n\nHope this helps.
92706
There are three ways to interpret your question.\n\nIf you are looking into this timing for the purposes of code optimization, there are many profiling tools for this purpose.  If your JVM includes HotSpot (it probably does), you can use the built in profiler by using the command line argument, "-Xprof" (case sensitive, without quotes).\n\nIf you are trying to determine how long a specific function takes to run, you can use some sort of stopwatch tool.  See Sources for an example.\n\nIf you are trying to determine how long a specific instruction takes to run, you can still use a stopwatch tool, so long as you run the instruction many times in a loop and also run an empty loop (with the same number of iterations) to check the time used for things other than the instruction.  You can (and probably should) also try looking up benchmarking information on the internet.  I leave that as something for you or another answer to do.\n\nBe aware that all three of these issues are very much system dependent.  For best results, do tests on multiple systems and OSs, depending on where your future applications will be deployed.
861788
There is no accurate way to do this because too many variables are involved. You can do like I do though and run a series of tests and then average them.\n\nhttp://www.toast.net/
55929
Short estimate\nThe efficiency of X is the best 100%
1168294
It depends on your operating system, and what version. In Windows 2000 or XP...\n\n1) Right-click on the clock in the system tray.\n\n2) Select "Task Manager" from the pop-up menu.\n\n3) Click the "Performance" tab and you'll see a bar graph labelled "MEM Usage"\n\nYou can also click the "Processes" tab, to see what software is using the memory. There is a column labeled "Mem Usage" and you can click on that to sort programs by memory used.
973
u spelt it wrong :-(\nit should have been Dijikstra\n\nSTDMETHODIMP CDijkstra::ShortestPath(long node1, long node2)\n{\n    ReleaseGraph();\n    // init d and pi\n    InitializeSource(g, g.m_nodes[node1-1]);\n    // Set S empty\n    VTYPE_NODE S;\n    // Put nodes in Q\n    VTYPE_NODE Q;\n    VTYPE_NODE::iterator kl;\n    for(kl=g.m_nodes.begin(); kl<g.m_nodes.end(); kl++)\n    {\n        CNode node = (*kl).Copy();\n        Q.push_back(node);\n    }\n    // Algorithm\n    while(Q.size())\n    {\n        CNode nod = ExtractMin(Q); // the minim value \n                // for the shortest path up to this step\n        S.push_back(nod);\n        // each vertex v which is a neighbour of u\n        VTYPE_NODE::iterator kl;\n        for(kl=g.m_nodes.begin(); kl<g.m_nodes.end(); kl++)\n        {\n            if(ExistEdge(nod, (*kl)))\n            {\n                bool gasit = false;\n                VTYPE_NODE::iterator kll;\n                for(kll=Q.begin(); kll<Q.end(); kll++)\n                {\n                    if((*kll).m_NodeNr == (*kl).m_NodeNr)\n                    gasit = true;\n                }\n                if(gasit)\n                    Relax(nod, (*kl), GetEdgeVal(nod, (*kl)));\n            }\n        }\n    }\n    RefreshDone(node1, node2);\n    return S_OK;\n}
269526
use yur calculator...
1082211
was difficault method, choose Hermit is better
835510
You could try running an application like MemTest:\n\nhttp://www.memtest.org/
593098
check it.\nMay be it is useful
1121923
to see the production levels over a certain period of time
779526
How are you even sure that such a function exists? the numbers look very random.
668885
finding bugs ...based on Mc Cabe's cyclomtic complexity
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!
289917
Time complexity is a representation of the number of operations your algorithm (or program) does versus the size of input.  There are 5 types of this; Big-O, Big Omega, Big Theta, little-O, and amoratized.  These reference a graph representation of how your code does vs some function (the graph is actually a representation of limits but the math is mute here).\n\nBig-O means that in the worst case your algorithm will run in a time less then the function within the Big-O.  For example if you had a function that took exactly (n^2)+ C n operations (where n is the size of your input) we would say that it was O(n^2) because even though it has some constant C times n added on this number is insignificant to the size of n^2.  Therefore it can be dropped and we can say that it runs in a time of O(n^2).  Again this  calculates worst case efficiency.\n\nBig Omega means that your funtion is bounded below (on the graph) by the function of the Big Omega. This calculates best case efficiency.\n\nBig Theta means that your function is bounded on both sides by the function of the Big Theta (thus it is asymtotically tight... or in simple terms equal to). This calculates average time efficiency.\n\nlittle oh is rarely used in analysis of algorithms and is similar to big-O but the limits are different.  Im not going to explain this here.\n\nAmortized efficiency does not apply to a single run of an algorithm but rather to a sequence of operations performed on the same data structure.  For instance for a stack the pop operation is given a cost of 2 where the push operation is given a cost of 0.  The push can then borrow from the pops overpay.  This need a better explanation then this but if you want that then you can ask me specifically or look it up.\n\nHope this helps out.  Best of luck.
730115
read KNUTH! that's a classic question.\nhe is the king of algorithms! He wrote the book!\n\n\nbasically sort a pre-sorted list.
258345
The efficiency of an ideal engine is (1- T2/T1) or (T1- T2)/T1 = (600 - 400) / 600 =0.333.\nBut in the problem it is given that it is 0.5 which is not possible.