Unit 7 - Data Structures

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/66

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 12:55 PM on 6/24/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

67 Terms

1
New cards

Binary Tree

A rooted tree where each node has a maximum of 2 children.

2
New cards

What data type is a tree?

Abstract data type

3
New cards

What is a tree?

A tree is a connected, undirected graph with no cycles. (There is a unique path from one node to another)

4
New cards

What is a rooted tree?

One node is identified as the root. The root has no parent.

5
New cards

What can pre-order be used for?

Used if you want to duplicate a binary tree

6
New cards

What is post-order?

Reads children first before parents

7
New cards

What can post-order be used for?

Used if you need to delete data

8
New cards

What can in-order be used for?

Used when you want to read data in order

9
New cards

Balanced tree

Each subtree has approximately same number of nodes to the left and the right.

10
New cards

Queue

It's an array that only allows data to be inserted from one end and retrieved from the other. Uses FIFO data structure.

11
New cards

Graph

Data structure that has a series of nodes connected together through edges Edges can be directed/undirected or unweighted/weighted

12
New cards

What are vectors used for?

Vectors are used for vector graphic images and computer games.

13
New cards

Vector addition

Adding 2 vectors

X+Y + X+Y = X+Y

14
New cards

Scalar multiplication

Increases or decreases a vector in size

a = (2,1)

b = 3a = (3x2, 3x1) = (6,3)

15
New cards

Convex combination:

w = αu + βv

16
New cards

Dot product

Method for multiplying 2 vectors. Represented as a •

17
New cards

Dot product formula

cos Ɵ = u • v

—-------

(ǁuǁ • ǁvǁ)

18
New cards

Adjacency matrix

2D array used to store info about a directed/undirected graph

19
New cards

Adjacency list

2D array used to store info on a large and sparse graph

20
New cards

Graph

A set of nodes/vertices connected to edges/arcs.

21
New cards

Edges

Edges can be undirected/directed or weighted/unweighted.

22
New cards

1 advantage of adjacency matrix

Adding an edge to it is simple

23
New cards

1 disadvantage of adjacency matrix

Wastes memory space on large, sparse graphs

24
New cards

1 advantage of adjacency list

Uses less memory space in a sparse graph

25
New cards

Vector

Ordered sequence of numbers. Shows magnitude and direction

26
New cards

Vector addition

Adding together 2 vectors

27
New cards

Scalar-vector multiplication

Changes the size of a vector, smaller or larger

28
New cards

Dot/scalar product

Multiplying 2 vectors together

29
New cards

Array

Collection of data with the same data type.

30
New cards

Circular Linked List

A variation of a linked list where the last node points back to the first node, forming a circle.

31
New cards

Priority Queue

An abstract data type similar to a regular queue but with elements that have priorities, allowing higher priority elements to be dequeued before lower priority ones.

32
New cards

What is a binary tree?

A binary tree is a rooted tree with a maximum of 2 children.

33
New cards

What is pre-order?

Reads parent first then the children

34
New cards

What is in-order?

Reads data on the tree alphabetically/numerically

35
New cards

Elementary data type

Data types provided by programming languages

36
New cards

Composite data type

Combination of elementary data types. They store multiple data types

37
New cards

Abstract data type

A model that defines how a data structure works. It uses information hiding to show only relevant/useful info.

38
New cards

Where are queues used irl?

At a checkout, entering a cinema, school lunch line

39
New cards

What is an advantage of a linear queue?

Simple to program

40
New cards

What is an disadvantage of a linear queue?

Fixed length size, Can't reuse spaces

41
New cards

Where can you use linear queues?

School lunch line

42
New cards

What is an advantage of a circular queue?

Can reuse spaces

43
New cards

What is an disadvantage of a circular queue?

More complex to program because of pointers.

44
New cards

Where can you use circular queues?

Documents waiting to be printed

45
New cards

What is an advantage of a priority queue?

Gives importance to items

46
New cards

What is an disadvantage of a priority queue?

Additional processing required

47
New cards

here can you use priority queues?

Accidents and Emergencies

48
New cards

Static data structure

Fixed in size. They cannot grow/shrink in size

49
New cards

Dynamic data structure

Can grow/shrink in size

50
New cards

Stacks

LIFO data structure. Adds data on the top of the stack and removes data from the top

51
New cards

Overflow

Attempting to push onto a stack that is full

52
New cards

Underflow

Attempting to pop from a stack that is empty

53
New cards

List

Lists store a collection of related data. The same item can occur more than once

54
New cards

Is a list mutable or immutable

Mutable

55
New cards

Mutable

Can be changed

56
New cards

Immutable

Cannot be changed

57
New cards

Linked list

A linked list is a dynamic list that allows you to add new data anywhere. The data points to the next data to create a chain

58
New cards

Advantages of linked lists

Dynamic

Easy to insert/delete data

The order of the data doesn't matter as the pointer points to the next node

59
New cards

Hash table

Collection of items stored in a way that can be quickly located. Can be implemented as an array or list.

60
New cards

Hashing algorithm

It has a key that performs operations on data to find out what index it should be stored in, in the hash table.

61
New cards

Collision

When more than 1 piece of data has the same hash value after being put into the hashing algorithm.

62
New cards

Folding method

Divides the data into equal parts then adds them together to get a hash value, then %.

63
New cards

Rehashing

Finding an empty slot for data that occurred in a collision.

64
New cards

What 2 ways of dealing with collisions in a hash table?

1. Add the data under the index in a list

2. Find an empty spot above the index in that table

65
New cards

Dictionary

Collection of associated pairs of items, each pair has a key and a value.

66
New cards

Represent vectors

LIST, DICTIONARY, 1D ARRAY.

67
New cards

Represent Dictionary

Hash tables, useful in graphs