4.2 (every spec covered) Flashcards
(106 cards)
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 a data structure behaves not how its implemented
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
enqueue
dequeue
peek
Check if the queue is empty
Check if the queue is full
What is enqueue and how is it acheived (4)
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 (4)
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
Memory cant be reallocated once the program is running.
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).
What is a stack
A stack is a last in, first out abstract data type
What is a matrix
An array of tables or values
What are the six methods required in a stack
push(item) - adds item to the top of the stack.
pop() - removes and returns the item on top of the stack.
isFull() - checks if the stack is full
isEmpty() - checks if the stack is empty
peek() - returns the top item without removing it from the stack.
size() - return the number of items on the stack.
What is stack overflow
attempting to push an item onto a stack that is full
what is stack underflow
attempting to pop from a stack that is empty
What is the call stack
data structure that provides the mechanism for passing parameters and return addresses to subroutines.