Back to marketplace

1.4.2 Data Structures

No description yet. This curated deck is ready for daily study.

Total cards: 24•Content version: v4•Public deck•Updated: 8/1/2026

Card preview (24)

#1
Front (Question)

Array

Back (Answer)

• a static data structure in which data is stored in continuous, Adjacent memory locations [1] • can only store one data type [1] • provides direct access to elements • are usually zero indexed

#2
Front (Question)

Record

Back (Answer)

• is a row in a file and is made up of fields • is widely used in databases • can be implemented using OOP in python

#3
Front (Question)

Tuple

Back (Answer)

• a static data structure • An ordered collection of elements that can contain multiple data types • is immutable - so elements can’t be added or removed once it has been created [1] • are initialised using regular brackets instead of square ones

#4
Front (Question)

Static Datastrcute

Back (Answer)

Size can’t change during processing [1]

#5
Front (Question)

Dynamic data structure

Back (Answer)

• size can change during processing [1] • disadvantage : storage requirements are unknown initially [1]

#6
Front (Question)

What are linked lists?

Back (Answer)

• a dynamic data structure used to hold an ordered sequence [1] • each item/node consist of a data field and a pointer field [1] • data field contains the actual data • pointer field gives the location of the next node/item in the list [1] • linked list needs to be traversed until desired element is found [1] • takes longer to search (as more nodes are added) [1]

#7
Front (Question)

Linked lists + array comparison

Back (Answer)

• array provides direct access to all elements [1] whereas a linked list needs to be traversed until desired element is found [1] • contents of an array are stored continuously in memory [1] • whereas contents of linked list do not have to be in continuous data locations [1]

#8
Front (Question)

Linked list operations

Back (Answer)

• adding node • deleting node • traversing linked list

#9
Front (Question)

Linked list traversal

Back (Answer)

• is used to access each element of the linked list • first position is indicated by the start pointer [1] • linked list can be traversed by following each items next pointer until the end of the list is located (null) • pointer = null means end of list has been reached

#10
Front (Question)

Linked list : adding node

Back (Answer)

• advantage: nodes can be added or removed easily by editing the pointers 1. Allocate memory and create new node containing the data [1] 2. Change the new node to point to the previous nodes next node [1] 3. Change the previous nodes next node to point to the new node [1] • if the new node is added to the start change its pointer to point to the head node • if added at the end let it point to null

#11
Front (Question)

Linked list: Removing node

Back (Answer)

• involves updating nodes to bypass the deleted node • node is not truly removed but ignored instead which wastes memory • so to delete a node, change the next pointer of the previous node to bypass the node being deleted and instead point to the next node • linked list requires more memory than arrays due to storing pointers

#12
Front (Question)

Stack

Back (Answer)

• is a LIFO data structure [1] • items can only be added or removed from the top of the stack • stacks are used to reverse actions eg back buttons and undo buttons use stacks • stacks use a pointer which points to the top of the stack • when initialising stack we set TOP pointer = -1 • thus is stack is empty TOP = -1

#13
Front (Question)

Stack operations

Back (Answer)

• push(value) • pop() • isEmpty() • isfull() • Size()

#14
Front (Question)

Push(value)

Back (Answer)

• adds an element to the top of the stack (checks if stack is full first) • once value is pushed, the top pointer is incremented by 1 • attempting to push an item onto a full stack is called stack overflow

#15
Front (Question)

Pop()

Back (Answer)

• removes and returns value at the top of the stack (checks if stack is empty first) • once popped, the pointer is decremented by 1 • attempting to pop an item from an empty stack is called stack underflow

#16
Front (Question)

IsEmpty()

Back (Answer)

• checks if stack is empty • eg if Top == -1 return true • or return len(stack) == 0

#17
Front (Question)

Isfull()

Back (Answer)

• Checks jf stack is full • compares stack size to the top pointer • if len(stack) == Top return true

#18
Front (Question)

Size()

Back (Answer)

Returns size of the stack

#19
Front (Question)

Queues

Back (Answer)

• a FIFO data structure • in which items are added at the end of the queue • and items are removed from the front of the queue • Consist of a head and tail pointer • similar to stacks there is also queue overflow and queue underflow

#20
Front (Question)

Types of queue

Back (Answer)

• linear queue • circular queue • priority queue

#21
Front (Question)

Queue operations

Back (Answer)

• Enqueue(value) • dequeue() • peek() • isfull() • isempty()

#22
Front (Question)

Enqueue (initially set value of head and tail pointer = -1 ) (for the first element increment both head and tail pointer to 0)

Back (Answer)

• adds element to the back of the queue 1. Check if queue is full 2. Increment tail pointer and add the new element in the position pointed by the tail 3. Head pointer stays the same

#23
Front (Question)

Dequeue ( for dequeuing the last element, reset the values of the head and tail to -1 )

Back (Answer)

• returns an elements from the front of a queue 1. Check that queue is not empty 2. Return item at the front of the queue and then increment the head pointer by 1

#24
Front (Question)

PeeK()

Back (Answer)

Returns the value of the item at the front of the queue without removing it from the queue