Skip to content

Commit 238a2c6

Browse files
authored
Update README.md
1 parent 6854f02 commit 238a2c6

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

README.md

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
# cpp-linked-lists
2-
My implementation of linked-lists in c++
1+
# C++ Linked Lists
2+
My implementation of doubley-linked lists in C++
3+
## NOTE:
4+
This library is best used when you need a dynamicly sized list, and staticly sized arrays are not an option.
5+
So don't go too crazy with this code. It's always best to try and find a work-around solution before relying
6+
on linked-lists to bail you out.
7+
38
## How it works
49
Within the `List` class, first we define list-node type we call `node`.
510
```
@@ -15,3 +20,25 @@ Each node contains placholders for the data(integer), the next list-node, and th
1520
A list-head is then initialized with the `list()` method. The list head is the start of the list. This creates a list
1621
head with the `data` field set to 0, and `next` and `prev` fields set to NULL. This node is not used when accessing the list,
1722
it's just used to initialize the list.
23+
This allows you to chain many list-nodes together, making a doubley-linked list.
24+
25+
26+
## How to use this library
27+
28+
### Create a List object:
29+
`List myList; // Creates an empty List object.`
30+
31+
### Methods:
32+
```c++
33+
myList.append(54); // Appends 54 to list.
34+
35+
myList.remel(1); // Returns and removes the element at index 1(or provided index)
36+
37+
myList.print(); // Prints items in the list.
38+
39+
myList.index(7); // Returns the element at index 7(or provided index)
40+
41+
// Removes all the elements from the first provided index, and to the last index, including the elements at the provided indices
42+
// When removed multiple items at once, this is MUCH faster than using a for-loop and remel.
43+
myList.slice(9, 18);
44+
```

0 commit comments

Comments
 (0)