Qs: Algo & Data Structure
Big-O Notation
What is Big-O Notation?
Big O Notation / Big(O) Complexity Analysis
Common Big O Complexities (from best to worst)
Big O
Time
Example Scenario
Growth as n increase
Common Big O Complexities: Growth Table
Big O
n = 1
n = 5
n = 10
n = 15
n = 20
O(N)
O(log N)
O(N log N)
HashMaps Big(O) Complexity
Time Complexity of a nested function?
What is the Time Complexity of the function below? Where N is the total number of nodes in the Tree.
What is the Recursion Stack Space Complexity of the function below assuming the Binary Tree is balanced? Where N is the total number of nodes in the Tree.
Suppose you are using a dynamic array to store values. If an array resize occurs by doubling its size, what is the Average(Amortised) Time Complexity of inserting an element?
Data Structures
What's a binary search?
Binary Search Tree (BST) ?
What's the two pointers technique?
What's the sliding window technique?
What's the prefix/suffix sum technique?
What's a stack data structure?
What's a hashmap data structure?
What's a binary tree data structure?
What's a linked list data structure?
What is the Time Complexity for accessing an element by index in an array? Where N is the number of elements in the array.
What is the primary disadvantage of using static arrays?
Which one of the following operations can be performed in O(1) time in a singly linked list?
In a Binary Tree, what is the maximum number of nodes at level h?
What is the Average Time Complexity for inserting an element into a HashMap?
You are developing a web application that requires frequently adding, removing, and accessing user sessions. Each session should be uniquely identifiable by a session ID, and you need to ensure that retrieving a session by its ID is efficient. Which data structure would be the best choice for managing user sessions in this scenario?
What is a hash collision in the context of a HashMap data structure?
What's a Trie (or prefix tree) ?
You are developing a predictive text feature for a mobile keyboard that suggests words as the user types. You want to efficiently store a large dictionary of words and allow for quick retrieval of all words that share a common prefix. Which data structure would be the best choice for implementing this feature?
What's a B-Tree ?
You are designing a database for a large e-commerce platform where users frequently search for products by name, category, and price. Which indexing structure would be the best choice for fast lookups in search operations?
Which one of the following operations can be performed in O(1) time in a singly linked list?
In a Binary Tree, what is the maximum number of nodes at level h?
What is a hash collision in the context of a HashMap data structure?
Which one is more efficient in the case we want to run multiple consecutive search operations on the same very large unsorted array? Efficient = Better Time Complexity Overall
You are building a text editor that requires implementing an undo feature. The user should be able to undo multiple actions in the order they were performed. Which data structure would be the best choice for implementing this undo functionality?
You are developing a predictive text feature for a mobile keyboard that suggests words as the user types. You want to efficiently store a large dictionary of words and allow for quick retrieval of all words that share a common prefix. Which data structure would be the best choice for implementing this feature?
What is a Balanced Tree (B-Tree) ?
You are designing a database for a large e-commerce platform where users frequently search for products by name, category, and price. Which indexing structure would be the best choice for fast lookups in search operations?
Binary Search Tree
Hash Map
Data Structures
Stack Space
Last updated