From ba094d744aa1d965aaa8acbf59e623b97aea366d Mon Sep 17 00:00:00 2001 From: <> Date: Sat, 7 Sep 2024 20:06:10 +0530 Subject: [PATCH] Deployed 627c4e4 with MkDocs version: 1.6.0 --- 404.html | 84 + algorithms/partition/partition/index.html | 84 + algorithms/search/binary/index.html | 84 + algorithms/sort/mergesort/index.html | 84 + algorithms/sort/quicksort/index.html | 84 + android/activities/index.html | 84 + android/animation-transition/index.html | 84 + android/fragments/index.html | 84 + android/tasks/index.html | 84 + concurrency/intro/index.html | 84 + data-structures/circular-list/index.html | 84 + data-structures/graph/bfs/index.html | 84 + data-structures/graph/dfs/index.html | 84 + .../graph/generic-search/index.html | 84 + data-structures/graph/intro/index.html | 84 + .../graph/topological-sort/index.html | 84 + data-structures/heap/index.html | 86 +- data-structures/linked-list/basics/index.html | 84 + data-structures/linked-list/clone/index.html | 1955 +++++++++++++++ .../linked-list/equality/index.html | 2021 +++++++++++++++ .../linked-list/iterate/index.html | 2013 +++++++++++++++ data-structures/linked-list/merge/index.html | 2206 +++++++++++++++++ .../queue-as-linked-list/index.html | 86 +- .../linked-list/reverse/index.html | 84 + .../linked-list/sentinel/index.html | 84 + .../stack-as-linked-list/index.html | 84 + data-structures/numbers/arithmetic/index.html | 84 + .../numbers/representation/index.html | 84 + index.html | 84 + java/collections-framework/index.html | 84 + js/closures/index.html | 84 + js/hoisting/index.html | 84 + js/objects/index.html | 84 + js/types/index.html | 84 + kt/concurrency/index.html | 84 + misc/display/index.html | 84 + python/basics/index.html | 84 + python/functions/index.html | 84 + python/generators/index.html | 84 + python/objects/index.html | 84 + python/oop/index.html | 84 + python/operators/index.html | 84 + python/structure/index.html | 84 + ubuntu/setup/index.html | 84 + 44 files changed, 11557 insertions(+), 2 deletions(-) create mode 100644 data-structures/linked-list/clone/index.html create mode 100644 data-structures/linked-list/equality/index.html create mode 100644 data-structures/linked-list/iterate/index.html create mode 100644 data-structures/linked-list/merge/index.html diff --git a/404.html b/404.html index c6bff54..f521751 100644 --- a/404.html +++ b/404.html @@ -454,6 +454,90 @@ + + + + + + +
  • + + + + + Iterate over list + + + + +
  • + + + + + + + + + + +
  • + + + + + Compare linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Clone linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Merge linked lists + + + + +
  • + + + + diff --git a/algorithms/partition/partition/index.html b/algorithms/partition/partition/index.html index 33cfdb2..657f363 100644 --- a/algorithms/partition/partition/index.html +++ b/algorithms/partition/partition/index.html @@ -472,6 +472,90 @@ + + + + + + +
  • + + + + + Iterate over list + + + + +
  • + + + + + + + + + + +
  • + + + + + Compare linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Clone linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Merge linked lists + + + + +
  • + + + + diff --git a/algorithms/search/binary/index.html b/algorithms/search/binary/index.html index 8579ed7..f79a168 100644 --- a/algorithms/search/binary/index.html +++ b/algorithms/search/binary/index.html @@ -472,6 +472,90 @@ + + + + + + +
  • + + + + + Iterate over list + + + + +
  • + + + + + + + + + + +
  • + + + + + Compare linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Clone linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Merge linked lists + + + + +
  • + + + + diff --git a/algorithms/sort/mergesort/index.html b/algorithms/sort/mergesort/index.html index 268dbae..0587206 100644 --- a/algorithms/sort/mergesort/index.html +++ b/algorithms/sort/mergesort/index.html @@ -472,6 +472,90 @@ + + + + + + +
  • + + + + + Iterate over list + + + + +
  • + + + + + + + + + + +
  • + + + + + Compare linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Clone linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Merge linked lists + + + + +
  • + + + + diff --git a/algorithms/sort/quicksort/index.html b/algorithms/sort/quicksort/index.html index d69ac15..5c0683c 100644 --- a/algorithms/sort/quicksort/index.html +++ b/algorithms/sort/quicksort/index.html @@ -472,6 +472,90 @@ + + + + + + +
  • + + + + + Iterate over list + + + + +
  • + + + + + + + + + + +
  • + + + + + Compare linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Clone linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Merge linked lists + + + + +
  • + + + + diff --git a/android/activities/index.html b/android/activities/index.html index 1aab61c..3b4c240 100644 --- a/android/activities/index.html +++ b/android/activities/index.html @@ -472,6 +472,90 @@ + + + + + + +
  • + + + + + Iterate over list + + + + +
  • + + + + + + + + + + +
  • + + + + + Compare linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Clone linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Merge linked lists + + + + +
  • + + + + diff --git a/android/animation-transition/index.html b/android/animation-transition/index.html index 2cc1ebf..4801e08 100644 --- a/android/animation-transition/index.html +++ b/android/animation-transition/index.html @@ -472,6 +472,90 @@ + + + + + + +
  • + + + + + Iterate over list + + + + +
  • + + + + + + + + + + +
  • + + + + + Compare linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Clone linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Merge linked lists + + + + +
  • + + + + diff --git a/android/fragments/index.html b/android/fragments/index.html index be28a52..87621c8 100644 --- a/android/fragments/index.html +++ b/android/fragments/index.html @@ -472,6 +472,90 @@ + + + + + + +
  • + + + + + Iterate over list + + + + +
  • + + + + + + + + + + +
  • + + + + + Compare linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Clone linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Merge linked lists + + + + +
  • + + + + diff --git a/android/tasks/index.html b/android/tasks/index.html index 9da8106..ca0bcb0 100644 --- a/android/tasks/index.html +++ b/android/tasks/index.html @@ -472,6 +472,90 @@ + + + + + + +
  • + + + + + Iterate over list + + + + +
  • + + + + + + + + + + +
  • + + + + + Compare linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Clone linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Merge linked lists + + + + +
  • + + + + diff --git a/concurrency/intro/index.html b/concurrency/intro/index.html index 0b0f534..a75202f 100644 --- a/concurrency/intro/index.html +++ b/concurrency/intro/index.html @@ -472,6 +472,90 @@ + + + + + + +
  • + + + + + Iterate over list + + + + +
  • + + + + + + + + + + +
  • + + + + + Compare linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Clone linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Merge linked lists + + + + +
  • + + + + diff --git a/data-structures/circular-list/index.html b/data-structures/circular-list/index.html index 290d5b1..086b2d0 100644 --- a/data-structures/circular-list/index.html +++ b/data-structures/circular-list/index.html @@ -474,6 +474,90 @@ + + + + + + +
  • + + + + + Iterate over list + + + + +
  • + + + + + + + + + + +
  • + + + + + Compare linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Clone linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Merge linked lists + + + + +
  • + + + + diff --git a/data-structures/graph/bfs/index.html b/data-structures/graph/bfs/index.html index 33ab5e0..8fa8c97 100644 --- a/data-structures/graph/bfs/index.html +++ b/data-structures/graph/bfs/index.html @@ -474,6 +474,90 @@ + + + + + + +
  • + + + + + Iterate over list + + + + +
  • + + + + + + + + + + +
  • + + + + + Compare linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Clone linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Merge linked lists + + + + +
  • + + + + diff --git a/data-structures/graph/dfs/index.html b/data-structures/graph/dfs/index.html index c572332..bccb992 100644 --- a/data-structures/graph/dfs/index.html +++ b/data-structures/graph/dfs/index.html @@ -474,6 +474,90 @@ + + + + + + +
  • + + + + + Iterate over list + + + + +
  • + + + + + + + + + + +
  • + + + + + Compare linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Clone linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Merge linked lists + + + + +
  • + + + + diff --git a/data-structures/graph/generic-search/index.html b/data-structures/graph/generic-search/index.html index 8e1e60f..b0ec7f0 100644 --- a/data-structures/graph/generic-search/index.html +++ b/data-structures/graph/generic-search/index.html @@ -474,6 +474,90 @@ + + + + + + +
  • + + + + + Iterate over list + + + + +
  • + + + + + + + + + + +
  • + + + + + Compare linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Clone linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Merge linked lists + + + + +
  • + + + + diff --git a/data-structures/graph/intro/index.html b/data-structures/graph/intro/index.html index a3661a7..0c5b57e 100644 --- a/data-structures/graph/intro/index.html +++ b/data-structures/graph/intro/index.html @@ -474,6 +474,90 @@ + + + + + + +
  • + + + + + Iterate over list + + + + +
  • + + + + + + + + + + +
  • + + + + + Compare linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Clone linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Merge linked lists + + + + +
  • + + + + diff --git a/data-structures/graph/topological-sort/index.html b/data-structures/graph/topological-sort/index.html index 7a241fc..6d01b73 100644 --- a/data-structures/graph/topological-sort/index.html +++ b/data-structures/graph/topological-sort/index.html @@ -474,6 +474,90 @@ + + + + + + +
  • + + + + + Iterate over list + + + + +
  • + + + + + + + + + + +
  • + + + + + Compare linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Clone linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Merge linked lists + + + + +
  • + + + + diff --git a/data-structures/heap/index.html b/data-structures/heap/index.html index 5cd104e..3ad3b0a 100644 --- a/data-structures/heap/index.html +++ b/data-structures/heap/index.html @@ -9,7 +9,7 @@ - + @@ -474,6 +474,90 @@ + + + + + + +
  • + + + + + Iterate over list + + + + +
  • + + + + + + + + + + +
  • + + + + + Compare linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Clone linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Merge linked lists + + + + +
  • + + + + diff --git a/data-structures/linked-list/basics/index.html b/data-structures/linked-list/basics/index.html index 8266a56..53d495d 100644 --- a/data-structures/linked-list/basics/index.html +++ b/data-structures/linked-list/basics/index.html @@ -543,6 +543,90 @@ + + + + + + +
  • + + + + + Iterate over list + + + + +
  • + + + + + + + + + + +
  • + + + + + Compare linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Clone linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Merge linked lists + + + + +
  • + + + + diff --git a/data-structures/linked-list/clone/index.html b/data-structures/linked-list/clone/index.html new file mode 100644 index 0000000..c598a8d --- /dev/null +++ b/data-structures/linked-list/clone/index.html @@ -0,0 +1,1955 @@ + + + + + + + + + + + + + + + + + + + + + + + Clone linked lists - listless 💤 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + Skip to content + + +
    +
    + +
    + + + + + + +
    + + +
    + +
    + + + + + + +
    +
    + + + +
    +
    +
    + + + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    + + + + +

    Clone linked lists

    + + +

    Shallow copy

    +
    1
    +2
    +3
    +4
    +5
    def __copy__(self):
    +    copy = LinkedList()
    +    for e in self:
    +        copy.append(e)
    +    return copy
    +
    +

    Unit tests

    +
     1
    + 2
    + 3
    + 4
    + 5
    + 6
    + 7
    + 8
    + 9
    +10
    +11
    def test_clone():
    +    l = LinkedList()
    +    assert copy(l) == l
    +    assert copy(l) is not l
    +
    +    l = LinkedList()
    +    l.prepend(3)
    +    l.prepend(2)
    +    l.prepend(1)
    +    assert copy(l) == l
    +    assert copy(l) is not l
    +
    + + + + + + + + + + + + + +
    +
    + + + +
    + +
    + + + +
    +
    +
    +
    + + + + + + + + + + + + \ No newline at end of file diff --git a/data-structures/linked-list/equality/index.html b/data-structures/linked-list/equality/index.html new file mode 100644 index 0000000..4894740 --- /dev/null +++ b/data-structures/linked-list/equality/index.html @@ -0,0 +1,2021 @@ + + + + + + + + + + + + + + + + + + + + + + + Compare linked lists - listless 💤 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + Skip to content + + +
    +
    + +
    + + + + + + +
    + + +
    + +
    + + + + + + +
    +
    + + + +
    +
    +
    + + + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    + + + + +

    Compare linked lists

    + + +

    Override __eq__

    +
     1
    + 2
    + 3
    + 4
    + 5
    + 6
    + 7
    + 8
    + 9
    +10
    +11
    def __eq__(self, other: 'LinkedList'):
    +    if self is other:
    +        return True
    +
    +    cursor = self._sentinel.next
    +    for e in other:
    +        if e != cursor.value:
    +            return False
    +        cursor = cursor.next
    +
    +    return cursor is self._sentinel
    +
    +

    Unit tests

    +
     1
    + 2
    + 3
    + 4
    + 5
    + 6
    + 7
    + 8
    + 9
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    def test_equality_empty():
    +    assert LinkedList() == LinkedList()
    +    assert LinkedList() is not LinkedList()
    +
    +
    +def test_equality_simple():
    +    p = LinkedList()
    +    p.append(1)
    +    p.append(2)
    +    p.append(3)
    +
    +    q = LinkedList()
    +    q.append(1)
    +    q.append(2)
    +    q.append(3)
    +    assert p == q
    +    assert p is not q
    +
    +
    +def test_equality_partial():
    +    p = LinkedList()
    +    p.append(1)
    +    p.append(2)
    +    p.append(3)
    +    p.append(4)
    +
    +    q = LinkedList()
    +    q.append(1)
    +    q.append(2)
    +    q.append(3)
    +
    +    assert p != q
    +
    +    q.append(4)
    +    assert p == q
    +
    +    q.append(5)
    +    assert p != q
    +
    + + + + + + + + + + + + + +
    +
    + + + +
    + +
    + + + +
    +
    +
    +
    + + + + + + + + + + + + \ No newline at end of file diff --git a/data-structures/linked-list/iterate/index.html b/data-structures/linked-list/iterate/index.html new file mode 100644 index 0000000..8739114 --- /dev/null +++ b/data-structures/linked-list/iterate/index.html @@ -0,0 +1,2013 @@ + + + + + + + + + + + + + + + + + + + + + + + Iterate over list - listless 💤 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + Skip to content + + +
    +
    + +
    + + + + + + +
    + + +
    + +
    + + + + + + +
    +
    + + + +
    +
    +
    + + + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    + + + + +

    Iterate over linked list

    + + +

    Get item

    +
    +
    +
    +
    list.py
    1
    +2
    +3
    +4
    +5
    +6
    +7
    +8
    def __getitem__(self, index) -> Optional[int]:
    +    i, cursor = 0, self._sentinel.next
    +    while i <= index:
    +        if cursor is self._sentinel:
    +            return None
    +        if i == index:
    +            return cursor.value
    +        i, cursor = i+1, cursor.next
    +
    +
    +
    +
     1
    + 2
    + 3
    + 4
    + 5
    + 6
    + 7
    + 8
    + 9
    +10
    +11
    +12
    +13
    +14
    def test_get():
    +    ll = LinkedList()
    +    ll.append(1)
    +    ll.append(2)
    +    ll.append(3)
    +    ll.append(4)
    +    ll.append(5)
    +
    +    assert ll[0] == 1
    +    assert ll[1] == 2
    +    assert ll[2] == 3
    +    assert ll[3] == 4
    +    assert ll[4] == 5
    +    assert ll[5] is None
    +
    +
    +
    +
    +

    Iterator

    +
    +
    +
    +
    list.py
    1
    +2
    +3
    +4
    +5
    def __iter__(self):
    +  cursor = self._sentinel.next
    +  while cursor is not self._sentinel:
    +      yield cursor.value
    +      cursor = cursor.next
    +
    +
    +
    +
     1
    + 2
    + 3
    + 4
    + 5
    + 6
    + 7
    + 8
    + 9
    +10
    def test_iteration():
    +    ll = LinkedList()
    +    ll.append(1)
    +    ll.append(2)
    +    ll.append(3)
    +    ll.append(4)
    +    ll.append(5)
    +
    +    for i, v in enumerate(ll):
    +        assert v == ll[i]
    +
    +
    +
    +
    + + + + + + + + + + + + + +
    +
    + + + +
    + +
    + + + +
    +
    +
    +
    + + + + + + + + + + + + \ No newline at end of file diff --git a/data-structures/linked-list/merge/index.html b/data-structures/linked-list/merge/index.html new file mode 100644 index 0000000..526d30f --- /dev/null +++ b/data-structures/linked-list/merge/index.html @@ -0,0 +1,2206 @@ + + + + + + + + + + + + + + + + + + + + + + + Merge linked lists - listless 💤 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + Skip to content + + +
    +
    + +
    + + + + + + +
    + + +
    + +
    + + + + + + +
    +
    + + + +
    +
    +
    + + + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    + + + + +

    Merge linked lists

    + + +

    In-place merging of sorted linked lists

    +
     1
    + 2
    + 3
    + 4
    + 5
    + 6
    + 7
    + 8
    + 9
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    def sorted_ingest(self, other: 'LinkedList'):
    +    if self is other:
    +        return
    +
    +    new_sentinel = Node(0) # (1)!
    +    cursor = new_sentinel
    +
    +    cursor_self = self._sentinel.next
    +    cursor_other = other._sentinel.next
    +
    +    while cursor_self is not self._sentinel and cursor_other is not other._sentinel: # (2)!
    +        if cursor_self.value <= cursor_other.value:
    +            cursor.next = cursor_self
    +            cursor_self = cursor_self.next
    +        else:
    +            cursor.next = cursor_other
    +            cursor_other = cursor_other.next
    +        cursor = cursor.next
    +
    +    if cursor_self is not self._sentinel:
    +        cursor.next = cursor_self # (3)!
    +        new_sentinel.prev = self._sentinel.prev # (4)!
    +    elif cursor_other is not other._sentinel:
    +        cursor.next = cursor_other
    +        new_sentinel.prev = other._sentinel.prev
    +    else:
    +        new_sentinel.prev = cursor # (5)!
    +
    +    self._sentinel = new_sentinel # (6)!
    +    other._sentinel.next = other._sentinel # (7)!
    +
    +
      +
    1. Set up head for merged list
    2. +
    3. Merge until either list exhausts.
    4. +
    5. No need to loop here, we can just link the remaining list.
    6. +
    7. We don't need to find the tail of the remaining list. It'll be the prev of original sentinel.
    8. +
    9. Doing the same work as line 22 and 25.
    10. +
    11. Stitch the two ends of new list.
    12. +
    13. Leave the ingested list empty.
    14. +
    +

    Unit tests

    +
      1
    +  2
    +  3
    +  4
    +  5
    +  6
    +  7
    +  8
    +  9
    + 10
    + 11
    + 12
    + 13
    + 14
    + 15
    + 16
    + 17
    + 18
    + 19
    + 20
    + 21
    + 22
    + 23
    + 24
    + 25
    + 26
    + 27
    + 28
    + 29
    + 30
    + 31
    + 32
    + 33
    + 34
    + 35
    + 36
    + 37
    + 38
    + 39
    + 40
    + 41
    + 42
    + 43
    + 44
    + 45
    + 46
    + 47
    + 48
    + 49
    + 50
    + 51
    + 52
    + 53
    + 54
    + 55
    + 56
    + 57
    + 58
    + 59
    + 60
    + 61
    + 62
    + 63
    + 64
    + 65
    + 66
    + 67
    + 68
    + 69
    + 70
    + 71
    + 72
    + 73
    + 74
    + 75
    + 76
    + 77
    + 78
    + 79
    + 80
    + 81
    + 82
    + 83
    + 84
    + 85
    + 86
    + 87
    + 88
    + 89
    + 90
    + 91
    + 92
    + 93
    + 94
    + 95
    + 96
    + 97
    + 98
    + 99
    +100
    +101
    +102
    +103
    +104
    +105
    +106
    +107
    def test_merge_empty():
    +    a = LinkedList()
    +    b = LinkedList()
    +    a.sorted_ingest(b)
    +
    +    assert str(a) == "[]"
    +    assert b.empty
    +
    +
    +def test_merge_empty_in_single():
    +    a = LinkedList()
    +    a.append(1)
    +    b = LinkedList()
    +    a.sorted_ingest(b)
    +
    +    assert str(a) == "[1]"
    +    assert b.empty
    +
    +
    +def test_merge_single_in_empty():
    +    a = LinkedList()
    +    b = LinkedList()
    +    b.append(1)
    +    a.sorted_ingest(b)
    +
    +    assert str(a) == "[1]"
    +    assert b.empty
    +
    +
    +def test_merge_is_append():
    +    a = LinkedList()
    +    a.append(1)
    +    a.append(2)
    +    a.append(3)
    +    b = LinkedList()
    +    b.append(4)
    +    b.append(5)
    +    b.append(6)
    +    a.sorted_ingest(b)
    +
    +    assert str(a) == "[1, 2, 3, 4, 5, 6]"
    +    assert b.empty
    +
    +
    +def test_merge_is_prepend():
    +    a = LinkedList()
    +    a.append(1)
    +    a.append(2)
    +    a.append(3)
    +    b = LinkedList()
    +    b.append(4)
    +    b.append(5)
    +    b.append(6)
    +    b.sorted_ingest(a)
    +
    +    assert str(b) == "[1, 2, 3, 4, 5, 6]"
    +    assert a.empty
    +
    +
    +def test_merge_is_interleave():
    +    a = LinkedList()
    +    a.append(1)
    +    a.append(3)
    +    a.append(5)
    +    b = LinkedList()
    +    b.append(2)
    +    b.append(4)
    +    b.append(6)
    +    b.sorted_ingest(a)
    +
    +    assert str(b) == "[1, 2, 3, 4, 5, 6]"
    +    assert a.empty
    +
    +
    +def test_merge_is_interleave_uneven():
    +    a = LinkedList()
    +    a.append(1)
    +    a.append(3)
    +    a.append(5)
    +    a.append(10)
    +    b = LinkedList()
    +    b.append(2)
    +    b.append(4)
    +    b.append(6)
    +    b.sorted_ingest(a)
    +
    +    assert str(b) == "[1, 2, 3, 4, 5, 6, 10]"
    +    assert a.empty
    +
    +
    +def test_merge_random():
    +    a = sorted([random.randint(0, 100) for x in range(0, 10)])
    +    b = sorted([random.randint(0, 100) for x in range(0, 10)])
    +    c = sorted(a + b)
    +
    +    p = LinkedList()
    +    for e in a:
    +        p.append(e)
    +
    +    q = LinkedList()
    +    for e in b:
    +        q.append(e)
    +
    +    p.sorted_ingest(q)
    +
    +    for i, e in enumerate(p):
    +        assert e == c[i]
    +
    + + + + + + + + + + + + + +
    +
    + + + +
    + +
    + + + +
    +
    +
    +
    + + + + + + + + + + + + \ No newline at end of file diff --git a/data-structures/linked-list/queue-as-linked-list/index.html b/data-structures/linked-list/queue-as-linked-list/index.html index 22a6966..6997bf9 100644 --- a/data-structures/linked-list/queue-as-linked-list/index.html +++ b/data-structures/linked-list/queue-as-linked-list/index.html @@ -12,7 +12,7 @@ - + @@ -534,6 +534,90 @@ + + + + + + +
  • + + + + + Iterate over list + + + + +
  • + + + + + + + + + + +
  • + + + + + Compare linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Clone linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Merge linked lists + + + + +
  • + + + + diff --git a/data-structures/linked-list/reverse/index.html b/data-structures/linked-list/reverse/index.html index ac9a5f3..d6ae4fc 100644 --- a/data-structures/linked-list/reverse/index.html +++ b/data-structures/linked-list/reverse/index.html @@ -486,6 +486,90 @@ + + + + + + +
  • + + + + + Iterate over list + + + + +
  • + + + + + + + + + + +
  • + + + + + Compare linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Clone linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Merge linked lists + + + + +
  • + + + + diff --git a/data-structures/linked-list/sentinel/index.html b/data-structures/linked-list/sentinel/index.html index 02c0844..89b2295 100644 --- a/data-structures/linked-list/sentinel/index.html +++ b/data-structures/linked-list/sentinel/index.html @@ -570,6 +570,90 @@ + + + + + + +
  • + + + + + Iterate over list + + + + +
  • + + + + + + + + + + +
  • + + + + + Compare linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Clone linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Merge linked lists + + + + +
  • + + + + diff --git a/data-structures/linked-list/stack-as-linked-list/index.html b/data-structures/linked-list/stack-as-linked-list/index.html index 9e51c89..132b375 100644 --- a/data-structures/linked-list/stack-as-linked-list/index.html +++ b/data-structures/linked-list/stack-as-linked-list/index.html @@ -534,6 +534,90 @@ + + + + + + +
  • + + + + + Iterate over list + + + + +
  • + + + + + + + + + + +
  • + + + + + Compare linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Clone linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Merge linked lists + + + + +
  • + + + + diff --git a/data-structures/numbers/arithmetic/index.html b/data-structures/numbers/arithmetic/index.html index 5835c83..0858c1d 100644 --- a/data-structures/numbers/arithmetic/index.html +++ b/data-structures/numbers/arithmetic/index.html @@ -525,6 +525,90 @@ + + + + + + +
  • + + + + + Iterate over list + + + + +
  • + + + + + + + + + + +
  • + + + + + Compare linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Clone linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Merge linked lists + + + + +
  • + + + + diff --git a/data-structures/numbers/representation/index.html b/data-structures/numbers/representation/index.html index 8ec513b..70bcb1a 100644 --- a/data-structures/numbers/representation/index.html +++ b/data-structures/numbers/representation/index.html @@ -552,6 +552,90 @@ + + + + + + +
  • + + + + + Iterate over list + + + + +
  • + + + + + + + + + + +
  • + + + + + Compare linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Clone linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Merge linked lists + + + + +
  • + + + + diff --git a/index.html b/index.html index c782504..d176423 100644 --- a/index.html +++ b/index.html @@ -480,6 +480,90 @@ + + + + + + +
  • + + + + + Iterate over list + + + + +
  • + + + + + + + + + + +
  • + + + + + Compare linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Clone linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Merge linked lists + + + + +
  • + + + + diff --git a/java/collections-framework/index.html b/java/collections-framework/index.html index 2b2cb2c..8721595 100644 --- a/java/collections-framework/index.html +++ b/java/collections-framework/index.html @@ -472,6 +472,90 @@ + + + + + + +
  • + + + + + Iterate over list + + + + +
  • + + + + + + + + + + +
  • + + + + + Compare linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Clone linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Merge linked lists + + + + +
  • + + + + diff --git a/js/closures/index.html b/js/closures/index.html index c084632..10f923e 100644 --- a/js/closures/index.html +++ b/js/closures/index.html @@ -472,6 +472,90 @@ + + + + + + +
  • + + + + + Iterate over list + + + + +
  • + + + + + + + + + + +
  • + + + + + Compare linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Clone linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Merge linked lists + + + + +
  • + + + + diff --git a/js/hoisting/index.html b/js/hoisting/index.html index 1a028fe..622e11a 100644 --- a/js/hoisting/index.html +++ b/js/hoisting/index.html @@ -472,6 +472,90 @@ + + + + + + +
  • + + + + + Iterate over list + + + + +
  • + + + + + + + + + + +
  • + + + + + Compare linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Clone linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Merge linked lists + + + + +
  • + + + + diff --git a/js/objects/index.html b/js/objects/index.html index 41fc6bf..7c21002 100644 --- a/js/objects/index.html +++ b/js/objects/index.html @@ -472,6 +472,90 @@ + + + + + + +
  • + + + + + Iterate over list + + + + +
  • + + + + + + + + + + +
  • + + + + + Compare linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Clone linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Merge linked lists + + + + +
  • + + + + diff --git a/js/types/index.html b/js/types/index.html index aa87cb4..b69c012 100644 --- a/js/types/index.html +++ b/js/types/index.html @@ -472,6 +472,90 @@ + + + + + + +
  • + + + + + Iterate over list + + + + +
  • + + + + + + + + + + +
  • + + + + + Compare linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Clone linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Merge linked lists + + + + +
  • + + + + diff --git a/kt/concurrency/index.html b/kt/concurrency/index.html index ec1530f..2380bd1 100644 --- a/kt/concurrency/index.html +++ b/kt/concurrency/index.html @@ -472,6 +472,90 @@ + + + + + + +
  • + + + + + Iterate over list + + + + +
  • + + + + + + + + + + +
  • + + + + + Compare linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Clone linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Merge linked lists + + + + +
  • + + + + diff --git a/misc/display/index.html b/misc/display/index.html index 5937116..805fc89 100644 --- a/misc/display/index.html +++ b/misc/display/index.html @@ -470,6 +470,90 @@ + + + + + + +
  • + + + + + Iterate over list + + + + +
  • + + + + + + + + + + +
  • + + + + + Compare linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Clone linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Merge linked lists + + + + +
  • + + + + diff --git a/python/basics/index.html b/python/basics/index.html index 9b7a6e7..65332e0 100644 --- a/python/basics/index.html +++ b/python/basics/index.html @@ -472,6 +472,90 @@ + + + + + + +
  • + + + + + Iterate over list + + + + +
  • + + + + + + + + + + +
  • + + + + + Compare linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Clone linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Merge linked lists + + + + +
  • + + + + diff --git a/python/functions/index.html b/python/functions/index.html index e6607fd..393dc54 100644 --- a/python/functions/index.html +++ b/python/functions/index.html @@ -472,6 +472,90 @@ + + + + + + +
  • + + + + + Iterate over list + + + + +
  • + + + + + + + + + + +
  • + + + + + Compare linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Clone linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Merge linked lists + + + + +
  • + + + + diff --git a/python/generators/index.html b/python/generators/index.html index 2748e5e..e94a9df 100644 --- a/python/generators/index.html +++ b/python/generators/index.html @@ -472,6 +472,90 @@ + + + + + + +
  • + + + + + Iterate over list + + + + +
  • + + + + + + + + + + +
  • + + + + + Compare linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Clone linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Merge linked lists + + + + +
  • + + + + diff --git a/python/objects/index.html b/python/objects/index.html index cf0a238..4808281 100644 --- a/python/objects/index.html +++ b/python/objects/index.html @@ -472,6 +472,90 @@ + + + + + + +
  • + + + + + Iterate over list + + + + +
  • + + + + + + + + + + +
  • + + + + + Compare linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Clone linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Merge linked lists + + + + +
  • + + + + diff --git a/python/oop/index.html b/python/oop/index.html index 05065e7..032d68f 100644 --- a/python/oop/index.html +++ b/python/oop/index.html @@ -472,6 +472,90 @@ + + + + + + +
  • + + + + + Iterate over list + + + + +
  • + + + + + + + + + + +
  • + + + + + Compare linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Clone linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Merge linked lists + + + + +
  • + + + + diff --git a/python/operators/index.html b/python/operators/index.html index 3e0143d..235241e 100644 --- a/python/operators/index.html +++ b/python/operators/index.html @@ -472,6 +472,90 @@ + + + + + + +
  • + + + + + Iterate over list + + + + +
  • + + + + + + + + + + +
  • + + + + + Compare linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Clone linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Merge linked lists + + + + +
  • + + + + diff --git a/python/structure/index.html b/python/structure/index.html index 022ae05..dac143e 100644 --- a/python/structure/index.html +++ b/python/structure/index.html @@ -472,6 +472,90 @@ + + + + + + +
  • + + + + + Iterate over list + + + + +
  • + + + + + + + + + + +
  • + + + + + Compare linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Clone linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Merge linked lists + + + + +
  • + + + + diff --git a/ubuntu/setup/index.html b/ubuntu/setup/index.html index 85d0750..f7e3111 100644 --- a/ubuntu/setup/index.html +++ b/ubuntu/setup/index.html @@ -472,6 +472,90 @@ + + + + + + +
  • + + + + + Iterate over list + + + + +
  • + + + + + + + + + + +
  • + + + + + Compare linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Clone linked lists + + + + +
  • + + + + + + + + + + +
  • + + + + + Merge linked lists + + + + +
  • + + + +