1. Explore the process of one of the following Algorithms (each group must be assigned a different function by the cours
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
1. Explore the process of one of the following Algorithms (each group must be assigned a different function by the cours
Please answer question 1.1 and 1.2. for 1.1 show me the
steps.
1. Explore the process of one of the following Algorithms (each group must be assigned a different function by the course teacher): • Shell Sort algorithm is a sorting algorithm. 1.1 Calculate the total number of steps required by the algorithm and express it as a function of n (f(n)) (1 Mark) 1.2 Determine the Time complexity of the algorithm using Big-o notation. (1 Mark) Note: Appendix - Part 3 contains the Python code of the algorithms. Algorithm 4 - Shell Sort algorithm in Python: def ShellSort(L): len(L) // 2 # dividing the number of elements by 2 to find th le gap while g > 0: for i in range(g, len(L)): y = L Z = I while z >= g and [z - g] > y: L[z] - Yz - g] Z -= 8 L[2] = y g //= 2 mylist = [23, 12, 1, 17, 45, 2, 13] ShellSort( mist) #calling the function print(mvlist)