473,545 Members | 2,693 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SOME DIFFERENT KIND OF SELECTION SORTING OF ARRAY.

PLEASE PROVIDE ME D SOLUTION CODE FOR DIS PROBLEM.

SELECTION SORT IS BASED ON D FOLLOWING IDEA:
SELECTING D LARGEST ARRAY ELEMENT AND SWAPPING IT WITH THE LAST ARRAY
ELEMENT LEAVES AN UNSORTED LIST WHOSE SIZE IS I LESS THAN THE SIZE OF
ORIGINAL LIST. IF V REPEAT THIS STEP AGAIN ON D UNSORTED LIST V WILL
HAVE AN ORDERED LIST OF SIZE 2 AND UNORDERED LIST SIZE OF N-2(N IS D
TOTAL NUMBER OF ARRAY ELEMENTS).WHEN WE REPEAT THIS UNTIL THE SIZE OF
THE UNSORTED LIST BECOMES ONE, THE RESULT WILL BE A SORTED LIST.

WRITE A PROGRAM IN C LANGUAGE TO IMPLEMENT THIS ALGORITHM.
PLZ , GIVE A SIMPLE LOGICAL CODE.

Jul 4 '06 #1
13 2679
ANSHUL wrote:
PLEASE PROVIDE ME D SOLUTION CODE FOR DIS PROBLEM.

SELECTION SORT IS BASED ON D FOLLOWING IDEA:
SELECTING D LARGEST ARRAY ELEMENT AND SWAPPING IT WITH THE LAST ARRAY
ELEMENT LEAVES AN UNSORTED LIST WHOSE SIZE IS I LESS THAN THE SIZE OF
ORIGINAL LIST. IF V REPEAT THIS STEP AGAIN ON D UNSORTED LIST V WILL
HAVE AN ORDERED LIST OF SIZE 2 AND UNORDERED LIST SIZE OF N-2(N IS D
TOTAL NUMBER OF ARRAY ELEMENTS).WHEN WE REPEAT THIS UNTIL THE SIZE OF
THE UNSORTED LIST BECOMES ONE, THE RESULT WILL BE A SORTED LIST.

WRITE A PROGRAM IN C LANGUAGE TO IMPLEMENT THIS ALGORITHM.
PLZ , GIVE A SIMPLE LOGICAL CODE.

1. don't shout, it hurts my ears.
2. rephrased, you want us to perform your homework.
Jul 4 '06 #2
ANSHUL wrote:
PLEASE PROVIDE ME D SOLUTION
[snipped rest of the brawling]

By convention all uppercase text signifies shouting, so in future,
refrain from it if you want helpful responses.

Also provide the email of your course instructor, so that we may save
you the hassle and mail the answer to him/her directly.

Seriously though, this group won't do your homework for you. Try
atleast a partial attempt at solving your problem and post your code
here and we'll be more than happy to help you, but with this attitude,
you likely wont get any helpful responses.

Jul 4 '06 #3
"ANSHUL" writes:
SELECTION SORT IS BASED ON D FOLLOWING IDEA:
SELECTING D LARGEST ARRAY ELEMENT AND SWAPPING IT WITH THE LAST ARRAY
ELEMENT LEAVES AN UNSORTED LIST WHOSE SIZE IS I LESS THAN THE SIZE OF
ORIGINAL LIST. IF V REPEAT THIS STEP AGAIN ON D UNSORTED LIST V WILL
HAVE AN ORDERED LIST OF SIZE 2 AND UNORDERED LIST SIZE OF N-2(N IS D
TOTAL NUMBER OF ARRAY ELEMENTS).WHEN WE REPEAT THIS UNTIL THE SIZE OF
THE UNSORTED LIST BECOMES ONE, THE RESULT WILL BE A SORTED LIST.
Why would you want someone else to write the code for you? What would be
gained? The question seems about as clear as a question can be, ignoring
what I suspect is the distortion you introduced yourself. There are just a
few main steps: create an array, fill the array (with a set of test data),
sort the array, and print the array (to show the sort actually worked). If
you create an array in main you could have three functions as suggested
above. You may want to have the sort function call additional functions -
its your choice. It would be a good idea to (also) print the array as soon
as you have it filled with data to see if the fill worked.

