Free Online Flashcard Deck

05 — Data Structures Free Online FlashCards

Study 05 — Data Structures with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.

12 cards
01
Front

What is a data structure?

Back

A data structure organizes and stores data so programs can use it efficiently. Its design makes some operations easier and others more expensive.

02
Front

Why is array indexing typically O(1)?

Back

Arrays provide typically O(1) indexed access because an element’s address can be calculated from the array’s starting address and its index.

03
Front

Why can middle updates be costly in arrays?

Back

Inserting or deleting near an array’s beginning or middle may require shifting many elements, making the operation O(n).

04
Front

How does a linked list store its elements?

Back

A linked list stores values in separate nodes connected by references. Its nodes do not need to occupy adjacent memory locations.

05
Front

What removal rule does a stack follow?

Back

A stack removes the most recently inserted item first: it follows last in, first out (LIFO).

06
Front

What removal rule does a queue follow?

Back

A queue removes the earliest inserted item first: it follows first in, first out (FIFO).

07
Front

How does a tree differ from a general graph?

Back

A tree is connected and contains no cycles, whereas a general graph may contain cycles and need not have a single hierarchical root.

08
Front

What ordering rule defines a binary search tree?

Back

In a binary search tree, values in the left subtree are smaller than the node’s value and values in the right subtree are larger, assuming unique keys.

09
Front

How does a hash table locate a value?

Back

A hash table uses a hash function to transform a key into an array index, allowing average-case O(1) key lookup with a suitable table and hash function.

10
Front

What is a hash-table collision?

Back

A collision occurs when different keys produce the same hash-table index. Chaining and open addressing are two ways to handle collisions.

11
Front

What are the costs of an adjacency matrix?

Back

An adjacency matrix uses a two-dimensional array; edge lookup is O(1), but the representation uses O(V²) space.

12
Front

When is an adjacency list useful?

Back

An adjacency list stores each vertex’s neighboring vertices. It uses O(V + E) space and is efficient for traversing neighbors in sparse graphs.