DSA Exercises

Fill in the blanks to test your knowledge.

1

Express linear time complexity in Big O

Linear search is O()
2

Express constant time complexity in Big O

Array index access is O()
3

Express the complexity of binary search

Binary search is O( n)
4

Name the operation that adds to end of an array

arr.(element) // O(1) amortized
5

Identify the node property pointing to next in a linked list

class Node {
constructor(val) {
this.val = val;
this. = null;
}
}
6

Name the sorting algorithm with O(n log n) average time

// sort: O(n log n) average
array.sort((a, b) => a - b);
7

Express the complexity of nested loops over n

// Two nested loops over n items
// Time complexity: O(n)
8

Name the data structure that follows FIFO order

// First-In, First-Out structure
// Called a