Question 1
- Initial Analysis : You have a standard merge sort algorithm, which you are currently running on a single-core system. What is the time complexity of this algorithm?
- Multiple Cores Improvement: Now, consider the system has
k cores. How would you modify merge sort to take advantage of multiple cores for optimal time complexity?
- Time Complexity Comparison: Provide the time complexities for each of the following scenarios and explain why:
- Standard merge sort on a single-core system
- Standard merge sort on a k-core system
- Modified merge sort on a single-core system
- Modified merge sort on a k-core system
- Modified merge sort with k threads
- Modified merge sort with k threads
Question 2
Given the following key-value pairs, convert them into YAML format and return as a string:
/web/leetcode/contest: 435
/web/leetcode/discuss: Zomato
/web/leetcode/premium/amount: 15000
/leetcode/explore: interviewExp
/leetcode/store: premium
Expected Output:
web:
leetcode:
contest: 435
discuss: Zomato
premium:
amount: 15000
leetcode:
explore: interviewExp
store: premium