Fundamentals of data structures: Vectors

From Wikibooks, open books for an open world
Jump to: navigation, search

PAPER 1 - ⇑ Fundamentals of data structures ⇑

← Dictionaries Vectors

A vector, in computing, is generally a one-dimensional array, typically storing numbers. Vectors typically have fixed sizes, unlike lists and queues.

The vector data structure can be used to represent the mathematical vector used in linear algebra. See related pages for mathematical vector operations. Vectors are often used in computing in computer graphics and simulating physical systems.

Vectors are also used in natural language processing in computing, as a compact way to represent documents as counts of occurrences of words. For instance, the two sentences "It was the best of times, it was the worst of times" and "It was the age of wisdom, it was the age of foolishness" could be represented as two vectors:

  "It was the best…" "It was the age…"
age 0 2
best 1 0
foolishness 0 1
it 2 2
of 2 2
the 2 2
times 2 0
was 2 2
wisdom 0 1
worst 1 0