Paper 1 Flashcards
Recursion
Function that repeatedly calls itself until condition is met
3 essential characteristics:
- Stopping condition or Base Case
- Stopping condition must be met after a finite number of calls
- for all input value apart from the stopping condition the routine must call itself
Call Stack structure
Identifier
Parameter
Local Variables
Return Address
Abstract Data Types
Organising collection of data with particular features and access restrictions independent of any programming language
Dynamic data structure
Has a fixed size
Dynamic data structure
Can change size ( same size as number of values stored in it)
Stack commands
Peek
Pop
Push
IsEmpty
IsFull
Process
Instance of a program being ran
Each process allocated its own section of main memory by OS
Static memory allocation
Value has fixed size of that can be allocate space before running
Dynamic memory allocation
Some values are unknown about how much space is needed to store
Heap
Pool of unallocated memory ready to store data for objects
Data allocated dynamically and grows and shrinks in size as program runs and objects are created or unallocated
How to detect an empty queue ?
rearPointer = frontPointer = -1
Detect full queue ?
RearPointer = maxSize - 1
Priority Queue
Some items jump queue due to their importance