Browse Source

Delete 'merge.py'

removing from project branch
orlando.medina4 2 years ago
parent
commit
4aa576b382
1 changed files with 0 additions and 45 deletions
  1. 0
    45
      merge.py

+ 0
- 45
merge.py View File

@@ -1,45 +0,0 @@
1
-def merge(arr, l, m, r):
2
-	n1 = m - l + 1
3
-	n2 = r - m
4
-
5
-	# create temp arrays
6
-	L = [0] * (n1)
7
-	R = [0] * (n2)
8
-
9
-	# Copy data to temp arrays L[] and R[]
10
-	for i in range(0, n1):
11
-		L[i] = arr[l + i]
12
-
13
-	for j in range(0, n2):
14
-		R[j] = arr[m + 1 + j]
15
-
16
-	# Merge the temp arrays back into arr[l..r]
17
-	i = 0	 # Initial index of first subarray
18
-	j = 0	 # Initial index of second subarray
19
-	k = l	 # Initial index of merged subarray
20
-
21
-	while i < n1 and j < n2:
22
-		if L[i] <= R[j]:
23
-			arr[k] = L[i]
24
-			i += 1
25
-		else:
26
-			arr[k] = R[j]
27
-			j += 1
28
-		k += 1
29
-
30
-	# Copy the remaining elements of L[], if there
31
-	# are any
32
-	while i < n1:
33
-		arr[k] = L[i]
34
-		i += 1
35
-		k += 1
36
-
37
-	# Copy the remaining elements of R[], if there
38
-	# are any
39
-	while j < n2:
40
-		arr[k] = R[j]
41
-		j += 1
42
-		k += 1
43
-
44
-# l is for left index and r is right index of the
45
-# sub-array of arr to be sorted