algorithm study--sorting(1)

类别:VC语言 点击:0 评论:0 推荐:

    

          Doing a thing better is often a waste of time.

                                                          -------Robert Byrne

 After studying C++ for part of the third semester in my college time..i am working on some basic algorithm these days. Except the hard  and dull and serious basic algorithm analysis,the first but very important question that i encounter is sorting problem...

    WELL,I THINK IT IS NOT SO NECESSARY TO INTRODUCE ,WHAT IS SORTING,

CUZ IT IS JUST A LITTLE BIT SILLY WHEN YOU WRITE IN ENGLISH...

       Everybody knows that there are many methods ,from simple (even children about 3 years can understand it) to very complex(Knuth cannt solve it ,like the effiency of quick sort algorithm...),  for sorting...

     To be easilest,we assume the objects that you are dealing are just integers ,so forget the concepts about crucial key or something like that..i will shout GOD DAMN,when you say"well ,i really dont know wether 1 is bigger or smaller than 5..."..So i will say something about this silly kind of sorting,maybe i just can say such stuff..forgive me..men..

     The most elemetary sorting algorithm is what always called SELECTION SORT..and it is used the brute force strategy that is you deal with problem dierctly ,not to make it abstract. Maybe you know it already,say,find the minium and find the less minium ,and the ,say,the less less minium, and continue this process ,at last to put the element to a new array...we will get the sorted array now... In fact,i tell you,you got it, you really got it,it is just like that... but not so damned directly,cuz computers , not like suppermarket , dont allow you to get and put as you wish... 

      To make it more clear,

  

  

本文地址:http://com.8s8s.com/it/it842.htm