If you have been taught recursion, it might be helpful in writing the sort -
if not do it whatever way seems natural to you.

If you can't do the whole thing, start and post code showing how far you
got.
Jul 4 '06 #4
On 4 Jul 2006 09:32:59 -0700, in comp.lang.c , "ANSHUL"
<An***@yahoo.co .inwrote:
>WRITE A PROGRAM IN C LANGUAGE TO IMPLEMENT THIS ALGORITHM.
PLZ , GIVE A SIMPLE LOGICAL CODE.
Fortran programmer?

--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
Jul 4 '06 #5
Mark McIntyre wrote:
On 4 Jul 2006 09:32:59 -0700, in comp.lang.c , "ANSHUL"
<An***@yahoo.co .inwrote:
>WRITE A PROGRAM IN C LANGUAGE TO IMPLEMENT THIS ALGORITHM.
PLZ , GIVE A SIMPLE LOGICAL CODE.

Fortran programmer?
LOL!!!!

--
Johannes
You can have it:
Quick, Accurate, Inexpensive.
Pick two.
Jul 4 '06 #6
On 4 Jul 2006 09:32:59 -0700, in comp.lang.c , "ANSHUL"
<An***@yahoo.co .inwrote:
>PLEASE PROVIDE ME D SOLUTION CODE FOR DIS PROBLEM.

SELECTION SORT IS BASED ON D FOLLOWING IDEA:
SELECTING D LARGEST ARRAY ELEMENT AND SWAPPING IT WITH THE LAST ARRAY
ELEMENT LEAVES AN UNSORTED LIST WHOSE SIZE IS I LESS THAN THE SIZE OF
ORIGINAL LIST. IF V REPEAT THIS STEP AGAIN ON D UNSORTED LIST V WILL
HAVE AN ORDERED LIST OF SIZE 2 AND UNORDERED LIST SIZE OF N-2(N IS D
TOTAL NUMBER OF ARRAY ELEMENTS).WHEN WE REPEAT THIS UNTIL THE SIZE OF
THE UNSORTED LIST BECOMES ONE, THE RESULT WILL BE A SORTED LIST.

WRITE A PROGRAM IN C LANGUAGE TO IMPLEMENT THIS ALGORITHM.
PLZ , GIVE A SIMPLE LOGICAL CODE.
Anshul.
Firstly please write in sentence-case if possible, when posting to
usenet. Most people find ALL UPPER CASE hard to read, and by
convention it is considered to be shouting (ie you are being rude).

Secondly please don't use abbreviations such as D for the, PLS for
please, DIS for this or V for we. The programming community here
values correctness, and poorly spelt messages often come from badly
organized minds.

Lastly, do not expect people to write your code for you. You should
make an effort to write it yourself, then when you are stuck with a
problem, ask for specific help.

--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
Jul 4 '06 #7
Mark McIntyre wrote:
On 4 Jul 2006 09:32:59 -0700, in comp.lang.c , "ANSHUL"
<An***@yahoo.co .inwrote:

>>WRITE A PROGRAM IN C LANGUAGE TO IMPLEMENT THIS ALGORITHM.
PLZ , GIVE A SIMPLE LOGICAL CODE.


Fortran programmer?
Ah, that explains it, I thought he/she was a Teletype user...

--
Ian Collins.
Jul 4 '06 #8
ANSHUL schrieb:
PLEASE PROVIDE ME D SOLUTION CODE FOR DIS PROBLEM.

SELECTION SORT IS BASED ON D FOLLOWING IDEA:
SELECTING D LARGEST ARRAY ELEMENT AND SWAPPING IT WITH THE LAST ARRAY
ELEMENT LEAVES AN UNSORTED LIST WHOSE SIZE IS I LESS THAN THE SIZE OF
ORIGINAL LIST. IF V REPEAT THIS STEP AGAIN ON D UNSORTED LIST V WILL
HAVE AN ORDERED LIST OF SIZE 2 AND UNORDERED LIST SIZE OF N-2(N IS D
TOTAL NUMBER OF ARRAY ELEMENTS).WHEN WE REPEAT THIS UNTIL THE SIZE OF
THE UNSORTED LIST BECOMES ONE, THE RESULT WILL BE A SORTED LIST.

