1.4- data structures Flashcards

1
Q

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).

A

data structure

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

____ 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 _____

A

array
index

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

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.

A

binary strings

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

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).

A

lexicographic

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

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.

A

linked list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

each node except the last one contains a single pointer to the next element

A

singly linked list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

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.

A

node

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

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.

A

header

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

in which every
node, except the first and the last, contains pointers to both its successor and its
predecessor

A

doubly linked list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

stack

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

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

A

queue

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

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.

A

priority

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

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.

A

edges
undirected edge

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

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

A

directed
tail

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

A graph with every pair of its vertices connected by an edge

A

complete

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

A standard notation for the complete graph with |V | vertices is|K|{V}. A graph
with relatively few possible edges missing is called _____

A

dense

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

a graph with few edges relative to the number of its vertices is called _____

A

sparse

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

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.

A

adjacency matrix

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

The ____ ____ of a graph or a digraph is a collection of linked lists,
one for each vertex, that contain all the vertices adjacent to the list’s vertex
(i.e., all the vertices connected to it by an edge). Usually, such lists start with a
header identifying a vertex for which the list is compiled.

A

adjacency lists

20
Q

a graph (or digraph) with numbers assigned to its edges. These numbers are called weights or
costs. An interest in such graphs is motivated by numerous real-world applications, such as finding the shortest path between two points in a transportation or
communication network or the traveling salesman problem

A

weighted graph

21
Q

If a weighted graph is represented by its adjacency matrix,
then its element A[i, j ] will simply contain the weight of the edge from the ith to
the j th vertex if there is such an edge and a special symbol, e.g., ∞, if there is no
such edge. Such a matrix is called the _____ matrix or cost matrix.

A

weight

22
Q

connectivity and acyclicity. Both are based on the notion of a path. A path from vertex u to vertex v of a graph G can be defined as a
sequence of adjacent (connected by an edge) vertices that starts with u and ends
with v. If all vertices of a path are distinct, the path is said to be simple. The ____ of a path is the total number of vertices in the vertex sequence defining the path ____ 1, which is the same as the number of edges in the path.

A

length
minus

23
Q

directed path

A

a sequence of vertices in which every consecutive pair of the
vertices is connected by an edge directed from the vertex listed first to the vertex
listed next.

24
Q

A graph is said to be ____ if for every pair of its vertices u and v there
is a path from u to v. If we make a model of a connected graph by connecting
some balls representing the graph’s vertices with strings representing the edges,
it will be a single piece. If a graph is not connected, such a model will consist
of several connected pieces that are called connected components of the graph.

A

connected

25
Q

A ______ ______ is a maximal (not expandable by including another vertex and an edge) connected subgraph of a given graph.

A

connected component

26
Q

a path of a positive length that starts and ends at
the same vertex and does not traverse the same edge more than once.

A

cycle

27
Q

A graph with no cycles

A

acyclic

28
Q

(more accurately, a free tree) is a connected acyclic graph

A

tree

29
Q

A graph that has no cycles but is not necessarily connected is called a______: each of its connected components is a tree

A

forest

30
Q

A _______ of a given graph G = <V, E> is a graph G’ = <V’, E’> such that V’ subset of V and E’ subset of E

A

subgraph

31
Q

for every two vertices in a tree, there always exists exactly one simple path from one of these
vertices to the other. This property makes it possible to select an arbitrary vertex
in a free tree and consider it as the ____ of the so-called rooted tree

A

root

32
Q

A rooted tree
is usually depicted by placing its root on the top (level __ of the tree), the vertices
adjacent to the root below it (level 1), the vertices two edges apart from the root
still below (level 2), and so on.

A

0

33
Q

For any vertex v in a tree T , all the vertices on the simple path from the root
to that vertex are called ____ of v.
vertices on the simple path from the root
to that vertex are called ancestors of v. The vertex itself is usually considered its
own ancestor; the set of ancestors that excludes the vertex itself is referred to as
the set of _____ ____. If (u, v) is the last edge of the simple path from the
root to vertex v (and u = v), u is said to be the parent of v and v is called a child
of u; vertices that have the same parent are said to be siblings.

A

ancestors
proper ancestors

34
Q

A vertex with no children is called a leaf ; a vertex with at least one child is called ______. All the vertices for which a vertex v is an ancestor are said to be descendants of v; the
____ _____ exclude the vertex v itself. All the descendants of a vertex v
with all the edges connecting them form the subtree of T rooted at that vertex.

A

parental
proper descendants

35
Q

the length of the simple path from the root to v.

A

depth

36
Q

the length of the longest simple path from the root to a leaf.

A

heigh of tree

37
Q

a rooted tree in which all the children of each
vertex are ordered. It is convenient to assume that in a tree’s diagram, all the
children are ordered left to right.

A

ordered tree

38
Q

an ordered tree in which every vertex has
no more than two children and each child is designated as either a left child or a
right child of its parent; a binary tree may also be empty.

A

binary tree

39
Q

an unordered collection (possibly empty) of distinct items called elements of the set

A

set

40
Q

The most important set
operations are: checking membership of a given item in a given set; finding the
union of two sets, which comprises all the elements in either or both of them;

A

and
finding the intersection of two sets, which comprises all the common elements in
the sets.

41
Q

Sets can be implemented in computer applications in two ways. The first
considers only sets that are subsets of some large set U, called the _____ _____

A

universal set

42
Q

If set U has n elements, then any subset S of U can be represented by a bit string of size n, called a ____ _____, in which the ith element is 1 if and only if the ith element of U is included in set S.

A

bit vector

43
Q

In computing, the operations we need to perform for a set or a multiset most
often are searching for a given item, adding a new item, and deleting an item
from the collection. A data structure that implements these three operations is
called the _____

A

dictonary

44
Q

A number of applications in computing require a dynamic partition of some
n-element set into a collection of disjoint subsets. After being initialized as a
collection of n one-element subsets, the collection is subjected to a sequence
of intermixed union and search operations. This problem is called the ___ ____ _____

A

set union problem

45
Q

a set of abstract objects representing data items with a collection of operations that can be performed on them. As
illustrations of this notion, reread, say, our definitions of the priority queue and
dictionary. Although abstract data types could be implemented in older procedural languages such as Pascal (see, e.g., [Aho83]), it is much more convenient to
do this in object-oriented languages such as C++ and Java, which support abstract
data types by means of classes.

A

abstract data type (ADT)