- Following are the complexities of different algorithms, order the following from best to worst:
- 2n
- n!
- n5
- 10,000
- nlog2(n)
- What do you mean by idea of efficiency? What factors affect the algorithms efficiency?
- Define the Big ‘O’ notation. State the two factors which determine the complexity of an algorithm?
- 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