Gate
Exam
Programming
Which algorithm will perform better ? O(n^2) or O(n^3)
1. O(n^2)
2. O(n^3)
3. Depends upon problem instance.
4. Can't say.
Read Solution (Total 5)
-
- o(n^2), as it wil take less time
- 10 years agoHelpfull: Yes(1) No(0)
- 1. O(n^2) it is taken less time compair then o(n^3)
- 10 years agoHelpfull: Yes(0) No(0)
- But what about option 3 ?
- 10 years agoHelpfull: Yes(0) No(0)
- 0(n^2)because n^2 is less than n^3
- 10 years agoHelpfull: Yes(0) No(0)
- O(n^2) will be better because Time complexity of n^2 is less than n^3
- 9 years agoHelpfull: Yes(0) No(0)
Gate Other Question
4, 16, 256...
5, 10, 12, 24, 26....
1, 2 ... 10, 17, 26
35, 24, 15, 8........
240........ 120, 40, 10, 2
1, 6 ... 120, 350, 720
Which method is used by binary search tree ?
1- Dynamic programming
2-Divide and concquer
3- greedy algorithms
4- Broute force