Skip to content

Commit c46538b

Browse files
ClémentClément
authored andcommitted
Working on AList project.
1 parent f891863 commit c46538b

File tree

2 files changed

+80
-0
lines changed

2 files changed

+80
-0
lines changed

source/order

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,4 @@
105105
./projects/species.md
106106
./projects/file_displayer.md
107107
./projects/texfilehelper.md
108+
./projects/alist.md

source/projects/alist.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# AList
2+
3+
## Description
4+
5+
### Purpose
6+
7+
This project is designed to teach you how to implement lists using a more familiar datastructure, arrays.
8+
It requires to understand abstract data types, array manipulations and interfaces (as a bonus).
9+
10+
### Challenge
11+
12+
#### In short
13+
14+
Our goal is to provide an implementation of the list abstract data type using arrays.
15+
Our implementation should be "from an external point of view" exactly like lists, with features similar to the C# implementation of lists.
16+
17+
#### In more details
18+
19+
We want to implement (a simplified version of) the [list abstract data type](https://princomp.github.io/lectures/data/lists#abstract-data-type). A list should be
20+
21+
- a finite collection of elements,
22+
- in a particular order,
23+
- capable of containing the same element multiple times.
24+
25+
and we should have operations to…
26+
27+
- … create an empty list,
28+
- … test for emptiness,
29+
- … obtain the number of elements in the list,
30+
- … add an element at "the beginning" of the list ("to the left"),
31+
- … remove the first element with a particular value if it exists,
32+
- … empty the list.
33+
34+
**The main challenge of this project is to implement those features using only an array as an attribute.**
35+
Your class should begin as follows:
36+
37+
```
38+
using System;
39+
40+
public class AList<T>
41+
{
42+
43+
private T[] alist;
44+
45+
}
46+
```
47+
48+
with the array `alist` being used to store the elements of the list. **Pay attention to details**:
49+
50+
- make sure that the class always returns the right value for the number of elements in the list,
51+
- make sure your methods correctly insert and remove values without losing any information,
52+
- write good test cases in your `main` method,
53+
- **do not load any additional libraries**, in particular, **do not use C# native lists or LINQ**.
54+
55+
56+
### Bonuses
57+
58+
Bonus points will be given if:
59+
60+
- (easy) You provide at least one additional methods among the following:
61+
- A relevant `ToString`,
62+
- A method to insert a value "at the end" ("to the right") of the list,
63+
- A method to insert a value at a given index.
64+
- (medium) Your `main` method is particularly well thought, and showcase many test cases. **A proper `main` method will help you in debugging your code.**
65+
- (hard) Make your class realizes the `ICollection<T>` interface:
66+
67+
- You are then allowed to load the additional two libraries:
68+
69+
```
70+
using System.Collections;
71+
using System.Collections.Generic;
72+
```
73+
- You will need to add a second attribute to your class,
74+
- Add all the required methods, in particular write a meaningful `CopyTo` method.
75+
76+
### Submission
77+
78+
Please, follow our [guideline on project submission](./projects/submission).
79+
In particular, make sure you write your name and the date in a delimited comment at the beginning of your file.

0 commit comments

Comments
 (0)