4.2 (DATA STRUCTURES) Flashcards

1
Q

Properties of an array

A

Hidden index - Array[0]
defined scope- defined size

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Properties of a record/ database

A

Data unordered but can be ordered using primary keys and can also be organised with attributes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Properties of a list

A

Ordered set of data, organised by index value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Properties of a tuple

A

A tuple is an ordered set of values of any type

It is immutable, this means that it can’t be changed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Name the operations that can be done to a list (8)

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Properties of a stack

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Properties of a linked list

A

The first data pointer
First free data pointer
Each element has an index and a pointer to the next data location

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Properties of queue

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Queue operations (5)

A

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)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Stack operations

A

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)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly