sort data in c language

Posted by ANIL MANE on Stack Overflow See other posts from Stack Overflow or by ANIL MANE
Published on 2010-04-30T12:11:29Z Indexed on 2010/04/30 12:17 UTC
Read the original article Hit count: 344

Filed under:
|
|

Hello C experts,

I need little help on following requirement, as I know very little about C syntaxes.

I have data in a file like this

73 54 57 [52]
75 73 65 [23]
65 54 57 [22]
22 59 71 [12]
22 28 54 [2]
65 22 54 73 [12]
65 28 54 73 [52]
22 28 65 73 [42]
65 54 57 73 [22]
22 28 54 73 [4]

Where values in bracket denotes the occurrence of that series. I need to sort this data based on the occurrence of the data descending with maximum elements on the top as follows

65 28 54 73 [52]
22 28 65 73 [42]
65 54 57 73 [22]
65 22 54 73 [12]
22 28 54 73 [4]
28 59 71 [122]
73 54 57 [52]
22 28 65 [26]
..
.
.
.

and so on...

Can someone give me a quick code for this.

Thanks in advance.

© Stack Overflow or respective owner

Related posts about c

    Related posts about sorting