Skip to content

Commit 009db7a

Browse files
committed
Merge branch 'master' into beta
2 parents 088bf02 + 1f7a7cc commit 009db7a

File tree

7 files changed

+60
-16
lines changed

7 files changed

+60
-16
lines changed

docs/api/Advanced.Algorithms.DataStructures.RedBlackTree-1.html

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,14 @@ <h3 id="constructors">Constructors
122122

123123

124124
<a id="Advanced_Algorithms_DataStructures_RedBlackTree_1__ctor_" data-uid="Advanced.Algorithms.DataStructures.RedBlackTree`1.#ctor*"></a>
125-
<h4 id="Advanced_Algorithms_DataStructures_RedBlackTree_1__ctor_IEnumerable__0__" data-uid="Advanced.Algorithms.DataStructures.RedBlackTree`1.#ctor(IEnumerable{`0})">RedBlackTree(IEnumerable&lt;T&gt;)</h4>
125+
<h4 id="Advanced_Algorithms_DataStructures_RedBlackTree_1__ctor_IEnumerable__0__System_Boolean_" data-uid="Advanced.Algorithms.DataStructures.RedBlackTree`1.#ctor(IEnumerable{`0},System.Boolean)">RedBlackTree(IEnumerable&lt;T&gt;, Boolean)</h4>
126126
<div class="markdown level1 summary"><p>Initialize the BST with given sorted keys optionally.
127127
Time complexity: O(n).</p>
128128
</div>
129129
<div class="markdown level1 conceptual"></div>
130130
<h5 class="decalaration">Declaration</h5>
131131
<div class="codewrapper">
132-
<pre><code class="lang-csharp hljs">public RedBlackTree(IEnumerable&lt;T&gt; sortedCollection = null)</code></pre>
132+
<pre><code class="lang-csharp hljs">public RedBlackTree(IEnumerable&lt;T&gt; sortedCollection, bool enableNodeLookUp = false)</code></pre>
133133
</div>
134134
<h5 class="parameters">Parameters</h5>
135135
<table class="table table-bordered table-striped table-condensed">
@@ -145,6 +145,42 @@ <h5 class="parameters">Parameters</h5>
145145
<td><span class="xref">IEnumerable</span>&lt;T&gt;</td>
146146
<td><span class="parametername">sortedCollection</span></td>
147147
<td><p>The sorted initial collection.</p>
148+
</td>
149+
</tr>
150+
<tr>
151+
<td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.boolean">Boolean</a></td>
152+
<td><span class="parametername">enableNodeLookUp</span></td>
153+
<td><p>Enabling lookup will fasten deletion/insertion/exists operations
154+
at the cost of additional space.</p>
155+
</td>
156+
</tr>
157+
</tbody>
158+
</table>
159+
160+
161+
<a id="Advanced_Algorithms_DataStructures_RedBlackTree_1__ctor_" data-uid="Advanced.Algorithms.DataStructures.RedBlackTree`1.#ctor*"></a>
162+
<h4 id="Advanced_Algorithms_DataStructures_RedBlackTree_1__ctor_System_Boolean_" data-uid="Advanced.Algorithms.DataStructures.RedBlackTree`1.#ctor(System.Boolean)">RedBlackTree(Boolean)</h4>
163+
<div class="markdown level1 summary"></div>
164+
<div class="markdown level1 conceptual"></div>
165+
<h5 class="decalaration">Declaration</h5>
166+
<div class="codewrapper">
167+
<pre><code class="lang-csharp hljs">public RedBlackTree(bool enableNodeLookUp = false)</code></pre>
168+
</div>
169+
<h5 class="parameters">Parameters</h5>
170+
<table class="table table-bordered table-striped table-condensed">
171+
<thead>
172+
<tr>
173+
<th>Type</th>
174+
<th>Name</th>
175+
<th>Description</th>
176+
</tr>
177+
</thead>
178+
<tbody>
179+
<tr>
180+
<td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.boolean">Boolean</a></td>
181+
<td><span class="parametername">enableNodeLookUp</span></td>
182+
<td><p>Enabling lookup will fasten deletion/insertion/exists operations
183+
at the cost of additional space.</p>
148184
</td>
149185
</tr>
150186
</tbody>

