” 辅导CSC1001程序、Programming程序 写作CSC1001: Introduction to Computer ScienceProgramming MethodologyAssignment #3 (Summer Term)Date of handout: 13 July, 2020 (Monday)Date of submission: 26 July, 2020 (Sunday)Weight: 15% of the overall assessmentAssignment description:This assignment will be worth 15% of the final grade.You should write your code for each question in a .py file (please name it using thequestion name, e.g. q1.py). Please pack all your .py files into a single .zip file, name itusing your student ID (e.g. if your student ID is 123456, then the file should be namedas 123456.zip), and then submit the .zip file via Moodle.Please Also write a text file, Which provide the details about how to run your code foreach question. The text file should be included in the .zip file as well.Please note that, the teaching assistant may ask you to explain the meaning of yourprogram, to ensure that the codes are indeed written by yourself. Please also notethat we may check whether your program is too similar to your fellow students codeusing Blackboard.This assignment is due at 5:00PM, 26 July (Sunday). For each day of late submission,you will lose 10% of your mark in this assignment. If you submit more than threedays later than the deadline, you will receive zero in this assignment.Question 1 (20% of this assignment):Write a Python function to implement a recursive algorithm which counts the numberof nodes in a singly linked list. The input of the function should be a reference pointingto the first node of the linked list. The output of the function should be the number ofnodes in that linked list. Your function should be robust enough to handle possibleinappropriate inputs. 辅导CSC1001作业、Programming作业 写作Question 2 (30% of this assignment):Write a Python function to implement the quick sort algorithm over a singly linked list.The input of your function should be a reference pointing to the first node of a linkedlist, and the output of Your function should also be a reference to the first node of alinked list, in which the data have been sorted into the ascending order. You may usethe LinkedQueue class we introduced in the lecture directly in your program.Question 3 (50% of this assignment):The Tower of Hanoi is a mathematical game or puzzle. It consists of three rods, and anumber of disks Of different sizes which can slide onto any rod. The puzzle starts withthe disks in a neat stack in ascending order of size on one rod, the smallest at the top,thus making a conical shape. The following figure shows the initial state of the Towerof Hanoi with 5 disks.The objective of the puzzle is to move the entire stack to another rod, obeying thefollowing simple rules:1. Only one disk Can be moved at a time.2. Each move consists of taking the upper disk from one of the stacks and placing iton top of another stack i.e. a disk can only be moved if it is the uppermost disk ona stack.3. No disk may be placed on top of a smaller disk.Assume That initially all the disks are placed on rod A. Write a non-recursive Pythonfunction to print out the steps to move all the disks from rod A to rod C via rod B(Hint: a recursive algorithm Can be converted into a non-recursive algorithm usingstack). The header of the function is:def HanoiTower(n)Here n represents the number of disks. For example, when n = 3 your function shouldoutput:如有需要,请加QQ:99515681 或邮箱:99515681@qq.com
“
添加老师微信回复‘’官网 辅导‘’获取专业老师帮助,或点击联系老师1对1在线指导。