Algorithms and Data Structures COMP3506

Getting Started
Before we get into the nitty gritty, we will discuss the skeleton codebase that will form the basis of your implementations, and provide some rules that must be followed when implementing your solutions.
iuww520iuww520iuww520iuww520iuww520iuww520iuww520iuww520
1.1 Codebase
The codebase contains a number of data structures stubs that you should implement, as well as some scripts that allow your code to be tested. Figure 1 shows a snapshot of the project directory tree with the different files categorized.
test_structures.py
test_warmup.py
test_kmers.py
structures
dynamic_array.py
linked_list.py
bit_vector.py
warmup
warmup.py
malloclabs
kmer_structure.py
analysis.txt
generate_dna.py
Figure 1 The directory tree is organized by task. Blue represents directories, Teal represents files that contain implementations (but are not executable), and Orange represents executable files.
1.2 Implementation Rules
The following list outlines some important information regarding the skeleton code, and your implementation. If you have any doubts, please ask on Ed discussion.
❙ The code is written in Python and, in particular, should be executed with Python 3 or higher. The EAIT student server, moss , has Python 3.11.* installed by default. We recommend using moss for the development and testing of your assignment, but you can use your own system if you wish.
You are not allowed to use built-in methods or data structures -- this is an algorithms and data structures course, after all. If you want to use a dict (aka {} ), you will need to implement that yourself. Lists can be used as "dumb arrays" by manually allocating space like myArray = [None] * 10 but you may not use built-ins like append, clear, count, copy, extend, index, insert, pop, remove, reverse, sort, min, max, and so on. List slicing is also prohibited, as are functions like sorted, len, reversed, zip .
Be sensible -- if you need the functionality provided by these methods, you may implement them yourself. Similarly, don't use any other collections or structures such as set or tuple (for example; mytup = ("abc", 123) ).
❙ You are not allowed to use libraries such as numpy , pandas , scipy , collections , and so on.
❙ Exceptions: The only additional libraries you can use are random and math . You are allowed to use range and enumerate to handle looping. You can also use for item in my_list looping over simple lists.
2 Task 1: Data Structures (5 marks)
We'll start off by implementing some fundamental data structures. You should write your own tests. We will try to break your code via (hidden) corner cases. You have been warned.
Task 1.1: Doubly Linked List (1.5 Marks)
Your first task is to implement a doubly linked list --- your first "pointer-based" data structure.
To get started, look at the linked_list.py file. You will notice that this file contains two
classes: the Node type, which stores a data payload, as well as a reference to the next node;
and the DoublyLinkedList type which tracks the head and tail of the list, as well as the number
of nodes in the list.
A basic set of functions that you need to support are provided as function templates, and you will need to implement them. You will also notice that there may be some changes or modifications required to the data structures to support the necessary operations -- feel free to add member variables or functions, but please do not change the names of the provided functions as these will be used for marking.
You will need to implement your own tests and run them using: python3 test_structures.py --linkedlist.

相关推荐
DanCheng-studio3 小时前
网安毕业设计简单的方向答疑
python·毕业设计·毕设
轻抚酸~4 小时前
KNN(K近邻算法)-python实现
python·算法·近邻算法
独行soc5 小时前
2025年渗透测试面试题总结-264(题目+回答)
网络·python·安全·web安全·网络安全·渗透测试·安全狮
汤姆yu6 小时前
基于python的外卖配送及数据分析系统
开发语言·python·外卖分析
如何原谅奋力过但无声6 小时前
TensorFlow 1.x常用函数总结(持续更新)
人工智能·python·tensorflow
翔云 OCR API6 小时前
人脸识别API开发者对接代码示例
开发语言·人工智能·python·计算机视觉·ocr
AndrewHZ7 小时前
【图像处理基石】如何在图像中提取出基本形状,比如圆形,椭圆,方形等等?
图像处理·python·算法·计算机视觉·cv·形状提取
温轻舟8 小时前
Python自动办公工具05-Word表中相同内容的单元格自动合并
开发语言·python·word·自动化办公·温轻舟
习习.y9 小时前
python笔记梳理以及一些题目整理
开发语言·笔记·python
撸码猿9 小时前
《Python AI入门》第10章 拥抱AIGC——OpenAI API调用与Prompt工程实战
人工智能·python·aigc