DATA STRUCTURES Flashcards
What is an array?
a variable that can contain more than 1 data item (a variation of a list)
What is the difference between lists and arrays?
lists are not contiguous whilst arrays are
What does contiguous mean?
all the data is stored together 1 element after the other
What is a record data structure?
- a collection of related fields (a variable
- each field in a record can have a different data type
What is a tupule?
a list that cant be changed once created (immutable)
What are the key properties of a list?
- mutable
- items can be changed or replaced
- can store more than 1 data type
What are the key properties of an array?
- mutable
- items can be changed or replaced
- can only store 1 data type
- length cant be changed (static)
What are the key properties of a tuple?
- immutable
- items cant be changed or replaced
- can store more than 1 data type
- length cant be changed (static)
What is a linked list?
- a data structure constructed from nodes and pointers
- provides a foundation upon which other structures can be built such as stacks, queues, graphs and trees
What identifies the first node in a linked list?
a start pointer
What does each node contain in a linked list?
- data
- a pointer to the next node
How are doubly linked lists made?
adding an extra pointer which causes the nodes to point to the previous and next items
How are circular linked lists made?
making the last node point to the 1st node
How are doubly circular linked lists made?
each node in a circular linked list has an additional pointer pointing to the previous item
How can a linked list be implemented?
- using an array
- using objects
What are the applications of linked lists?
- used by OS managing a processor to store process blocks in a ready state
- used by image viewers to switch between previous and next images
- used by music players to store tracks in a playlist
- used by web browsers to navigate backwards and forwards
- used for hash table collision resolution as an overflow
- used for maintaining a file allocation table of linked clusters on secondary storage
What operations can be performed on a linked list?
- add (adds a node to the linked list)
- delete (removes a node from the linked list)
- next (moves to the next item in the list)
- previous (moves to the previous item in a doubly linked list)
- traverse (a linear search through the linked list)
What is a graph?
a data structure consisting of nodes/vertices and pointers/edges
How does a graph differ from a linked list and binary tree?
each vertex can have more than 2 edges and point to any vertex in the data structure
What is a directed graph?
a graph in which the edges point in 1 direction
What is an undirected graph?
a graph in which the edges don’t point in a specified direction
What does it mean if a graph is weighted?
each edge has a value representing a relationship between the vertices
How can graphs be stored?
- typically stored as objects/using a dictionary (known as adjacency lists)
- can also be stored as an array (known as an adjacency matrix) (a 1 represents an edge existing between 2 vertices)
What are the applications of a graph?
- mapping road networks for navigation systems
- storing social network data
- resource allocation in operating systems
- representing molecular structures and geometry
What is abstraction?
using only the necessary detail and discarding unnecessary detail