Skip to content

Commit 9ed6c12

Browse files
authored
Merge pull request #33 from orxfun/minor-documentation-fixes
minor documentation fixes
2 parents 40bd9b8 + 8d6352c commit 9ed6c12

File tree

4 files changed

+11
-17
lines changed

4 files changed

+11
-17
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "orx-linked-list"
3-
version = "3.0.0"
3+
version = "3.0.1"
44
edition = "2021"
55
authors = ["orxfun <[email protected]>"]
66
description = "A linked list implementation with unique features and an extended list of constant time methods providing high performance traversals and mutations."

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Linked lists are all about traversal. And hence, the linked list, specifically t
7171
* [`iter_backward_from(idx: &DoublyIdx<T>)`](https://docs.rs/orx-linked-list/latest/orx_linked_list/trait.DoublyIterable.html#method.iter_backward_from) iterates forward starting from the node with the given index to the front
7272
* [`ring_iter(pivot_idx: &DoublyIdx<T>)`](https://docs.rs/orx-linked-list/latest/orx_linked_list/trait.DoublyIterable.html#method.ring_iter) iterates forward starting from the pivot node with the given index until the node before the pivot node, linking back to the front and giving the list the **circular behavior**
7373
* [`iter_links()`](https://docs.rs/orx-linked-list/latest/orx_linked_list/trait.DoublyIterable.html#method.iter_links) iterates over the links of the list
74-
* [`iter_x()`](https://docs.rs/orx-linked-list/latest/orx_linked_list/trait.DoublyIterable.html#method.iter_x) iterates over elements in an arbitrary order, which is often faster when the order is not required
74+
* [`iter_x()`](https://docs.rs/orx-linked-list/latest/orx_linked_list/type.DoublyList.html#method.iter_x) iterates over elements in an arbitrary order, which is often faster when the order is not required
7575

7676
As typical, above-mentioned methods have the "_mut" suffixed versions for iterating over mutable references.
7777

@@ -117,7 +117,7 @@ assert_eq!(res, [3, 4, 5, 0, 1, 2]);
117117

118118
Due to the feature of the [`Recursive`](https://docs.rs/orx-split-vec/3.8.0/orx_split_vec/struct.Recursive.html) growth strategy of the underlying SplitVec that allows merging vectors and the nature of linked lists, appending two lists is a constant time operation.
119119

120-
See [`append_front`](https://docs.rs/orx-linked-list/latest/orx_linked_list/type.DoublyList.html#method.append_front) and [`iter_back`](https://docs.rs/orx-linked-list/latest/orx_linked_list/type.DoublyList.html#method.append_back).
120+
See [`append_front`](https://docs.rs/orx-linked-list/latest/orx_linked_list/type.DoublyList.html#method.append_front) and [`append_back`](https://docs.rs/orx-linked-list/latest/orx_linked_list/type.DoublyList.html#method.append_back).
121121

122122
<details>
123123
<summary style="font-weight:bold;">Example</summary>
@@ -326,7 +326,7 @@ This crate aims to overcome the concerns with the following approach:
326326

327327
▶ There is also <ins>no choice</ins> between a `VecDeque` and a linked list. VecDeque is very efficient when we need a double ended queue. However, we need a linked list when we need lots of mutations in the sequence and positions of elements. They solve different problems.
328328

329-
For instance, a `DoublyList` with indices is a better fit for a problem where we will continuously mutate positions of elements in a collection, moving them around. A very common use case is due to the classical traveling salesman problem where we keep changing positions of cities with the aim to find shorter and shorter tours.
329+
For instance, a `DoublyList` with indices is a better fit for a problem where we will continuously mutate positions of elements in a collection, moving them around. A very common use case occurs due to the classical traveling salesman problem where we keep changing positions of cities with the aim to find shorter and shorter tours.
330330

331331
See the example in [tour_mutations.rs](https://github.com/orxfun/orx-linked-list/blob/main/examples/tour_mutations.rs).
332332

@@ -364,7 +364,7 @@ impl TourLinkedList {
364364
}
365365
```
366366

367-
Although clear from the worst time complexity of the implementations, [doubly_shuffling_around.rs](https://github.com/orxfun/orx-linked-list/blob/main/benches/doubly_shuffling_around.rs) benchmark demonstrates the dramatic difference. At each setting, we perform 10k `insert_after` moves with tours of different lengths. The following table summarizes the required time in macro-seconds for each setting.
367+
Although clear from the worst time complexity of the implementations, [doubly_shuffling_around.rs](https://github.com/orxfun/orx-linked-list/blob/main/benches/doubly_shuffling_around.rs) benchmark demonstrates the dramatic difference. At each setting, we perform 10k `insert_after` moves with tours of different lengths. The following table summarizes the required time in microseconds for each setting.
368368

369369
| num_cities | DoublyList | Vec |
370370
|------------|------------|-----------|
@@ -379,26 +379,26 @@ Although clear from the worst time complexity of the implementations, [doubly_sh
379379

380380
As mentioned, node indices are associated with elements rather than positions.
381381
* The linked list can provide safe access through node indices due to the fact that the underlying storage is a [`SplitVec`](https://crates.io/crates/orx-split-vec) which implements [`PinnedVec`](https://crates.io/crates/orx-pinned-vec), keeping the memory positions of its elements unchanged, unless they are explicitly changed.
382-
* Therefore, the list is able to know if a node index is pointing to a valid memory position belonging to itself. Therefore, we are not allowed use a node index created from one list on another list:
382+
* Therefore, the list is able to know if a node index is pointing to a valid memory position belonging to itself, and prevents to use a node index created from one list on another list:
383383
* `get`, `is_valid`, `idx_err` returns None, false and `NodeIdxErr::OutOfBounds`, respectively.
384384
* Further, when an element is removed from the list, its position is not immediately filled by other elements. Therefore, the index still points to the correct memory position and the list is able to know that the element is removed.
385385
* `get`, `is_valid`, `idx_err` returns None, false and `NodeIdxErr::RemovedNode`, respectively.
386386

387-
Clearly, such a memory policy might leave gaps in the storage and lead to low utilization of memory. However, the lists are self-organizing as follows:
387+
Clearly, such a memory policy leaves gaps in the storage and utilization of memory becomes important. Therefore, the linked lists are self-organizing as follows:
388388
* Whenever an element is removed, the utilization of nodes is checked. Node utilization is the ratio of active nodes to occupied nodes.
389389
* Whenever the utilization falls below a certain threshold (75% by default), positions of closed nodes are reclaimed and utilization is brought back to 100%.
390390

391391
When, a node reorganization is triggered, node indices collected beforehand become invalid. The linked lists, however, have a means to know that the node index is now invalid by comparing the so called memory states of the index and list. If we attempt to use a node index after the list is reorganized and the index is invalidated, we safely get an error:
392392
* `get`, `is_valid`, `idx_err` returns None, false and `NodeIdxErr::ReorganizedCollection`, respectively.
393393

394-
**In summary, we can always make sure whether or not using a node index is safe and allowed. Further, we can never have an unchecked / unsafe access to elements that we are not supposed to.**
394+
*In summary, we can make sure whether or not using a node index is safe. Further, we cannot have an unchecked / unsafe access to elements that we are not supposed to.*
395395

396-
On the other hand, it sounds inconvenient that the indices can implicitly be invalidated. However, the situation is actually not complicated or unpredictable.
396+
It sounds inconvenient that the indices can implicitly be invalidated. The situation, however, is not complicated or unpredictable.
397397
* First, we know that growth can never cause reorganization; only removals can trigger it.
398398
* Second, we have the lazy versions of the lists which will never automatically reorganize nodes. Collected indices will always be valid unless we explicitly call `reclaim_closed_nodes`.
399-
* Third, it is a free operation to switch between auto-reclaim and lazy-reclaim modes.
399+
* Third, it is free to transform between auto-reclaim and lazy-reclaim modes.
400400

401-
**Therefore, we can have full control on the valid lifetime of our indices.**
401+
*Therefore, we can have full control on the valid lifetime of our indices.*
402402

403403
<details>
404404
<summary style="font-weight:bold;">Controlling Validity of Node Indices</summary>

src/list.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ mod common_traits;
1616
mod consuming;
1717
mod get;
1818
mod get_doubly;
19-
mod get_singly;
2019
mod idx_doubly;
2120
mod idx_singly;
2221
mod linear;

src/list/get_singly.rs

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)