Merge branch 'master' into improved_sorting_algo

This commit is contained in:
Yasir Choudhary
2018-10-19 12:05:26 +05:30
committed by GitHub
33 changed files with 576 additions and 118 deletions

View File

@ -1,15 +1,3 @@
"""
This is pure python implementation of bubble sort algorithm
For doctests run following command:
python -m doctest -v bubble_sort.py
or
python3 -m doctest -v bubble_sort.py
For manual testing run:
python bubble_sort.py
"""
from __future__ import print_function
@ -46,7 +34,6 @@ if __name__ == '__main__':
raw_input # Python 2
except NameError:
raw_input = input # Python 3
user_input = raw_input('Enter numbers separated by a comma:\n').strip()
user_input = raw_input('Enter numbers separated by a comma:').strip()
unsorted = [int(item) for item in user_input.split(',')]
print(bubble_sort(unsorted))
print(*bubble_sort(unsorted), sep=',')

View File

@ -4,7 +4,6 @@
# Sort large text files in a minimum amount of memory
#
import os
import sys
import argparse
class FileSplitter(object):

View File

@ -2,7 +2,6 @@ from __future__ import print_function
from random import randint
from tempfile import TemporaryFile
import numpy as np
import math

View File

@ -11,12 +11,12 @@ class node():
def insert(self,val):
if self.val:
if val < self.val:
if self.left == None:
if self.left is None:
self.left = node(val)
else:
self.left.insert(val)
elif val > self.val:
if self.right == None:
if self.right is None:
self.right = node(val)
else:
self.right.insert(val)