Data Structures


Data structures are ways of organizing memory so that large amounts of data can be managed efficiently. Usually, efficient data structures are a key in designing efficient algorithms. Basic has several of the most common data structures built in and ready to be used. The following functions create those data structures.


CreateArrayList()


CreateHashTable()


CreateQueue()


CreateSparseArray()


CreateStack()


To make things easy, all the built in data structures are controlled by six commands and functions.

Put structure, variable {,index | key$}

Get structure, variable {,index | key$}

- Put and Get a variable to and from a data structure.

The first parameter, structure, is an object variable that points to the data structure. This structure is returned by one of the create functions listed above.

The second parameter may be any type of variable. Expressions are not allowed in the second parameter, only whole variables.

The third parameter varies depending on which type of data structure is being used (see the create functions above).

Remove structure, variable {,index | key$}

- This command works like a get, but the variable is removed from the data structure afterwards.

size = getSize(structure)

- Returns the current number of elements in the given data structure.

type = getType(structure{,index | key$})

- Returns the type of variable at the given position. This functions can always be used to determine if an element exists in a data structure.

0 = variable does not exist.
1 = numeric variable
2 = numeric array
3 = reserved
4 = reserved
5 = string variable
6 = string array
7 = Object Variable
8 = Object Array

objType = getObjType(structure{,index | key$})

- Returns the type of object variable at the given position.

0 = Variable is not an object or does not exist
1 = SQL Cursor
2 = Bitmap
3 = Cholesky Decomposition
4 = Eigenvalue Decomposition
5 = LU Decomposition
6 = QR Decomposition
7 = Singular Value Decomposition
8 = ArrayList
9 = HashTable
10 = Queue
11 = SparseArray
12 = Stack






Become a Patron