Data Structures - Final Review 2026

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

1/72

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 5:32 AM on 5/3/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

73 Terms

1
New cards

what is a class?

a class is a user-defined data type composed of built-in types, functions, and other user-defined types, essentially serving as a blueprint for creating objects

  • parts used to define a data type are called members

2
New cards

what is a pointer?

variable that stores the memory address of another value

  • similar to an address book or GPS coords.

3
New cards

what is a memory leak?

occurs when a program allocates memory but DOESN’T free it

  • causes memory to remain allocated even after the variable is destroyed

  • mainly occur with DMA

4
New cards

what is a dangling pointer?

a pointer that points to a memory location that has already been freed

int* ptr = new int[6];

delete ptr; //dangling

cout « *ptr; //CRASH

5
New cards

what is a reference variable?

a reference variable is an alias of an existing variable with the use of the & operator

  • once initialized, it cannot be changed

  • cannot have a NULL value

  • ref variable must be initialized when created

6
New cards

what is the compilation process? give a brief description of each step with a diagram

  1. preprocessing - handles directives such as #include & #define

  2. compilation - translates preprocessed code into assembly code

  3. assembler - converts assembly code to machine code

  4. linking - combines object & library files into an executable file

7
New cards

what is debugging? list 4 debugging methods & describe them

the process of finding, isolating, and resolving coding errors/bugs

  • divide and conquer

  • rubber duck

  • brute force

  • automated

8
New cards

what is unit testing?

test-driven development (TDD) approach that tests INDIVIDUAL UNITS of code, CHECKING the smallest possible components to ensure they WORK CORRECTLY

9
New cards

what is a test bench?

a separate program whose purpose is to check if the function is returning the correct value

10
New cards

what is a self-referential structure?

a self-referential structure is a structure which points to itself

use case: linked list

struct Node {

int data;

Node* next;

};

11
New cards

what is hashing?

The process of converting a large input into a smaller, fixed-size output that can be used as an index in a table.

  • applies hash functions to transform input data

  • computes an index or position to store an item in a hash table

12
New cards

write pseudocode for the Adler-32 hashing function

hashfunction(key)

{

a=1;

b = 0;

for (c : key)

{

a= (a + c) % 65521

b = (b + a) % 65521

}

return ((b « 16) | a)% N

}

13
New cards

code an example of a memory leak

void memLeakExample() {

int *ptr = new int[5];

}

14
New cards

code an example of a dangling pointer

void danglingpointerexample() {

int *ptr = new int[5];

delete[] ptr;

ptr = NULL; //fix it

}

15
New cards

code an example of a reference variable

int num1 = 10;

int& ref_num1= num1;

16
New cards

code an example of a self-ref structure

struct selfref {

int data;

struct selfref *next;

};

17
New cards

time complexity defnition

the number of operations needed to run an algorithm on large amounts of data

18
New cards

space complexity definition

the total space used by an algorithm relative to the input

19
New cards

what are the 3 different components of hashing?

  1. key

  2. hash function

  3. hash table

20
New cards

key - component of hashing

a string or int that is provided as input to the hash function

21
New cards

hash function - component of hashing

mathematical formulas that transform input data into a fixed-size value

22
New cards

hash table - component of hashing

stores values associated with specific keys by using a hash function to compute an index in the array

  • allows data to be stored and accessed in an associative manner

  • each key maps to a particular position in the array

23
New cards

A queue can be implemented using a linked list with which operations?

  • adding at tail & receiving from head

  • adding at head & retrieving from tail

24
New cards

a stack can be implemented using a linked list with which operations?

  • adding at head & retrieving from head

  • adding at tail & retrieving from tail

25
New cards

collision (hashing)

occurs when two different keys produce the same hash index

26
New cards

collision resolution (hashing)

  • chaining (linked lists at each index)

  • open addressing (finding the next empty spot)

  • double hashing, linear and quadratic probing, hash table resizing

27
New cards

what is an undirected graph? draw an example

AB = BA

  • no directed lines

28
New cards

what is a weighted graph?

a graph in which each edge is assigned a weight

29
New cards

what is a connected graph & a disconnected graph?

  • connected graph: all vertices are connected

  • disconnected graph: at least one vertex is disconnected

30
New cards

what is a complete graph? give an example

31
New cards

meaning of incident, isolated, and adjacent

incident - if two edges touch

isolated - no touching

adjacent - if there is an edge between two vertices

32
New cards

degree of a vertex

the number of neighbors a vertex has

33
New cards

walk

must be valid

34
New cards

trail

a walk with no repeated edges

35
New cards

path

a walk with no repeated edges or vertices

36
New cards

what is graph isomorphism? give an example

  • same # of vertices

  • same # of edges

  • # same degree sequence

37
New cards

what is a cyclic graph? give an example

a graph with at least ONE cycle

38
New cards

what is a circuit? give an example

closed walk ; starts and ends at the same vertex

  • can repeat vertices

  • CANNOT repeat edges

39
New cards

what is a euler circuit? give an example

every edge appears exactly ONCE

40
New cards

what is a euler trail? give an example

contains every edge exactly ONCE

  • can only contain 2 odd deg vertices at beg or end

41
New cards

what is a hamiltonian cycle? give an example

a cycle that includes every vertex

42
New cards

what is a hamiltonian path? give an example

valid walk that contains every vertex exactly ONCE

43
New cards

what is a planar graph? give an example

a graph with no edge crossings

44
New cards

what is graph coloring?

45
New cards

explain the greedy graph coloring method with an example

46
New cards

what is a subgraph? explain with an example

a graph within another graph, contains the same vertices and edges, just doesn’t include the entire graph

47
New cards

what is an adjacency matrix?

0 & 1 corresponding to relationship

48
New cards

what is an adjacency list?

list in ascending order

1 → 2,3,4

49
New cards

explain Djikstra’s Algorithm

50
New cards

explain the Bellman-Ford Algorithm

51
New cards

what is topological sorting?

52
New cards

what is a tree?


a graph that is connected but has no cycles

  • only one unique path between any two vertices

53
New cards

what is a spanning tree?

subgraph that includes all the vertices of G and connects them using the minimum possible number of edges.

54
New cards

what is a minimum spanning tree?

55
New cards

what is Prim’s Algorithm?

56
New cards

what is Kruskal’s Algorithm

57
New cards

what is a rooted tree?

a tree with a root

58
New cards

what is a free tree?

59
New cards

what is inorder traversal? give an example

60
New cards

what is preorder traversal? give an example

61
New cards

what is postorder traversal? give an example

62
New cards

what is level-order traversal? give an example

63
New cards

what is a binary tree? give an example

hierarchical data structure in which each node can have at most two children (left an right)

64
New cards

what is a binary search tree? give na example

all nodes left of a given node are smaller, while all nodes in the right of a given node are bigger

65
New cards

what is a balanced binary tree? give an example

66
New cards

explain insertion in a BST

67
New cards

explain deletion in a BST

68
New cards

what is a B-tree?

69
New cards

what is an AVL tree?

a self-balancing binary search tree in which the height difference between the left and right subtrees of any node is at most one

70
New cards

explain insertion in an AVL tree

71
New cards

explain deletion in an AVL tree

72
New cards

explain BFS (breadth-first search)

start traversing from a selected node (source) and explore all nodes at the present depth prior to moving on to the nodes at the next depth level

73
New cards

explain DFS (depth-first search)

start traversing from a selected node (source) and explore as far as possible along each branch before backtracking.