ExamVeda
Login
Home
This question belongs to Data Structure Sorting Algorithms
Sorting Algorithms
?

What is the average time complexity of in place merge sort when we use the following function for merging?
void in_place_merge(int arr[], int l, int middle, int r) 
{ 
	int start2 = middle + 1; 
	if (arr[middle] <= arr[start2]) 
        { 
		return; 
	} 
	while (l <= middle && start2 <= r) 
        { 
		if (arr[l] <= arr[start2]) 
                { 
			l++; 
		} 
		else 
                { 
			int val = arr[start2]; 
			int index = start2; 
			while (index != l) 
                        { 
				arr[index] = arr[index - 1]; 
				index--; 
			} 
			arr[l] = val; 
		        l++; 
			middle++; 
			start2++; 
		} 
	} 
}

Answer & Solution
Correct Answer: Option B
Let's discuss the solution. Join the discussion
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.