CSC1001: Introduction to Computer Science
Programming Methodology
Assignment 4
Assignment description: This assignment will be worth 10% of the final
grade.
For each question, write your code in the corresponding .py file (i.e., for question
1, use q1.py). Once completed, pack all your modified .py files into a single
.zip file. Name the zip file with your student ID (i.e., if your student ID is
123456, name the file Ass4 123456.zip), and submit it via Blackboard. Please
note that we ONLY take the latest submission into account.
We have provided code templates for each question in Ass4 xxxxxx.zip.
You just need to fill in the TODO part of the template and are not
allowed to make any changes to the template or you may receive zero.
Please note that, the teaching assistant may ask you to explain the meaning
of your program, to ensure that the codes are indeed written by yourself.
Please also note that we may check whether your program is too similar
to your fellow students’ code using Blackboard.
Please do not use ChatGPT or other kinds of AI agents to generate
your code! We will use the GPT-generated content-checking tool to check
your code.
This assignment is due on 11:59PM, 24 December (Tuesday). For each
day of late submission, you will lose 10% of your mark in this assignment. If
you submit more than three days later than the deadline, you will receive zero
in this assignment.
1
Question 1 Write a Python class that merges two Sorted Linked lists. You
are given the heads of two sorted linked lists A and B, which are two integer
sequences sorted in ascending order. Implement a function to merge two lists
into one sorted list. The list should be made by splicing together the nodes of
the first two lists. Return the head of the merged linked list.
Note:
1. The new linked list should be made by splicing together the nodes of the
two linked lists.
2. We provide two helper functions: one for creating a linked list from an
array and another for printing the linked list.
3. We provide a basic single-linked list data structure. Please complete the
problem based on it.
4. Example 1:
Input: list1 = [1,2,4], list2 = [1,3,4]
Output: [1,1,2,3,4,4]
Example 2:
Input: list1 = [1], list2 = []
Output: [1]
Figure 1: Example 1
2
CSC1001, python, [SOLVED]
[SOLVED] CSC1001 Python
$25
File Name: CSC1001_Python.zip
File Size: 131.88 KB
Only logged in customers who have purchased this product may leave a review.
Reviews
There are no reviews yet.