Skip to content

Commit

Permalink
Merge pull request shivaylamba#893 from RathodKinjal76/kinjal-rathod
Browse files Browse the repository at this point in the history
Added 2 new files
  • Loading branch information
shivaylamba authored Oct 25, 2020
2 parents 39d683d + 5ab2bf9 commit e0765e6
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
7 changes: 7 additions & 0 deletions hello_worl_vb.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<html>
<body>
<script language = "vbscript" type = "text/vbscript">
document.write("Hello World!")
</script>
</body>
</html>
48 changes: 48 additions & 0 deletions mergesort.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Python program for implementation of MergeSort
def mergeSort(arr):
if len(arr) >1:
mid = len(arr)//2 # Finding the mid of the array
L = arr[:mid] # Dividing the array elements
R = arr[mid:] # into 2 halves

mergeSort(L) # Sorting the first half
mergeSort(R) # Sorting the second half

i = j = k = 0

# Copy data to temp arrays L[] and R[]
while i < len(L) and j < len(R):
if L[i] < R[j]:
arr[k] = L[i]
i+= 1
else:
arr[k] = R[j]
j+= 1
k+= 1

# Checking if any element was left
while i < len(L):
arr[k] = L[i]
i+= 1
k+= 1

while j < len(R):
arr[k] = R[j]
j+= 1
k+= 1

# Code to print the list
def printList(arr):
for i in range(len(arr)):
print(arr[i], end =" ")
print()

# driver code to test the above code
if __name__ == '__main__':
arr = [12, 11, 13, 5, 6, 7]
print ("Given array is", end ="\n")
printList(arr)
mergeSort(arr)
print("Sorted array is: ", end ="\n")
printList(arr)

0 comments on commit e0765e6

Please sign in to comment.