| | |
Question about a simple sorting method without arrays
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Oct 2008
Posts: 9
Reputation:
Solved Threads: 0
The requirements are actually simple, just asking to sort a few, say 10, 20 or so, intergers in ascending order. However, array and pointers are not allowed to be used, and just the fundamental knowledge about flow control are permitted. The hints are as follows:
1. Initialize a variable F that keeps a very large number (larger than any number in the to-be -sorted batch)
2. Search among the batch for the biggest number, which is smaller F
3. Show that number on the screen
4. Save that number to F and take away the number from the batch
5. Repeat steps 2,3 and 4 until all the 5 numbers in the batch are shown on the screen
Many thanks to anyone who can help!!!
1. Initialize a variable F that keeps a very large number (larger than any number in the to-be -sorted batch)
2. Search among the batch for the biggest number, which is smaller F
3. Show that number on the screen
4. Save that number to F and take away the number from the batch
5. Repeat steps 2,3 and 4 until all the 5 numbers in the batch are shown on the screen
Many thanks to anyone who can help!!!
•
•
Join Date: Oct 2008
Posts: 9
Reputation:
Solved Threads: 0
Using selection sorting without using arrays, can you provide any ideas how to get the numbers into the loop, and take away the number from the batch?
•
•
Join Date: Oct 2008
Posts: 9
Reputation:
Solved Threads: 0
•
•
•
•
you can access them by memory addresses... so the integers should be given addresses that are consecutive. could count as pointing really.
allowed to be used, only the fundamental knowledge of the flow control are permited and
that's why the hints, the initialization of the large number F are for.
•
•
•
•
This website doesn't provide source code, and I understand that, however, is there anybody who manages this website can come up with some useful ideas. I'm only a
new learner of C++, and what I'm asking is
only some fundamental thing.
But i don't think so you can possibly create the batch of no without using array or pointer.
Other crazy solutions might be using link list or objects or blah blah blah.. for just a simple sorting.
Last edited by Rhohitman; Oct 10th, 2008 at 1:35 pm.
Chazing Dreams ;'P
Shhhh.......ZZzzzzzzzzzzzzzzzzzzzz.....
Shhhh.......ZZzzzzzzzzzzzzzzzzzzzz.....
![]() |
Other Threads in the C++ Forum
- Previous Thread: what does it mean by shadowing
- Next Thread: C++ template
| Thread Tools | Search this Thread |
api array arrays based binary c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count database delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game generator givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int java lib linkedlist linker list loop looping loops map math matrix memory multiple news number numbertoword output pointer problem program programming project python random read recursion recursive reference rpg sorting string strings temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






) in C++... 