docs/index.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@
302302
"api/Advanced.Algorithms.DataStructures.RedBlackTree-1.html": {
303303
"href": "api/Advanced.Algorithms.DataStructures.RedBlackTree-1.html",
304304
"title": "Class RedBlackTree<T> | Advanced Algorithms",
305-
"keywords": "Class RedBlackTree<T> A red black tree implementation. Inheritance Object BSTBase <T> RedBlackTree<T> Implements IEnumerable <T> Namespace : Advanced.Algorithms.DataStructures Assembly : Advanced.Algorithms.dll Syntax public class RedBlackTree<T> : BSTBase<T>, IEnumerable<T> where T : IComparable Type Parameters Name Description T Constructors RedBlackTree(IEnumerable<T>) Initialize the BST with given sorted keys optionally. Time complexity: O(n). Declaration public RedBlackTree(IEnumerable<T> sortedCollection = null) Parameters Type Name Description IEnumerable <T> sortedCollection The sorted initial collection. Properties Count Declaration public int Count { get; } Property Value Type Description Int32 Methods AsEnumerableDesc() Descending enumerable. Declaration public IEnumerable<T> AsEnumerableDesc() Returns Type Description IEnumerable <T> Delete(T) Delete if value exists. Time complexity: O(log(n)) Returns the position (index) of the item if deleted; otherwise returns -1 Declaration public int Delete(T value) Parameters Type Name Description T value Returns Type Description Int32 ElementAt(Int32) Time complexity: O(log(n)) Declaration public T ElementAt(int index) Parameters Type Name Description Int32 index Returns Type Description T GetEnumerator() Declaration public IEnumerator<T> GetEnumerator() Returns Type Description IEnumerator <T> GetEnumeratorDesc() Declaration public IEnumerator<T> GetEnumeratorDesc() Returns Type Description IEnumerator <T> HasItem(T) Time complexity: O(log(n)) Declaration public bool HasItem(T value) Parameters Type Name Description T value Returns Type Description Boolean IndexOf(T) Time complexity: O(log(n)) Declaration public int IndexOf(T item) Parameters Type Name Description T item Returns Type Description Int32 Insert(T) Time complexity: O(log(n)). Returns the position (index) of the value in sorted order of this BST. Declaration public int Insert(T value) Parameters Type Name Description T value Returns Type Description Int32 Max() Time complexity: O(log(n)) Declaration public T Max() Returns Type Description T Min() Time complexity: O(log(n)) Declaration public T Min() Returns Type Description T NextHigher(T) Get the next higher to given value in this BST. Declaration public T NextHigher(T value) Parameters Type Name Description T value Returns Type Description T NextLower(T) Get the next lower value to given value in this BST. Declaration public T NextLower(T value) Parameters Type Name Description T value Returns Type Description T RemoveAt(Int32) Time complexity: O(log(n)) Declaration public T RemoveAt(int index) Parameters Type Name Description Int32 index Returns Type Description T Implements IEnumerable<>"
305+
"keywords": "Class RedBlackTree<T> A red black tree implementation. Inheritance Object BSTBase <T> RedBlackTree<T> Implements IEnumerable <T> Namespace : Advanced.Algorithms.DataStructures Assembly : Advanced.Algorithms.dll Syntax public class RedBlackTree<T> : BSTBase<T>, IEnumerable<T> where T : IComparable Type Parameters Name Description T Constructors RedBlackTree(IEnumerable<T>, Boolean) Initialize the BST with given sorted keys optionally. Time complexity: O(n). Declaration public RedBlackTree(IEnumerable<T> sortedCollection, bool enableNodeLookUp = false) Parameters Type Name Description IEnumerable <T> sortedCollection The sorted initial collection. Boolean enableNodeLookUp Enabling lookup will fasten deletion/insertion/exists operations at the cost of additional space. RedBlackTree(Boolean) Declaration public RedBlackTree(bool enableNodeLookUp = false) Parameters Type Name Description Boolean enableNodeLookUp Enabling lookup will fasten deletion/insertion/exists operations at the cost of additional space. Properties Count Declaration public int Count { get; } Property Value Type Description Int32 Methods AsEnumerableDesc() Descending enumerable. Declaration public IEnumerable<T> AsEnumerableDesc() Returns Type Description IEnumerable <T> Delete(T) Delete if value exists. Time complexity: O(log(n)) Returns the position (index) of the item if deleted; otherwise returns -1 Declaration public int Delete(T value) Parameters Type Name Description T value Returns Type Description Int32 ElementAt(Int32) Time complexity: O(log(n)) Declaration public T ElementAt(int index) Parameters Type Name Description Int32 index Returns Type Description T GetEnumerator() Declaration public IEnumerator<T> GetEnumerator() Returns Type Description IEnumerator <T> GetEnumeratorDesc() Declaration public IEnumerator<T> GetEnumeratorDesc() Returns Type Description IEnumerator <T> HasItem(T) Time complexity: O(log(n)) Declaration public bool HasItem(T value) Parameters Type Name Description T value Returns Type Description Boolean IndexOf(T) Time complexity: O(log(n)) Declaration public int IndexOf(T item) Parameters Type Name Description T item Returns Type Description Int32 Insert(T) Time complexity: O(log(n)). Returns the position (index) of the value in sorted order of this BST. Declaration public int Insert(T value) Parameters Type Name Description T value Returns Type Description Int32 Max() Time complexity: O(log(n)) Declaration public T Max() Returns Type Description T Min() Time complexity: O(log(n)) Declaration public T Min() Returns Type Description T NextHigher(T) Get the next higher to given value in this BST. Declaration public T NextHigher(T value) Parameters Type Name Description T value Returns Type Description T NextLower(T) Get the next lower value to given value in this BST. Declaration public T NextLower(T value) Parameters Type Name Description T value Returns Type Description T RemoveAt(Int32) Time complexity: O(log(n)) Declaration public T RemoveAt(int index) Parameters Type Name Description Int32 index Returns Type Description T Implements IEnumerable<>"
306306
},
307307
"api/Advanced.Algorithms.DataStructures.RTree.html": {
308308
"href": "api/Advanced.Algorithms.DataStructures.RTree.html",

docs/xrefmap.yml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6189,15 +6189,23 @@ references:
61896189
fullName.vb: Advanced.Algorithms.DataStructures.RedBlackTree(Of T)
61906190
nameWithType: RedBlackTree<T>
61916191
nameWithType.vb: RedBlackTree(Of T)
6192-
- uid: Advanced.Algorithms.DataStructures.RedBlackTree`1.#ctor(IEnumerable{`0})
6193-
name: RedBlackTree(IEnumerable<T>)
6194-
href: api/Advanced.Algorithms.DataStructures.RedBlackTree-1.html#Advanced_Algorithms_DataStructures_RedBlackTree_1__ctor_IEnumerable__0__
6195-
commentId: M:Advanced.Algorithms.DataStructures.RedBlackTree`1.#ctor(IEnumerable{`0})
6196-
name.vb: RedBlackTree(IEnumerable(Of T))
6197-
fullName: Advanced.Algorithms.DataStructures.RedBlackTree<T>.RedBlackTree(IEnumerable<T>)
6198-
fullName.vb: Advanced.Algorithms.DataStructures.RedBlackTree(Of T).RedBlackTree(IEnumerable(Of T))
6199-
nameWithType: RedBlackTree<T>.RedBlackTree(IEnumerable<T>)
6200-
nameWithType.vb: RedBlackTree(Of T).RedBlackTree(IEnumerable(Of T))
6192+
- uid: Advanced.Algorithms.DataStructures.RedBlackTree`1.#ctor(IEnumerable{`0},System.Boolean)
6193+
name: RedBlackTree(IEnumerable<T>, Boolean)
6194+
href: api/Advanced.Algorithms.DataStructures.RedBlackTree-1.html#Advanced_Algorithms_DataStructures_RedBlackTree_1__ctor_IEnumerable__0__System_Boolean_
6195+
commentId: M:Advanced.Algorithms.DataStructures.RedBlackTree`1.#ctor(IEnumerable{`0},System.Boolean)
6196+
name.vb: RedBlackTree(IEnumerable(Of T), Boolean)
6197+
fullName: Advanced.Algorithms.DataStructures.RedBlackTree<T>.RedBlackTree(IEnumerable<T>, System.Boolean)
6198+
fullName.vb: Advanced.Algorithms.DataStructures.RedBlackTree(Of T).RedBlackTree(IEnumerable(Of T), System.Boolean)
6199+
nameWithType: RedBlackTree<T>.RedBlackTree(IEnumerable<T>, Boolean)
6200+
nameWithType.vb: RedBlackTree(Of T).RedBlackTree(IEnumerable(Of T), Boolean)
6201+
- uid: Advanced.Algorithms.DataStructures.RedBlackTree`1.#ctor(System.Boolean)
6202+
name: RedBlackTree(Boolean)
6203+
href: api/Advanced.Algorithms.DataStructures.RedBlackTree-1.html#Advanced_Algorithms_DataStructures_RedBlackTree_1__ctor_System_Boolean_
6204+
commentId: M:Advanced.Algorithms.DataStructures.RedBlackTree`1.#ctor(System.Boolean)
6205+
fullName: Advanced.Algorithms.DataStructures.RedBlackTree<T>.RedBlackTree(System.Boolean)
6206+
fullName.vb: Advanced.Algorithms.DataStructures.RedBlackTree(Of T).RedBlackTree(System.Boolean)
6207+
nameWithType: RedBlackTree<T>.RedBlackTree(Boolean)
6208+
nameWithType.vb: RedBlackTree(Of T).RedBlackTree(Boolean)
62016209
- uid: Advanced.Algorithms.DataStructures.RedBlackTree`1.#ctor*
62026210
name: RedBlackTree
62036211
href: api/Advanced.Algorithms.DataStructures.RedBlackTree-1.html#Advanced_Algorithms_DataStructures_RedBlackTree_1__ctor_

src/Advanced.Algorithms/DataStructures/Tree/AvlTree.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ private AVLTreeNode<T> find(T value)
419419
return nodeLookUp[value] as AVLTreeNode<T>;
420420
}
421421

422-
return Root.Find<T>(value) as AVLTreeNode<T>;
422+
return Root.Find(value).Item1 as AVLTreeNode<T>;
423423
}
424424

425425
//find the node with the given identifier among descendants of parent and parent

src/Advanced.Algorithms/DataStructures/Tree/BST.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ private BSTNode<T> find(BSTNode<T> parent, T value)
395395
//O(log(n)) worst O(n) for unbalanced tree
396396
private BSTNodeBase<T> find(T value)
397397
{
398-
return Root.Find<T>(value) as BSTNodeBase<T>;
398+
return Root.Find<T>(value).Item1 as BSTNodeBase<T>;
399399
}
400400

401401
/// <summary>

src/Advanced.Algorithms/DataStructures/Tree/SplayTree.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ private SplayTreeNode<T> leftRotate(SplayTreeNode<T> currentRoot)
494494
//O(log(n)) worst O(n) for unbalanced tree
495495
private BSTNodeBase<T> find(T value)
496496
{
497-
return Root.Find<T>(value) as BSTNodeBase<T>;
497+
return Root.Find<T>(value).Item1 as BSTNodeBase<T>;
498498
}
499499

500500
/// <summary>

src/Advanced.Algorithms/DataStructures/Tree/TreapTree.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ private TreapTreeNode<T> leftRotate(TreapTreeNode<T> currentRoot)
489489
//O(log(n)) worst O(n) for unbalanced tree
490490
private BSTNodeBase<T> find(T value)
491491
{
492-
return Root.Find<T>(value) as BSTNodeBase<T>;
492+
return Root.Find<T>(value).Item1 as BSTNodeBase<T>;
493493
}
494494

495495
/// <summary>

0 commit comments

Comments
 (0)