4.2 (DATA STRUCTURES) Flashcards
Properties of an array
Hidden index - Array[0]
defined scope- defined size
Properties of a record/ database
Data unordered but can be ordered using primary keys and can also be organised with attributes
Properties of a list
Ordered set of data, organised by index value
Properties of a tuple
A tuple is an ordered set of values of any type
It is immutable, this means that it can’t be changed
Name the operations that can be done to a list (8)
list.isEmpty()
list.append(value)
list.remove(value) —Removes the value the first time it appears in the list
del list[index]
len(list)///list.length()
list.index(value)— Returns the position of the given item
list.insert(position,value)
list.pop()—Removes and returns the last value
Properties of a stack
A stack is a last in first out (LIFO) data structure
Items can only be added to or removed from the top of the stack
Properties of a linked list
The first data pointer
First free data pointer
Each element has an index and a pointer to the next data location
Properties of queue
A queue is a First in First out (FIFO) data structure
Items are added to the end of the queue and removed from the front
Queue operations (5)
enQueue(value) - Adding an element to the back of the queue
deQueue() - Returning an element from the front of the queue
peek() - Return the value of the item from the front of the queue without removing it from the queue
isEmpty() - Check whether the queue is empty
isFull() - Check whether the queue is full (if the size has a constraint)
Stack operations
size() - returns size
push(value) - adds value to the top of the stack
pop() - return and removes the value from the top of the stack
peek() - Return the value of the item from the front of the queue without removing it from the queue
isEmpty() - Check whether the queue is empty
isFull() - Check whether the queue is full (if the size has a constraint)