Data Structures

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/27

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

28 Terms

1
New cards

data structure

a common format for storing large volumes of related data, which is an implementation of an abstract data type in a particular programming language

2
New cards

abstract data type

a conceptual model of how data can be stored and the operations that can be carried out on the data

3
New cards

array

a finite set of related elements of the same data type, where each element can be individually indexed and accessed based on its position

4
New cards

static data structure

a method of storing data where the amount of data stored, and the memory used to store it, is fixed

5
New cards

dynamic data structure

a method of storing data where the amount of data stored, and the memory used to store it, will vary as the program is being run

6
New cards

advantages of static data structures

  • fast accessing because memory location is fixed when the program is written and memory addresses are contiguous

  • more predictable to work with

  • easier to program because no need to worry about size-checking or memory overflow

7
New cards

advantages of dynamic data structures

  • efficient memory usage because they only allocates the memory they actually need, minimising memory wastage

  • flexible because they can grow or shrink as needed, accommodating changes in data volume

8
New cards

disadvantages of static data structures

  • can waste memory if the number of data items stored is small relative to the size of the structure

  • if allocated memory is too small, it can lead to overflow errors

  • require more complex operations to insert or delete elements

9
New cards

disadvantages of dynamic data structures

  • slower accessing because memory location is allocated at run-time and memory addresses may be fragmented

  • require a mechanism to know the size of the current structure

  • performance is less predictable

10
New cards

adjacecy list

a data structure that stores a list of nodes with their adjacent nodes

11
New cards

adjacency matrix

a data structure set up as a two-dimensional array or grid that shows whether there is an edge between each pair of nodes

12
New cards

advantages of adjacency lists

  • only store the connections that actually exist, making them highly efficient for sparse graphs

  • easy to implement

13
New cards

advantages of adjacency matrices

  • adjacencies can be identified more quickly as every combination is already stored- forms a look-up table of each node to every other node

  • adding or removing edges can be done in constant time

14
New cards

disadvantages of adjacency lists

  • adding or removing a vertex can be time-consuming- you need to update all the adjacency lists to reflect the change

  • list has to be parsed to identify whether particular adjacencies exist, which increases time taken to process the data

15
New cards

disadvantage of adjacency matrices

  • significant amount of memory is wasted storing connections that don't exist in a sparse graph

16
New cards

when is an adjacency list more suitable

  • sparse graph

  • when edges are rarely changed

  • when presence/absence of specific edges does not need to be tested frequently

17
New cards

features of trees

  • root node

  • no cycles

18
New cards

hash table

a data structure that stores key/value pairs based on an index calculated from an algorithm

19
New cards

hashing algorithm

code that computes an address within a specified range from the key

20
New cards

collision

when a hashing algorithm produces the same index for two or more different keys

21
New cards

clustering

when a hashing algorithm produces indices that are not randomly distributed

22
New cards

load factor

number of keys / number of slots

23
New cards

chaining

a technique for generating a unique index when there is a collision by adding the key/value to a list stored at the same index

24
New cards

rehashing

  • when a hash table becomes too full or collisions become too frequent

  • new, larger hash table created (typically double the size)

  • the existing elements from the old hash table are re-hashed and placed into the new, larger table

25
New cards

representations of vectors

  • values stored in a list

  • functions

  • arrows

26
New cards

convex combination

a way to blend two or more vectors together so that the result stays between them/ within the convex hull

27
New cards

convex hull

a spatial representation of the vector space between two vectors

28
New cards

C = x*A + y*B

  • x and y must be greater than or equal to 0

  • x + y must equal 1