How do i develop an algo for arranging elements in ascending /descending order in C language program???
395965
The bubble sort is the simplest, easiest sort algorithm. It basically goes like this:\n\nfor(x = 0; x < ARRAY_SIZE; x++)\n{\n   for(y = 0; y < ARRAY_SIZE-1; y++)\n   {\n      if(iarray[y] > iarray[y+1])\n      {\n         swap = iarray[y+1];\n         iarray[y+1] = iarray[y];\n         iarray[y] = swap;\n      }\n   }\n}\n\nPieces of cake!
860428
u gotta use somesort of code
293992
Use TOBA (see link below)\n\nToba translates Java class files into C source code. This allows the construction of directly executable programs that avoid the overhead of interpretation.
515624
You can start off by declaring a new integer variable "low", initialize it to 0, and then after any input compare the new value to the value in low and if the new value is lower then set low equal to the new value.\nThe following sites should also be of use.
253284
#include <stdio.h>\n\nint main(void) {\n\nint i, j, count; //C Sucks, wait till you take java\n\nfor(i=1; i<=1000; i++){&#92;&#92;goes through all numbers 1 to 1000\n    count=0;\n    for(j=2; j<i; j++)&#92;&#92;goes through all numbers 2 to i\n    {\n     if(i%j==0)&#92;&#92;checks to see if it i is evenly div. by i\n        count++;\n    }//nested for\n    if (count ==0)\n        printf("%d&#92;n", i);\n}//for\n\nreturn 0;\n}//main\n\n\n//Hope that helps!
423398
here...I'll tell you what to write and you write it...\n\n/* outline the program */\n\n// void main()...etc..\n\n/* define your variables */\n/* you'll need a pair of char pointers */\n/* and some numbers to hold converted values */\n\n\n/* input the first binary as a string */\n\n/* input the second binary as a string */\n\n/* convert them to decimal */\n\n/* add them */\n\n/* fprintf them */\n\n/* end program */\n\n\nthat's all.\nI write all my programs in commented logic first then fill in the blanks so that it does what I meant.  When I'm done, the program follows the flow and is already commented for the next person to follow.
81883
Details of the algorithm for conversion along with\nsource program written in C can be found at.\nhttp://www.codepedia.com/1/Art_Expressions_p1\n\nA good short article on this topic.\nhttp://www.cs.man.ac.uk/~pjj/cs2121/fix.html
956311
I'll tell U something that could help in the reverse task\n\nU can use one of two things\n\n1-\nby includeing <string> & < algorithm>\n\nvoid revers(char* a,int length)\n{\n     string s = a;\n     reverse(s.begin() , s.end());\n     a = s;\n}\n\n2- \nby using a loop\n\nvoid reverse(char *a,int length)\n{\n     int i=0;\n     for(i=0;i< = (length/2) ;i++)\n          a[length-i-1] = a[i];\n}
538436
Copy the code here: http://www.ozgrid.com/VBA/Sort.htm and follow the instructions in the middle of the page that begin: "To use this UDF push Alt+F11..."
894119
Well... the easiest and most general approach is to  traverse the tree in preorder depth-first manner, writing the nodes to the file, and inserting a special separator (a centinel) at the end of each branch - just before the traversal process is about to move up:\n\nvoid write_node (struct node *root, FILE *out)\n{\n    root ? fprintf (out, "%s&#92;n", node_to_string (root, buffer)) :\n    fprintf (out, "%c&#92;n", SENTINEL);\n}\n       \nvoid read_tree (struct node *root, FILE *out)\n{\n   write_node (root);\n    if (!root) return;     \n    save_tree (root->left, out);\n    save_tree (root->right, out);\n}\n\nthen you can read this structure back in  in the same order:\nstruct node* read_node (FILE *in)\n{\n    char buffer[1024];\n    if (!fgets(in, buffer, 1024) || buffer[0] == SENTINEL) return 0;\n   return parse_node (buffer);\n}\n    \nstruct node *read_tree (FILE *out)\n{\n    struct node *root = read_node (out);\n    if (!root) return 0;\n    root->left = read_tree (out);\n    root->right= read_tree(out);\n}
447556
Look up "quicksort".\n\nIt fits very naturally into a recursive implementation\nand is also a very efficient sorting algorithm.\n\nI've included a link to the Solaris source for quicksort.\nIt is written in C (rather than C++).  It is somewhat\ncomplicated because it optimizes the sorting of\nshort sequences by switching to an insertion sort.\nHowever, you could implement a simpler version which\nran quicksort all the way to completion.
784795
numbering pages beginning from 1 in ascending order
981994
pseudo code sort of, based on C++... easiest for me... I am going to do this with an array of integers because the number of integers read into the program can be different than just three.  This can be easily changed though...\n\nstart program:\n\nint arrayInt[3];  //  places to store three integers\nint largestNumber = 0;  // place to store largest number\ncout << "enter three numbers:  ";   // request for three numbers\nfor (int i = 0; i < 3; i++)\n{     cin >> arrayInt[i]; }    \n// takes the three values from the user's input and stores them in an element in the arrayInt array.\n// so... now you need to compare all of the elements in arrayInt\nfor (int i = 0; i < 3; i++)  // do this three times\n{\n     if ( arrayInt[i] > largestNumber )  \n// comare largestNumber to the current element in the array\n// if it is larger, give largestNumber the value of that element\n     {\n         largestNumber = arrayInt[i] );\n     }\n}\n\n// display the largest number\ncout << "the largest number is:  " << largestNumber << endl;\n\n ******************************************************************\n\n1. initialize variables for the three input integers and a variable to store the largest integer (set this one equal to zero).\n2. ask the user for the three numbers\n3. read the user's input into the variables to store them\n4. compare the values stored in the three variables by either doing it individually (if an array is not used) or with a for loop.  Go through each of the three variables that store the user's input and compare the stored value to the largestNumber variable.  The largestNumber variable should be set equal to 0 since we know that all the numbers will be non negative, therefore 0 is the lowest any of the input numbers can be.  If the value of a variable that stores a user given integer is larger than the largestNumber variable, store the value of the input variable in the largestNumber variable ( largestNumber = inputValue2 ).  As you check all of the three input variables, the largest of all of the values checked will be stored in the largestNumber variable. \n5. tell the user the largest variable
907405
There is a quicksort algorithem built into one of the standard C functions that comes with C++.\n\nIt is called qsort.\n\nYou could also use one of the standard C++ templates. The standard templates have functions to do all sorts of operations.\n\n\nIf you want to program the sort yourself, just write a bubble sort.  See the Wikipedia link for instructions.\n\nIt is not the fastest sort for big datasets but it is more than adequate for even more than 4 numbers at a time.
529442
just google for "merge sort java" and you will find examples. You may have to make modification for your linked-list requirement but that shouldn't be too difficult.
875755
Try tracing a very small example on paper to gain some insight into this.  Perhaps just two or three elements with at least two equal keys.  Then reverse the order of the two equal keys in the input set, and see if you still get the same result.  Tracing the algorithm like this will get you the answer in a manner that should give you some confidence.
419823
You may have to be more specific.\n\nalgorithm.h is not a standard library, as such it will be impossible to know what kind of code is in it.\n\nThere are numerous sorting algorithms, some more efficient than others.  There's bubble-sort, insertion-sort, heap-sort, quick-sort, etc.  If you're interested in searching and sorting, try doing a google search.\n\nThere is a sort() tool for UNIX systems, but that uses data streams and pipes at the console level, not intended for use inside a program.\n\nIf you want, you can open up algorithm.h and take a look inside.  You won't be able to see what the function definitions are, but at least you can see what parameters it takes.  Also, if you're really lucky ;-) there will be comments in the file describing what kind of sort it uses.  Just do a little detective work, and you can get all the info you need.