*Part 1. Nut Distribution Algorithm: *
● Task:Write two functions: an iterative and recursive function to distribute a set of nuts to students. The distribution algorithms should have the ability to distribute the nuts in random, sorted and reverse-sorted order. ● Input:A list of nuts, each with a weight, price, and type, and a list of students. ● Output:Each student should receive a distinct nut. ● Complexity Analysis: Provide a detailed analysis of the complexity of the distribution, sorting, and searching algorithms. Use T(n) for explaining the time complexity and O(n) for the Big O notation. You will need to provide plots indicating the time performance of your algorithms with different values of n. The n values are as following: 1, 100, 500 and 1000. What are the best, average, and worst-case scenarios?
*Part 2. Sorting the Nuts: *
● Task:After distribution, create two lists of nuts: one sorted by weight and the other by price. ● Input: A list of nuts already distributed (randomly) Part 1. ● Sorting Algorithm: You need to use two different types of sorting algorithms, *any two of your choice *(including sorting algorithms we did not cover in class). ● Scalability: Discuss the efficiency of the chosen algorithm if the number of nuts and students increases significantly. ● Complexity Analysis: Provide a detailed analysis of the sorting algorithms you used. Use T(n) for explaining the time complexity and O(n) for the Big O notation. You will need to provide plots indicating the time performance of your algorithms with different values of n. As with Part 1, the n values are as following: 1, 100, 500 and 1000. Make a comparison between the two algorithms you chose and identify which is the better algorithm. What are the best, average, and worst-case scenarios?
*3. Searching for a Specific Nut: *
● Task:Write a function to find the student holding a nut with a specified price or weight. Of course, this needs to be a specific distinct nut that was distributed in Part 1. ● Assumption:The list of nuts assigned to students is already sorted by weight or price (which the output of Part 2). ● Test Cases:Provide test cases to assess your solution. ● Complexity Analysis: Provide a detailed analysis of the complexity of the distribution, sorting, and searching algorithms. Use T(n) for explaining the time complexity and O(n) for the Big O notation. As with Parts 1 and 2, the n values are as following: 1, 100, 500 and 1000.
++*Documentation and Submission: *++
● Code Documentation: Comment on your code to explain the logic, especially in recursive functions and sorting logic. ● Report:Include a brief report explaining your choice of algorithms, their efficiency, and the complexity analysis. ● Submission Format:Submit the source code and the explanation in a PDF report. The text must be editable (don’t use images). ● Assumptions:** make assumptions about things not written in the assignment.
++*Submission Guide: *++
● For the first question, please include documented source code, including test cases, a description of your algorithms and decisions, and the complexity analysis ( T(n) and O(n) ) ● For the second question, please include documented source code, including test cases, an explanation for scalability (what happens when the size of the input is large), justification for your choice of sorting algorithm, and the complexity analysis ( T(n) and O(n) ). ● For the third question, please include documented source code, including test cases, a description of your algorithm and decisions, and the complexity analysis ( T(n) and O(n) ).
Note 1: Throughout the assignment T(n) is referring to the actual time plot of an algorithm and NOT the recursion relationship of the algorithm. See below an example T(n) plot: Note 2: Throughout the assignment, the term “test cases” refers to the different values of n stated already (i.e. 1, 10, 100, 250, 500 and 1000.) ++*Evaluation Criteria: *++
● Correctness and Efficiency of Algorithms:The algorithms should be correctly implemented and efficient regarding time and space complexity. ● Code Clarity and Documentation:** Code should be readable, well-organized, and properly documented. ● Analysis and Justification:** The report should justify the choices of algorithms and include a detailed complexity analysis.