4.2 Types of Data Structures Flashcards
What is a composite data type?
A data type that can group together multiple values of different types under a single name.
What are the two composite data types?
String, Array
What are abstract data types?
A logical description of how we view the data and possible operations.
3 Abstract data types
List, stack, queue
What are elementary data types
basic building blocks for representing data and used to define variables and specify the kind of values they can store
3 Elementary data types
Integer, real, boolean, char
Do arrays exist in python?
No, have to be imported by a library
Key differences between arrays and lists
Arrays: defined size, data is stored contiguously in memory
Lists: list is free to grow, values are stored in various locations in memory
What are Contiguos elements?
contiguous elements are positioned in a continuous, uninterrupted sequence
What type of data structure is a queue
FIFO (first in first out)
Functions needed for a linear queue
Add item to the rear of the queue
Remove item from the front of the queue
Check if the queue is empty
Check if the queue is full
What is enqueue and how is it acheived
Adding items to a queue
Check that queue is not full
Add to the value of the rear pointer
Then add the new item to the position indicated by the rear pointer.
What is dequeing and how is it achieved
Removing an item
Return value at the front of the queue and deleter or pop
Move remaining items up the queue one by one
Decrement the rear pointer.
Difference between circular and linear queues
Circular queues do not move items up when an item is dequeued.
What is different with the items in a priority queue
All items have a level of priority
What are static data structures and what is a example
Static data structures are fixed in size
Cannot grow, shrink, or be freed during execution
Array
What are abstract data structures
can grow or shrink.
Allocates and deallocates memory from the heap
What problem may come with abstract data structures
may cause overflow(exceeding maximum memory limit).