Data structures:Doubly linked list?
399780
I assume that since you're asking about linked lists, you can probably read code to some extent. =)\n\nAnyways, here's a link to a project on CodeProject that does exactly what you're asking for; along with source code so that you can see how it's done.
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}
359046
#include <ctype.h>\n#include <stdio.h>\n#include <stdlib.h>\n\nstatic char *article[] = { "the","a", "one", "some", "any" };\nstatic char *noun   [] = { "boy","girl", "dog", "town", "car" };\nstatic char *verb   [] = { "drove","jumped", "ran", "walked", "skipped" };\nstatic char *prep   [] = { "to", "from", "over", "under", "on" };\n\nint\nmain()\n{\n  int asize = sizeof(article)/sizeof(article[0]);\n  int nsize = sizeof(noun)/sizeof(noun[0]);\n  int vsize = sizeof(verb)/sizeof(verb[0]);\n  int psize = sizeof(prep)/sizeof(prep[0]);\n\n  char buff[100];\n  for (int i=0; i<20; i++) {\n    (void)sprintf(buff, "%s %s %s %s %s %s.",\n      article[rand()%asize],\n      noun[rand()%nsize],\n      verb[rand()%vsize],\n      prep[rand()%psize],\n      article[rand()%asize],\n      noun[rand()%nsize]);\n    *buff = toupper(*buff);\n    (void)printf("%s&#92;n", buff);\n  }\n  return 0;\n}\n\n\n$ a.out\nSome town walked to a dog.\nThe car ran from any dog.\nAny boy drove under any town.\nOne girl jumped under the girl.\nOne car jumped to one girl.\nAny boy skipped over a dog.\nAny town jumped from some town.\nThe town ran from the town.\nOne car walked to any town.\nOne town ran over one boy.\nAny town jumped on the car.\nSome dog skipped from a boy.\nSome girl skipped over a boy.\nA car walked over some girl.\nThe car jumped from a girl.\nThe boy skipped on the town.\nAny car walked from one girl.\nAny dog ran to a town.\nA car jumped under some car.\nSome boy walked to the car.
846496
http://www.inversereality.org/tutorials/c++/linkedlists.html\nhttp://www.fortunecity.com/skyscraper/false/780/linklist.html\nhttp://richardbowles.tripod.com/cpp/linklist/linklist.htm\nhttp://www.functionx.com/cpp/articles/linkedlist.htm\n\nThey're all good sites. I also have a few Powerpoint slides about them, because I've had lots of programming courses.  Just ask me if you want them. :)
550757
I have heard this question so many times that I decided to look it up on the net and I found a very good site that explains it very well, step by step.\nSo I will simply link that one here. This is the C equivalent, you can modify it for c++!\n\nhttp://www.iwebthereforeiam.com/programming/selfWrite.asp\n\nEnjoy!
784164
sure you can use that syntax and it's correct this way:\nwrite(arraylist[x]);\nusualy this is used with a for clause\nfor i:=0 to n do\n write(arraylist[i]);\nbut if you put a pice of code when ur using this i can help you fix your errors.
314740
There are a few ways to do this, depending on the behavior you want. You can make a class that contains the array (constructor will take the size of the array). Then you implement/overload all the operators you are interested in. In these operators, you can overload [] to cause the index to wrap (if the size of the array was 10 and you did [10] you would get the 0'th element. Or you could have [10] return [9] element all the time. With templates:\n\ntemplate<class T, int n> class Array{\n\npublic:\nT& operator[](int i) {\nint j = i;\nif(i < 0){\n   j = 0;\n}\nif(i > n - 1){\n   j = n - 1;\n}\n\nreturn data[j];}\n\nprivate:\nT data[n];\n};\n\nor something like that.
916933
Your language is most likely c/c++, so the answer is then yes. You will then have 50 strings ranging from list[0] to list[49] in which to store your data. Of course, you will have to include the correct header file, i.e. #include <filename>, and if in c++, make sure to include "using namespace std;" (if appropriate in your program).\n\nWhy not just try it and see what the compiler tells you? One of the best ways to learn programming is to just try things and see what happens. If the result is not what you expected, try something else!
906761
Try this:\n\nvoid addIt(int* begin, int* end, int x)\n{\nint* p;\nfor (p=begin; p!=end; ++p) {\n*p = *p + x;\n}
178517
Sounds like a question that I had back in cegep. I guess it depends on how your teacher wants you to do it. You can create an array of type string, or create a linked list. You can even store it in a database or textfile. Depends entirely on what you're going to do with it, and what your teacher wants.\n\nEric
598181
From what I remember, a dequeue just lets you queue/dequeue from either end.  So, just write a node class with whatever things you need to store in the nodes, and pointers to the next object and previous object.  In the dequeue class, put in methods to change the pointers based on what's happening.  If just creating a dequeue, then pointers in node should both be null.  If you have a chain already, then dequeuing from front should make the one behind it point to null.  If dequeueing from rear, then the one in front of it should point to NULL in the rear.  That sort of thing.
139131
Something like this would work (syntax may not be exactly correct here...):\n\npublic class FibonacciNumbers {\n    public int getNthNumber(int n)  {\n        if (n <= 1) {\n            return 1;\n        }\n        int curFib = 1;\n        int lastFib = 0;\n        int temp;\n        for (int i = 2; i < n; i++) {\n            temp = curFib;\n            curFib = curFib + lastFib;\n            lastFib = temp;\n        }\n        return curFib;\n    }\n};\n\n\nYou can also write it recursively (i.e. call getNthNumber() inside the function), but this way is a bit faster due to overhead from function calls.
691515
algorithms, data structures, computer organization
751489
I don't see how you could access elements in an array past MAXINT. (Using array syntax.)\n\nSo the practical answer is MAXINT.
919233
Yes, when a list is already sorted, bubblesort will pass through the list once, and find that it does not need to swap any elements. \n\nIt will also use considerably less time if the elements in the list are not too far from their sorted places.
831305
Ever heard of trees? They are just one example of a dynamic memory structure, although don't be mistaken - they don't populate themselves, it's your job as the programmer to make them do that.\n\nRawlyn.
649070
Your problem is that you are creating a vector of objects, when you really want to create a vector of pointers to those objects:\n\nvector <ClassName *> vecSouth;\n\nThen the following should work:\n\nvecSouth.push_back(new CLassName("images/menu.bmp", 1));\n\nsince the new is returning a pointer to a ClassName.  The only way to make your original version work would be to dereference the new'ed value.\n\nvecSouth->push_back(*(new ClassName.....));\n\nNote that it's usually preferable to have your containers store pointers to things vs copies of things (to avoid having multiple copies of objects and to avoid any confusion/ambiguity about exactly what is being stored.  Though you could have a reason to want to store copies, again, just be sure you're straight in your mind as to exactly what you want to do.