WRITE A PROGRAM IN C LANGUAGE TO IMPLEMENT THIS ALGORITHM.
PLZ , GIVE A SIMPLE LOGICAL CODE.
Here is it:

#include <stdio.h>
#include <ctype.h>

int main()
{
int c;
while ((c = getchar()) != EOF)
putchar(tolower (c));
}

--
Thomas
Jul 4 '06 #9
On 4 Jul 2006 09:32:59 -0700, "ANSHUL" <An***@yahoo.co .inwrote in
comp.lang.c:
PLEASE PROVIDE ME D SOLUTION CODE FOR DIS PROBLEM.

SELECTION SORT IS BASED ON D FOLLOWING IDEA:
SELECTING D LARGEST ARRAY ELEMENT AND SWAPPING IT WITH THE LAST ARRAY
ELEMENT LEAVES AN UNSORTED LIST WHOSE SIZE IS I LESS THAN THE SIZE OF
ORIGINAL LIST. IF V REPEAT THIS STEP AGAIN ON D UNSORTED LIST V WILL
HAVE AN ORDERED LIST OF SIZE 2 AND UNORDERED LIST SIZE OF N-2(N IS D
TOTAL NUMBER OF ARRAY ELEMENTS).WHEN WE REPEAT THIS UNTIL THE SIZE OF
THE UNSORTED LIST BECOMES ONE, THE RESULT WILL BE A SORTED LIST.

WRITE A PROGRAM IN C LANGUAGE TO IMPLEMENT THIS ALGORITHM.
PLZ , GIVE A SIMPLE LOGICAL CODE.
PLZ, PICK UP D LARGE HAMMER AND HIT URSELF IN D HEAD. V ARE WAITING.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.l earn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Jul 5 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1387
by: Boba | last post by:
Hi, 1. What is the different between String and Array of char ? 2. Should I use array of char if my string is longer than 200,000 chars and I need use IndexOf frequently ? 3. I'm sure that there isn't diferent between writing in C# or C++ since both of them using the same CLR / Framework, am I wrong ? With thanks, Boba.
3
1396
by: project | last post by:
Hi every body, Any body can help me the following doubts? 1. what is constructor? 2. what is destructor? 3. what is overriding function. 4. different between structure and array 5. what is objected oriented
6
1594
by: frizzle | last post by:
Hi there. I have this array: name => john, age => 45, profession => teacher name => hank, age => 22, profession => student name => mary, age => 36, profession => dancer etc. etc. It's going to be a big array.
25
11353
by: Allie | last post by:
How would I go about sorting this structure by title? typedef struct { char author; char title; char code; int hold; int loan; } LIBRARY;
8
1773
by: lovecreatesbeauty | last post by:
Hello experts, I have seen following the code snippet given by Marc Boyer (with slight changes by me for a better format), and have doubts on it. I am so grateful if you can give me your kindly help and hints on this problem. 1. Does the function call `foo(3, 3, tab);' refer to the data outside the array `int tab;'. The available...
4
1639
by: VooDoo | last post by:
Hi, I am getting confused with sorting arrays... $arraytest =array(5) { =string(2) "39" =string(2) "44" => string(2) "77" =string(3) "150" =string(3) "464" } why do i get NULL value if i try to sort this array using sort command? sort($arraytest);
5
2127
by: Tartifola | last post by:
Hi, I'm working with numerical array and I'm a little lost on a particular sorting of one of them. In particular I have an array like a = array(,]) and I need to sort it using only the first column as reference but keeping the lines together so to obtain array(,
7
2641
by: anklos | last post by:
Hi~! I met a problem on printing out a kind of hash array. i.e @array=(1,2,3,4,5,6); $array{$term}=1; diffent $i may contain diifernt $term(more than one term for each $i)
0
7682
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7935
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7449
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6009
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5069
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3479
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3465
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1911
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
734
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.