Please solve all these correctly as fast as possible.
Time Complexity 1. In your quiz you had a pseudo code like this which basically calculates the number of handshakes occurring among 'n' people if all of them shake hands with each other. The pseudo code was something like this one : (n << input) handshakes = 0 for (k = n; k >= 1; k = k-1){ for (i = k-1; i >= 1; i = -1){ handshakes = handshakes + 1 } print(f"Total number of handshakes are {handshakes}") a) Can you suggest another algorithm/pseudo code that performs this task more efficiently? Mention the running time of your algorithm. -5 b) Can you suggest another solution which is even better than the first algorithm? Mention the running time of this one too. -2 2. Sort the functions T(n) from slowest to fastest from the perspective of running time. n, n², n!, nlog(n), 7", eIn(n) 3. Show that 2nº + 5n² + 6n + 18 is in e(nº). - 3 -3
Please solve all these correctly as fast as possible.
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am