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/31

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 7:33 PM on 5/30/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

32 Terms

1
New cards

static data structure

section of memory is allocated at declaration

2
New cards

dynamic data structures

can change the amount of memory allocated after declaring the variable

3
New cards

advantages of dynamic data structures

no wasted memory, no limit to the number of items that can be added, resources allocated as they are needed

4
New cards

disadvantages of dynamic data strucutres

additional memory needed for pointers, can result in memory leak, can take longer to access an item directly

5
New cards

define array

a data structure for storing a finite, ordered set of data of the same data type within a single identifier

6
New cards

how does an array work

allocated a sequential run of memory locations, pointer to the first element

7
New cards

adding item to linear queue

check queue isn’t full, add 1 to the rear pointer, add item to position indicated by rear pointer

8
New cards

remove element from linear queue

check queue isn’t empty, add 1 to head pointer

9
New cards

add item to circular queue

check the queue is not already full, compare the value of the rear pointer with the max size of the array, if equal then rear pointer becomes zero, otherwise, add one to the rear pointer, insert new item in position indicated by rear pointer

10
New cards

dequeue circular queue

check queue is not empty, if empty deal with underflow error. if not, dequeue the front item in the queue. if head pointer = max length, set to 0. increment head pointer

11
New cards

how priority queue decides where new item should be added

check if the item indicated by the rear pointer has a higher priority than the previous item, if it does, swap with the previous item and then compare with the one before it. if it does not have a higher priority, increment pointer

12
New cards

priority queue

items are assigned a priority, items with the highest priority are dequeued before low priority items, if they have the same priority, first in first out

13
New cards

advantage of circular queue

avoids wasted space and prevents unnecessary shifting

14
New cards

test for empty stack

top of stack = bottom of stack

15
New cards

test for full stack

top of stack = limit

16
New cards

how can a stack be used to reverse the order of items in a queue

dequeue each value from the queue, starting at the beginning and add them to the stack. pop the values from teh stack and add them back to the queue

17
New cards

advantage and disadvantage of adjacency matrix

stores every possible edge between nodes, even those that doen’’t exist, almost half of the matrix is repeated data so memory insufficient. allows a specific edge to be queried very quickly as it can be looked up by its row and column so time efficient

18
New cards

adjacency list advantages and disadvantages

only stores edges that exist in the graph so memory efficient. slow to query as each item in a list must be searched sequentially until the desired edge is found so time inefficient

19
New cards

define tree

a tree is a connected, undirected graph with no cycles

20
New cards

rooted tree

a tree with a root node from which all other nodes stem

21
New cards

binary tree

a rooted tree in which each parent node has no more than two child nodes

22
New cards

leaf

a node with no children

23
New cards

collision

when two ore more different keys hash to the same hash value

24
New cards

open addressing

going to the next open address

25
New cards

closed hashing

don’t go over codomain, limit to how far out value can be

26
New cards

steps of adding record to a hash table

hash function is applied to the key value and stored in a memory location corresponding its hash value. if another value is already at that location,m it will be stored in the next location. there is a limit to the number of incementations to the memory location

27
New cards

how can vectors be represented

list of numbers, function, point in space, dictionary, 1d array, an arrow

28
New cards

define dictionary

a collection of key value pairs

29
New cards

application of dictionary

dictionary-based compression

30
New cards

state two advantages of using RPN instread of infix notation to represent an expression

simpler for a computer to evaluate. simper to code algorithm. do not need brackets. operators appear in the order required for computation. no need to backtrack when evaluating

31
New cards

how can a single stack be used to evaluate an RPN expression

starting at the LHS of the expression, push operands to the stack, each time an operator is reached, pop two values off the stack and apply the operator to them. push result to the stack. when the end of the expression is reached the top item of the stack is the result.

32
New cards

how to add item to priority queue

starting with the item at the rear of the queue move each item back one place in the array until you reach et he start of the queue or find an item with the same or higher priority than the item to add. add the new item in the position before that item