You have simply hit the recursion limits. Your list of names is too large for Python’s limited recursion capabilities. Your Quicksort works just fine otherwise.
You could raise the recursion limit by setting the limit higher with sys.setrecursionlimit()
. You can set it a fair amount higher, but you do so at your own risk.
A better option is to use the built-in Python sort; the TimSort algorithm is far superior and won’t hit a recursion limit:
names = sorted(names, key=len)
This sorts the names by their length, shortest names first.
Related Posts:
- Recursion in Python? RuntimeError: maximum recursion depth exceeded while calling a Python object
- What is the maximum recursion depth in Python, and how to increase it?
- What is the maximum recursion depth in Python, and how to increase it?
- ImportError: Missing required dependencies [‘numpy’]
- Python: maximum recursion depth exceeded while calling a Python object
- What is the maximum recursion depth in Python, and how to increase it?
- ‘int’ object has no attribute ‘__getitem__’
- Python: maximum recursion depth exceeded while calling a Python object
- ‘int’ object has no attribute ‘__getitem__’
- Python Array Rotation
- Multiplication function with recursion in Python
- Why am I seeing “TypeError: string indices must be integers”?
- TypeError: only integer scalar arrays can be converted to a scalar index with 1D numpy indices array
- How to emulate a do-while loop?
- How to prettyprint a JSON file?
- How to install pip with Python 3?
- pip not recognised as an internal or external command
- Import Error: No module named numpy
- bash: pip: command not found
- Function for Factorial in Python
- TypeError: a bytes-like object is required, not ‘str’ when writing to a file in Python3
- Writing a pandas DataFrame to CSV file
- Purpose of “%matplotlib inline”
- How do I update Anaconda?
- Local variable referenced before assignment?
- Clickable link inside message discord.py
- DataFrame constructor not properly called! error
- OSError: [WinError 193] %1 is not a valid Win32 application
- How to download a file over HTTP?
- Can’t fix “zipimport.ZipImportError: can’t decompress data; zlib not available” when I type in “python3.6 get-pip.py”
- Arrays used as indices must be of integer (or boolean) type
- Are static class variables possible in Python?
- Why am I getting “LinAlgError: Singular matrix” from grangercausalitytests?
- “ImportError: no module named ‘requests'” after installing with pip
- Append integer to beginning of list in Python
- Most efficient way to map function over numpy array
- List comprehension on a nested list?
- Get total of Pandas column
- How do you read from stdin?
- Union of two lists in Python
- Type error: cannot convert the series to
- Reading a binary file with python
- How to determine a Python variable’s type?
- Could not find a version that satisfies the requirement
- How to deep copy a list?
- Pandas – DataFrame object is not callable
- Start with pyglet or pygame?
- Django 2.1.3 Error: __init__() takes 1 positional argument but 2 were given
- Python error load JSON code of google API
- How to convert IPython notebooks to PDF and HTML?
- ‘Jupyter’ is not recognized as an internal or external command
- How to print spaces in Python?
- installing urllib in Python3.6
- What is sys.maxint in Python 3?
- Convert categorical data in pandas dataframe
- pandas create new column based on values from other columns / apply a function of multiple columns, row-wise
- Parsing HTML using Python
- How can I install the latest Anaconda with wget
- sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 1, and there are 74 supplied
- TypeError: ‘int’ object does not support item assignment
- Convert datetime to Unix timestamp and convert it back in python
- Truncate to three decimals in Python
- Scatter plot colorbar – Matplotlib
- “SyntaxError: non-keyword arg after keyword arg” Error in Python when using requests.post()
- Flask Error: “Method Not Allowed The method is not allowed for the requested URL”
- Pandas error “Can only use .str accessor with string values”
- matplotlib: how to draw a rectangle on image
- How to install PyGame on Python 3.4?
- ImportError: No module named ‘cv2’ Python3
- bbox_to_anchor and loc in matplotlib
- Python: Can a function return an array and a variable?
- Python 101: Can’t open file: No such file or directory
- super() fails with error: TypeError “argument 1 must be type, not classobj” when parent does not inherit from object
- Appending values to dictionary in Python
- TypeError: argument of type ‘NoneType’ is not iterable
- how to read json object in python
- find time difference in seconds as an integer with python
- Pandas: sum up multiple columns into one column without last column
- How to prettyprint a JSON file?
- How to load all modules in a folder?
- Usage of sys.stdout.flush() method
- set object is not JSON serializable
- How to convert an integer to a string in any base?
- Count Vowels in String Python
- install csv package in pycharm
- How to print the full NumPy array, without truncation?
- dump() missing 1 required positional argument: ‘fp’ in python json
- TypeError: module.__init__() takes at most 2 arguments (3 given)
- coercing to Unicode: need string or buffer, NoneType found when rendering in django admin
- Python cant convert ‘list’ object to str error [closed]
- Failed building wheel for Twisted in Windows 10 python 3
- Write a program that asks the user to enter five test scores. Correspond it to a letter grade
- Simplify Chained Comparison
- How to get POSTed JSON in Flask?
- How to fix SSL issue SSL_CTX_use_certificate : ca md too weak on Python Zeep
- Paramiko’s SSHClient with SFTP
- Package libffi was not found in the pkg-config search path REDHAT6.5
- Line is too long. Django PEP8
- TypeError: zip argument #2 must support iteration
- CS231n: How to calculate gradient for Softmax loss function?