Data structures Flashcards
Array?
A data structure that hold a number of data items of the same data type
Record?
Data structure that consists of a fixed number of variables called fields
List?
Abstract data type that describes a linear collection of data items
Tuple?
Collection of elements that is immutable
Stack
First in last out, first item to enter is the last to leave
Examples of stacks
Stack of plates
Web browser history
Call logs
2 computer based uses for stacks
Manage memory location
Store temporary variables created by a function
Operations that can be performed on stacks
Push
Pop
Peak
Is empty
Is full
Describe role of the top pointer in stack
Let’s the user know if the stack is full
Queue
First in first out data structure
3 Examples of a queue real life
Actual queue at supermarket
On the music app
Printer receiving jobs
Operations that can be performed on queue
Enqueue
Dequeue
Is empty
is full
Describe how a circular Queue works
There is a fix number, and it is still static the once it has been dequeued It can be replaced and wraps around in a circle.
And advantage of a circular Queue over linear
It can keep going around in a circle
Linked list
An abstract data type similar to queue or stack, a dynamic data structure.
Operation performed on a linked list
Add
Delete
Next
Previous
Traverse
Uses for linked list
Doesn’t waste memory
Implement stacks, or queues
Effective in insertion and deletion
Graph?
Abstract data type that can be used to represent non-linear relationships between objects
Node?
Basic unit of structure
Node degree
The number of other nodes it is connected to
Loop?
An edge that connects a node to itself
Path?
Sequence of nodes that are connected by edges
Cycle ?
A closed path starts and ends at the same path
Difference between a directed and undirected graph
Undirected graph does not show the direction between nodes
What is a weighted graph
These are values associated with the edges
Tree?
A connected undirected graph with no cycles
Rooted tree?
One node has been designated as the root
Binary tree
Every node has at most two child nodes