问题
填空题
在最坏情况下,冒泡排序的时间复杂度为 【2】 。
答案
参考答案:n(n-1)/2或O(n(n-1)/2)
解析:[知识点] 算法的概念[评析] 冒泡排序法是一种最简单的交换类排序方法,它是通过相邻数据元素的交换逐步将线性表变成有序。假设线性表的长度为n,则在最坏的情况下,冒泡排序需要经过n/2遍的从前往后的扫描和n/2遍的从后往前的扫描,需要的比较次数为n(n-1)/2。
在最坏情况下,冒泡排序的时间复杂度为 【2】 。
参考答案:n(n-1)/2或O(n(n-1)/2)
解析:[知识点] 算法的概念[评析] 冒泡排序法是一种最简单的交换类排序方法,它是通过相邻数据元素的交换逐步将线性表变成有序。假设线性表的长度为n,则在最坏的情况下,冒泡排序需要经过n/2遍的从前往后的扫描和n/2遍的从后往前的扫描,需要的比较次数为n(n-1)/2。
完形填空 | ||||
When we visit another country, differences in music and dance are __1__ some of the first things that we notice.Every culture has __2__ its own types of music and dance, which are very different from those of other societies. Each type of music usually has a distinctive rhythm and a special sound, __3__ on the kinds of instruments that are used to produce it.The most common type of instruments are __4__ instruments, such as guitars and violins; wind instruments, including horns and flutes.Many different kinds of musical sounds __5__ be created by using different combinations of instruments. The human voice is a very special kind of instrument, __6__ it can produce a great number of different sounds with different __7__, ranging from loud to soft.Singing is very popular in most cultures because it allows us to __8__ words and ideas with music. Societies coordinate body movements with musical rhythms to create __9__.Sometimes people dance for fun and individual expression.Dances can also be used to __10__ ideas to an audience.Hawaiian dancers, __11__, use arm and hand movements to express the meaning of a song.In the same way, many societies use dances in religious ceremonies __12__ to tell about important events. Music and dance are passed from one __13__to another and thus become a permanent part of the society and __14__ culture.Of course, as cultures come __15__ contact with each other, the music and dance of one society may be accepted by other societies, or the different styles may be combined to __16__ a new kind of music or dance.Some Latin American music, for example, has taken __17__ from Indian cultures and mixed them with those from European and African cultures.__18__, popular music from England and the US can be heard in countries __19__ the world, __20__ it has had an influence on musical tastes, especially among young people. | ||||
|