- AO(1)
- BO(log n)
- CO(n)
- DO(n^2)
Time Taken:
Correct Answer:
Wrong Answer:
Percentage: %
Answer: O(n)
Explanation: The dynamic programming algorithm for computing the nth Fibonacci number using memoization has a space complexity of O(n) because it involves storing the solutions to n subproblems in memory.
Binary search in a balanced BST has a time complexity of O(log N) where N is the number of elements. This is due to the logarithmic reduction in the search space with each comparison.
Merge sort has a time complexity of O(N log N), making it a stable and efficient sorting algorithm.
Dijkstra's algorithm has a time complexity of O(E + V log V) for finding the shortest path in a graph.
The recursive generation of the Fibonacci sequence has an exponential time complexity of O(2^N).
The Floyd-Warshall algorithm has a cubic time complexity of O(V^3) for finding all-pairs shortest paths in a weighted graph.
The pop operation in a queue has a constant-time complexity of O(1), making it efficient for removing elements from the front of the queue.
Counting sort has a time complexity of O(N + k), where N is the number of elements and k is the range of input values.
The correct answer is:
When you need to cache values for a specific record in Dynamics 365 Finance (X++), the most appropriate collection class is:
✔️
Map
Map?Map is a key-value pair collection.
You can store a record ID (or any unique identifier) as the key, and the associated data (like a cached value or object) as the value.
It allows for efficient retrieval based on the key, making it perfect for caching scenarios.
List
❌ Ordered collection without key-based lookup. You'd have to iterate to find a record — not efficient for caching.
Set
❌ Holds unique values but doesn't store key-value pairs, so you can't map values to a specific record.
Struct
❌ Used to group related fields together (like a lightweight object), but not suitable for storing multiple records or caching by key.
✔ Map