CBSE CS and IP

CBSE Class 11 & 12 Computer Science and Informatics Practices Python Materials, Video Lecture

Idea of Efficiency (2 Marks Questions)


  1. Following are the complexities of different algorithms, order the following from best to worst: 
    1. 2n
    2. n!
    3. n5
    4. 10,000
    5. nlog2(n)

  2. What do you mean by idea of efficiency? What factors affect the algorithms efficiency?

  3. Define the Big ‘O’ notation. State the two factors which determine the complexity of an algorithm?
  4. Find the efficiency of MIXITNOW Function.
    def MIXITNOW(S):
        Size=len(S)
        for I in range(0,Size-1,2):
            WS=S[I]
            S[I]=S[I+1]
            S[I+1]=WS
        for I in range(1,Size,2):
            if(S[I]>='M' and S[I]<='U'):
                S[I]='@'
    
    Word=list('CRACKAJACK');
    MIXITNOW(Word);
    print(Word)
    

No comments:

Post a Comment