Class ArrayBasedDataStructure<T>
Exposes properties shared by data structures based on a backing array of items of type T
.
Inherited Members
Namespace: MoreStructures.Stacks
Assembly: MoreStructures.dll
Syntax
public abstract class ArrayBasedDataStructure<T>
Type Parameters
Name | Description |
---|---|
T | The type of items, the data structure is composed of. |
Constructors
| Improve this Doc View SourceArrayBasedDataStructure(Int32, Double)
Initializes the data structure with an array list of initial capacity equals to the provided
capacity
.
Declaration
protected ArrayBasedDataStructure(int capacity = 16, double increasingFactor = 2)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | capacity | The initial capacity of the backing array. If not specified, DefaultInitialCapacity is used. |
System.Double | increasingFactor |
Fields
| Improve this Doc View SourceDefaultIncreasingFactor
The default value for IncreasingFactor.
Declaration
public const double DefaultIncreasingFactor = 2
Field Value
Type | Description |
---|---|
System.Double |
DefaultInitialCapacity
The default initial size of the array backing the data structure.
Declaration
public const int DefaultInitialCapacity = 16
Field Value
Type | Description |
---|---|
System.Int32 |
Remarks
In an array initialized with capacity x, up to x insertions can be done in constant time, with no need for array resizing.
Properties
| Improve this Doc View SourceIncreasingFactor
The multiplicative factor used to resize the underlying array, every time it gets full.
Declaration
public double IncreasingFactor { get; }
Property Value
Type | Description |
---|---|
System.Double |
Remarks
Required to be bigger than 1.0.
Items
The array of items, backing this data structure.
Declaration
protected T[] Items { get; set; }
Property Value
Type | Description |
---|---|
T[] |
Methods
| Improve this Doc View SourceResizeItems(Double)
Resizes the Items array, applying the provided factor
to its length.
Declaration
protected virtual void ResizeItems(double factor)
Parameters
Type | Name | Description |
---|---|---|
System.Double | factor | The multiplicative factor to be applied to the length of the array. |