Common Structures
View Code
Array
- Array/Vector
- a structure type which holds several values of one data type
- Loops are very useful for processing arrays.
- Index/Element
- a specific value from the array
- Arrays are offset by one, their indexes start counted by zero, one,
two, etc.
- Length/Size
- the number of elements in an array, also known as size
- Static
- a type of array that cannot change its length
- Most languages have static arrays.
- Dynamic
- a type of array that can change its length
- Parellel
- a two arrays processed together in which elements corespond
- This is a useful techinique to process paired data, e.g.
the first element holds my name then yours, in the other array the
first element holds my age then your age.
String
- String
- an array of characters
- Basically a string is a bunch of characters, which can be thought of a
"word".
- In newer languages strings are already defined. However one can easily
be made by defining an "array of characters".
- Most strings are treated like vectors, being able to acess the characters
like an element of a array.
- Length/Size
- the number of characters in an array
- Substr
- a common function used to get different a different section of the
- Find
- a common function use to find strings or characters in a string
- Concatination
- a function used to join strings together
- This is big term often used to impress people. Basically it is adding
strings together, like "Sky" + "gorigia" returns "Skygorgia".
- Compare
- a common function to compare strings
- Strings are compared by their ASCII values of the charactres. If the
first characters are the same, then the second character, an so on. If
all the characters are the same then they are equall. If the sizes are
different then the longer one is greater.
- The ASCII values of the strings are nicely sorted. A's are greater
than B's, etc. and uppercase is greater than lower case.
Matrixes
- Matrix
- an array of arrays, a mutiple dimension array
- What a mouthful. Let's say you have an array of numbers, and call it a
list, now a matrix would be an array of lists.
- It is easy to think of a matirx as grid of the elements.
- When acessing matrixes elements, it is row then column.
- Matrixes are often only two-dimensions, but then can go further if you
implement them correctly.
- Row
- the first access of a matrix to get an array
- Column
- the second acces of a matrix, to ge the element
Prev --
Back to Portal --
Next