mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 01:09:40 +08:00
Merge branch 'master' into improved_sorting_algo
This commit is contained in:
@ -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=',')
|
||||
|
@ -4,7 +4,6 @@
|
||||
# Sort large text files in a minimum amount of memory
|
||||
#
|
||||
import os
|
||||
import sys
|
||||
import argparse
|
||||
|
||||
class FileSplitter(object):
|
||||
|
@ -2,7 +2,6 @@ from __future__ import print_function
|
||||
from random import randint
|
||||
from tempfile import TemporaryFile
|
||||
import numpy as np
|
||||
import math
|
||||
|
||||
|
||||
|
||||
|
@ -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)
|
||||
|
Reference in New Issue
Block a user