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.

相关推荐
Amo Xiang18 分钟前
2024 Python3.10 系统入门+进阶(十五):文件及目录操作
开发语言·python
liangbm328 分钟前
数学建模笔记——动态规划
笔记·python·算法·数学建模·动态规划·背包问题·优化问题
B站计算机毕业设计超人40 分钟前
计算机毕业设计Python+Flask微博情感分析 微博舆情预测 微博爬虫 微博大数据 舆情分析系统 大数据毕业设计 NLP文本分类 机器学习 深度学习 AI
爬虫·python·深度学习·算法·机器学习·自然语言处理·数据可视化
羊小猪~~44 分钟前
深度学习基础案例5--VGG16人脸识别(体验学习的痛苦与乐趣)
人工智能·python·深度学习·学习·算法·机器学习·cnn
waterHBO3 小时前
python 爬虫 selenium 笔记
爬虫·python·selenium
编程零零七4 小时前
Python数据分析工具(三):pymssql的用法
开发语言·前端·数据库·python·oracle·数据分析·pymssql
AIAdvocate6 小时前
Pandas_数据结构详解
数据结构·python·pandas
小言从不摸鱼6 小时前
【AI大模型】ChatGPT模型原理介绍(下)
人工智能·python·深度学习·机器学习·自然语言处理·chatgpt
FreakStudio8 小时前
全网最适合入门的面向对象编程教程:50 Python函数方法与接口-接口和抽象基类
python·嵌入式·面向对象·电子diy
redcocal9 小时前
地平线秋招
python·嵌入式硬件·算法·fpga开发·求职招聘