1.4 Data Types, Data Structures and Algorithms

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall with Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/18

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No study sessions yet.

19 Terms

1
New cards

Array

Holds an ordered list of elements of the same data type

Mutable

2
New cards

How can a 2D array be visualised?

A table with rows and columns

3
New cards

Record

Collection of related fields (variables)

Each field can have a different data type

Used in databases

4
New cards

Lists

Mutable

Can have multiple data types

Non-contiguous (not ordered in memory)

5
New cards

Tuples

Immutable

Can have multiple data types

Ordered

6
New cards

Linked lists

Each element is called a node

Each node has an index, data and a pointer

Nodes are not ordered

Pointers determine where the next node is from the start node

7
New cards

Circular linked list

When the last node points to the first node instead of null

Continuous loop

Round Robin

8
New cards

3 types of graph

  • Undirected graph - edges can be traversed in any direction

  • Directed graph - edges can only be traversed in one direction

  • Weighted graph - edges have a cost (e.g. distance or time)

9
New cards

How can computers process graphs?

  • Adjacency matrixes - tables with 1s and 0s

  • Adjacency lists - lists all nodes connected to a node

10
New cards

Stacks

LIFO

Items can only be added and removed from the top of the stack

POP

PEEK
PUSH

11
New cards

Stack overflow

Error when trying to push a new item onto a full stack

12
New cards

Queues

FIFO

Items are removed from the front of the queue

13
New cards

Circular queues

End of a queue wraps back to the front of the queue

Solves problem of wasted space when items are removed in a linear queue

Front pointer + end pointer

14
New cards

Tree

A hierarchal undirected graph that has a root node, parents and children

Represents folders, family trees and organisations’ hierarchy

15
New cards

Binary tree

A type of tree that can only have two children nodes under each parent normally called: Left child and Right child

16
New cards

Hash table

Implements a dictionary structure

Uses a hash function to calculate an index in an array for data

Uses a key (data) then applies the function to find the numerical hash (index) for it

17
New cards

Collisions

When 2 keys hash to the same index

Collision handling methods:

  • Open addressing - data is placed in the next available index

  • Chaining - an overflow array is used to store the data, a linked list is used

18
New cards

Breadth-first search

Uses a queue structure (FIFO)

Traversed horizontally

Starts at root node and looks at children 1 step away

Enqueues any connecting nodes and changes current node when the node is added to the final list

19
New cards

Depth-first search

Uses a stack structure (LIFO)

Nodes are popped and pushed as graph is traversed vertically

Push every connected node to the current node on the stack

Pop the stack and add the removed item into the final list