1.4- data structures Flashcards
defined as a particular scheme of organizing related data items.
The nature of the data items is dictated by the problem at hand; they can range
from elementary data types (e.g., integers or characters) to data structures (e.g., a
one-dimensional array of one-dimensional arrays is often used for implementing
matrices).
data structure
____ is a sequence of n items of the same data type that are stored contiguously in computer memory and made accessible by specifying a
value of the array’s _____
array
index
Strings composed of zeros
and ones are called ____ ____ or bit strings. Strings are indispensable for processing textual data, defining computer languages and compiling programs written
in them, and studying abstract computational models.
binary strings
Operations we usually perform on strings differ from those we typically perform on other arrays (say, arrays
of numbers). They include computing the string length, comparing two strings to
determine which one precedes the other in _____ (i.e., alphabetical) order, and concatenating two strings (forming one string from two given strings by
appending the second to the end of the first).
lexicographic
sequence of zero or more elements called nodes, each
containing two kinds of information: some data and one or more links called
pointers to other nodes of the linked list.
linked list
each node except the last one contains a single pointer to the next element
singly linked list
To access a particular_____ of a linked list, one starts with the list’s first node
and traverses the pointer chain until the particular node is reached. Thus, the time
needed to access an element of a singly linked list, unlike that of an array, depends
on where in the list the element is located.
node
start a linked list with a special node called the _____. This node may contain information about the linked list itself, such as its
current length; it may also contain, in addition to a pointer to the first element, a
pointer to the linked list’s last element.
header
in which every
node, except the first and the last, contains pointers to both its successor and its
predecessor
doubly linked list
stack
a list in which insertions and deletions can be done only at the end. This
end is called the top because a stack is usually visualized not horizontally but
vertically—akin to a stack of plates
a list from which elements are deleted from
one end of the structure, called the front (this operation is called dequeue),
and new elements are added to the other end, called the rear (this operation is
called enqueue). Consequently, a queue operates in a “first-in–first-out” (FIFO)
fashion
queue
a collection of data items from a totally ordered universe (most often, integer or real numbers). The principal operations on a priority queue are finding its largest element, deleting its largest element, and adding a new element.
Of course, a priority queue must be implemented so that the last two operations
yield another priority queue.
priority
a graph G = <V,E>
is defined by a pair of two sets: a finite nonempty set V of items called vertices
and a set E of pairs of these items called ____-. If these pairs of vertices are
unordered, i.e., a pair of vertices (u, v) is the same as the pair (v, u), we say that
the vertices u and v are adjacent to each other and that they are connected by the
_____ _____ (u, v). We call the vertices u and v endpoints of the edge (u, v)
and say that u and v are incident to this edge; we also say that the edge (u, v) is
incident to its endpoints u and v. A graph G is called undirected if every edge in
it is undirected.
edges
undirected edge
Graph:
If a pair of vertices (u, v) is not the same as the pair (v, u), we say that the
edge (u, v) is _____ from the vertex u, called the edge’s ____, to the vertex v,
called the edge’s head. We also say that the edge (u, v) leaves u and enters v. A
graph whose every edge is directed is called directed. Directed graphs are also
called digraphs
directed
tail
A graph with every pair of its vertices connected by an edge
complete
A standard notation for the complete graph with |V | vertices is|K|{V}. A graph
with relatively few possible edges missing is called _____
dense
a graph with few edges relative to the number of its vertices is called _____
sparse
The _____ _____of a graph with n vertices is an n × n boolean matrix with one row and one
column for each of the graph’s vertices, in which the element in the ith row and
the j th column is equal to 1 if there is an edge from the ith vertex to the j th vertex,
and equal to 0 if there is no such edge.
adjacency matrix