merge_sort and bubble_sort implementation in python and golang
Prog to perform sorting based on merge-sort and bubble-sort and a liitle information on how to make an unstable sorting algo like merge-sort stable
For merge-sort it will recursively sorts the array in O(n*logN) For bubble-sort (interview friendly) it will behave as bubbles coming out of water(intuition).
I am interested in this task . can u assign this task to me.
Hey , I am interested in this task. Can you please assign me this task?
I completed this task pls merge it.
On Wed, Oct 12, 2022, 12:41 MoitreyoChak @.***> wrote:
Hey , I am interested in this task. Can you please assign me this task?
— Reply to this email directly, view it on GitHub https://github.com/fineanmol/hacktoberfest/issues/691#issuecomment-1275694871, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUCXGFLH3LQO7U4G5QOZFT3WCZQBTANCNFSM6AAAAAAQ6OSERA . You are receiving this because you were assigned.Message ID: @.***>
i did merge sort in python please assign me this task. this is some example of my code #merge function def merge(arr, l, m, r): n1 = m - l + 1 n2 = r- m
create arrays
L = [0] * (n1) R = [0] * (n2)
Copy data to arrays
for i in range(0 , n1): L[i] = arr[l + i] for j in range(0 , n2): R[j] = arr[m + 1 + j] i = 0 # first half of array j = 0 # second half of array k = l # merges two halves while i < n1 and j < n2 : if L[i] <= R[j]: arr[k] = L[i] i += 1 else: arr[k] = R[j] j += 1 k += 1
copy the left out elements of left half
while i < n1: arr[k] = L[i] i += 1 k += 1
copy the left out elements of right half
while j < n2: arr[k] = R[j] j += 1 k += 1
sort
def mergeSort(arr,l,r): if l < r: # getting the average m = (l+(r-1))/2 # Sort mergeSort(arr, l, m) mergeSort(arr, m+1, r) merge(arr, l, m, r)
main
arr = [2,5,3,8,6,5,4,7] n = len(arr) mergeSort(arr,0,n-1) print ("Sorted array is") for i in range(n): print (arr[i],end=" ")
Heyy I want to work on this issue. Please assign it to me.
hi @fineanmol can you please assign this task I can do it for selection and bubble sort
Closing — legacy issue from before the 2026 repo cleanup. This repo no longer includes language folders or standalone program submissions.