问题 单项选择题

对序列(70,75,82,90,23,16)用快速排序方法进行排序,以序列的第一个元素为划分的基准。在第一趟划分后数据元素的排列是( )。

A.16,75,82,90,23,70

B.16,70,82,90,23,75

C.16,23,70,90,82,75

D.16,23,82,90,70,75

答案

参考答案:C

解析: 快速排序元素划分的方法是:在右端遇到比基准元素小的元素,则与基准元素交换位置,然后从左端开始比较;遇到比基准元素大的元素,与基准元素交换位置,再从右端继续比较,直到与所有元素比较一次,此时完成一次划分。本题中进行快速排序时元素的移动如图20-16所示。可知,当完成一趟排序后的序列是16,23,70,90,82, 75。即选项C是正确答案。

完形填空
完形填空
     Jane raced onto the train platform and asked a porter, "Is this the train to Rochester?" "Yes," said the
porter, "but only the Hey! Wait." He was too  1  . Jane had raced off   2   he had finished speaking.
    She had just   3  herself in a seat when the train   4  out of the station. Jane got out her book and
settled down to read. After about an hour or so, she looked  5  and glanced out of the window. "That's 
   16   ." she thought. "the landscape(景色)doesn't look  7  ,and it should; I've   8   this route so many
times." She was getting   9  when the big, red-faced conductor walked up and asked for her  10  .
   One glance was enough. He  11  his head in friendly reproach(责备) and said, "Now, young lady,
what did you do a fool thing like that for? This is the  12  ticket. You  13  have sat at the back of the
train. The Rochester-bound(开往) section was   14  at the last station.
   Jane's face grew red. "I'm sorry," she said, "I guess I was in too much of a   15  to find out…"Well,"
said the conductor, "don't   16  . You shouldn't have been in such a hurry, but I dare say we can   17 you
a train going in the right  18  at Syracuse. You'll be a couple of hours late  19  , though."
   When Jane finally stepped onto the Rochester platform, her mother   20  up to her . "Oh, Jane, we
have been so worried. What on earth happened?" "Well, Mom," said Jane, "it's a long story......."
( )1. A. busy      
( )2. A. when      
( )3. A. settled    
( )4. A. pushed    
( )5. A. around    
( )6. A. exciting  
( )7. A. familiar  
( )8. A. walked    
( )9. A. uneasy    
( )10. A. money    
( )11. A. put      
( )12. A. wrong    
( )13. A. would    
( )14. A. joined    
( )15. A. hurry    
( )16. A. sorry    
( )17. A. make      
( )18. A. time      
( )19. A. arriving  
( )20. A. called    
B. early          
B. then            
B. took            
B. pulled          
B. about          
B. interesting    
B. beautiful      
B. gone            
B. calm            
B. ticket          
B. shook          
B. used            
B. must            
B. turned          
B. trouble        
B. worry          
B. give            
B. place          
B. leaving        
B. picked          
C. late        
C. after        
C. made        
C. left        
C. up          
C. strange      
C. nice        
C. followed    
C. angry        
C. book        
C. raised      
C. only        
C. should      
C. connected    
C. worry        
C. hurry        
C. find        
C. station      
C. going        
C. rushed      
D. quick        
D. before      
D. gave        
D. started      
D. down        
D. right        
D. alike        
D. traveled    
D. unhappy      
D. name        
D. nodded      
D. right        
D. could        
D. separated    
D. difficulty  
D. regret      
D. get          
D. direction    
D. returning    
D. pushed      
问答题 简答题