Data Structures Flashcards
(35 cards)
What is a compound or complex data type?
When existing data types are combined to create a new data type
What is a data structure?
An organised collection of data that can be processed more easily
What is a static data structure?
A certain amount of memory is reserved for the data structure when it is created
What is a dynamic data structure?
Memory efficient data structure as memory is used when needed and only limited to the memory allocation of the program (the heap)
What type of data structure is a stack?
A First In Last Out (FILO) data structure
What is used to reference the value at the top of the stack?
A pointer variable holding the index of the value
What type of data structure is a queue?
A First In First Out (FIFO) data structure
How are pointers used in a queue?
There are front and rear pointers that hold the indexes of the front and rear values
What is a priority queue?
Adds values at different priority levels in a queue instead of in the order they are added
What is the heap?
A large chunk of unallocated RAM that can be used by dynamic data structures
What is the purpose of a circular queue?
Solves the problem that occurs when the end of a queue is reached and there empty spaces but data can’t be added
How does a dictionary store data?
As key-value pairs
What is the main advantage of using keys in data structures such as dictionaries?
They allow direct access which is quicker to access than unordered data
How are dictionaries often implemented using?
Hash tables
What are buckets in a hash table?
A position in the hash table array
What is the load factor in a hash table?
The proportion of buckets occupied, the optimal is 0.75
How is the load factor of a hash table calculated?
Number of occupied buckets / total number of buckets
What is a hash function?
An algorithm that converts a hash key to a hash value
What are the two main methods of avoiding collisions in a hash table?
Linear probing and chaining
When is rehashing needed in a hash table?
When performance degrades due to many values being added or deleted
What are rainbow tables?
Tables that store pre-hashed values of possible passwords
What is a random salt?
A random piece of data added to a password before they are hashed that is stored with the user id
What does a graph represent?
Complex, non-linear relationships (edges) between objects (nodes)
What are directed graphs?
Graphs with edges represented with arrows to show which direction the nodes can be visited