Data Structures Flashcards
Remember page 351 in text book for Data Structures
What is an Array
An array is an ordered, finite set of elements of a single type
What Type of Array is a Linear Array
A one-dimensional array
How can you visualise a two-dimensional array
A 2D array can be visualised as a table/spreadsheet and when searching this type of array, first go down the rows and then across the columns
How can you visualise a three-dimensional array
A 3D array can be visualised as a multi-page spreadsheet
An element in a 3D array uses: threeDimensionalArray[z,y,x]
z = array number, y = row number, x = column number
What is a Record
- A row in a file and is made up of fields
- Records are used in databases
- Each field in a record can be identified using the syntax
What is a List
A data structure consisting of a number of ordered items where the items can occur more than once
Describe the List Operations
What is a Tuple
An immutable (cannot be changed) ordered set of values of any type
How is a tuple initalised
Initialised with regular brackets rather than square brackets
What is a Static and Dynamic Data Structure
Static - fixed size
Dynamic - can keep growing
What is a Linked List
A linked list is a dynamic data structure used to hold an ordered sequence
How is a Linked List Organised
- The items in a linked list are not necessarily in contiguous data locations (the order they occur in the sequence)
- Each item in the list is called a node and contains a data field and a next address field called a point field
- The data field holds the actual data of the next list item and the pointer field holds the address of the next item
- Also the list has a pointer variable showing the first node in the list
What are the Disadvantages of using a Linked List
- They waste memory, storing pointers mean more memory is required compared to an array
- As items in linked lists are stored in a sequence, they can only be traversed in this order; an item cannot be directly accessed, as is possible in an array
Describe the three different types of Graphs
- Directed Graph - The edges can only be traversed in one direction
- Undirected Graph - The edges can be traversed in both directions
- Weighted Graph - A cost is attached to each edge.
Describe an example of an Adjacenecy Matrix
What are the Advantages and Disadvantages of the adjacency matrix
- Convenient to work with due to quicker access times
- Easy to add nodes
- Most graphs leave most of the cells empty meaning the larger the graph the more memory space will be wasted