-
Which is better in terms of performance for iterating an array?
-
- for(int k=50; k>=0; k–)
- for(int k=0; k<50; k++)
- for(int k=50; k>0; k++)
- for(int k=50; k<0; k++)
- None of these
Correct Option: A
reverse traversal of array take half number cycles as compared to forward traversal. The other for loops will go in infinite loop.