PRELIM Flashcards
Collection of raw facts.
Data
Representation of the
logical relationship existing between
individual elements of data.
Data structure
Basic structures directly operated upon
by machine instructions.
Primitive Data Structure
Primitive Data Structure Examples
Integer, Floating-point
number, Character constants, String
constants, Pointers, etc.
Initializing or declaring a new
data structure (e.g., creating an integer
or a float).
. Create
More sophisticated structures derived
from primitive data structures.
Non-Primitive Data Structure
Accessing or retrieving a
specific element from the structure (e.g.,
selecting a particular value stored in an
integer variable).
Selection
Modifying the value of an
existing element (e.g., changing the
value of a variable).
Updating
Removing a data
element or deallocating the memory
used by the data structure (e.g., deleting
or clearing a variable).
Destroy/Delete
Accessing each element in
the data structure exactly once to
process it (e.g., going through a list or
array to print its elements).
Traverse
Combining two data structures
into one, often while maintaining a
specific order (e.g., merging two sorted
arrays into one sorted array).
Insert
Finding the location of a
specific element in the structure (e.g.,
searching for a value in an array or a
node in a tree).
Search
Arranging elements in a particular
order, such as ascending or descending
(e.g., sorting an array of integers).
Sort
Combining two data structures
into one, often while maintaining a
specific order (e.g., merging two sorted
arrays into one sorted array).
Merge
Operations on
Primitive Data Structures
Create:
Selection
Updating
Destroy/Delete
Operations on
Non-Primitive Data Structures
Create
Traverse
Insert
Delete
Search
Sort:
Merge
Destroy/Delete
A linear array with one row or
column.
One-dimensional array
A set of finite homogeneous
elements (same data items).
Array
A matrix-like array with rows and
columns.
Two-dimensional array
Arrays with multiple subscripts.
Multi-dimensional array
A linear data structure where the
operations are performed in LIFO (Last In, First Out) order.
Stack
Adds a new item to
the top of the stack
push(item)
Removes the top item
from the stack.
pop()
Returns the top item
without removing it.
peek()
Tests whether the
stack is empty.
isEmpty()
Returns the number of
items in the stack.
size()
Can be implemented
using arrays (static) or pointers (dynamic).
Implementation
Insertion occurs
at the rear, and deletion occurs
at the front.
Simple Queue
is an ordered collection of items
where an item is inserted at the rear and an existing item is removed at the front (FIFO - First In, First Out).
Queue
The last node
connects back to the first node,
forming a circle.
Circular Queue
Items are
inserted and removed based on
priority
Priority Queue
Insertion and deletion
can happen at both ends.
Dequeue
Adds a new
item at the rear of the queue
enqueue(item)
Removes an item
from the front.
dequeue()
Tests whether the
queue is empty
isEmpty()
Returns the number of
items in the queue.
size()
collection of variable number of
data items called nodes
Linked Lists
Each node
points to the next node.
Single Linked List
Each node
points to both the next and the
previous node.
Doubly Linked List
The last
node points back to the first
node.
Circular Linked List
A hierarchical data structure
consisting of nodes connected by
edges.
Tree
A tree in which each
internal node can have a maximum of
two child nodes.
Binary Tree
All leaf
nodes are at the same level.
Complete Binary Tree
is a non-linear data
structure consisting of vertices (nodes)
and edges (connections between
nodes).
Graph
Edges have
direction.
Directed Graph
Edges do
not have direction.
Undirected Graph
Edges have
weights.
Weighted Graph
No multiple
edges or loops.
Simple Graph
There is a
path between any two vertices.
Connected Graph
Some
vertices are not connected.
Non-connected Graph
A collection of nodes, where
each node contains two parts: the
information and a link to the next node.
Lists
An operator
precedes the two operands
Prefix Expression
An operator is
between two operands
Infix Expression
An operator
follows the two operands
Postfix Expression