<commit_before>---
layout: post
title:  "Alternate Implementation of Quicksort"
categories: implementation
author: "Rahul"
---

Alternate implementation of quicksort but uses more memory
```python
def quicksort(arr):
    less=[]
    equal=[]
    greater=[]
    if len(arr) >1:
        pivot=arr[0]
        for i in arr:
            if i<pivot:
                less.append(i)
            elif i==pivot:
                equal.append(i)
            else:
                greater.append(i)
        return sort(less)+equal+sort(greater)
    return arr
arr=map(int,raw_input().split(' '))
print quicksort(arr)
```

Simple implementation of quick sort 2 
```python

# Uses python slice notation
def quicksort(arr): 
    if len(arr) <= 1:
            
            return arr
    else:
          return quicksort(
          [x for x in arr[1:] if x<arr[0]]) + [arr[0]] 
          + quicksort([x for x in arr[1:] if x>=arr[0]])
arr=map(int,raw_input().split(' '))
print quicksort(arr)
```
<commit_msg>posts: Remove empty line in code block<commit_after>---
layout: post
title:  "Alternate Implementation of Quicksort"
categories: implementation
author: "Rahul"
---

Alternate implementation of quicksort but uses more memory

```python
def quicksort(arr):
    less=[]
    equal=[]
    greater=[]
    if len(arr) >1:
        pivot=arr[0]
        for i in arr:
            if i<pivot:
                less.append(i)
            elif i==pivot:
                equal.append(i)
            else:
                greater.append(i)
        return sort(less)+equal+sort(greater)
    return arr
arr=map(int,raw_input().split(' '))
print quicksort(arr)
```

Simple implementation of quick sort 2 

```python
# Uses python slice notation
def quicksort(arr): 
    if len(arr) <= 1:
            
            return arr
    else:
          return quicksort(
          [x for x in arr[1:] if x<arr[0]]) + [arr[0]] 
          + quicksort([x for x in arr[1:] if x>=arr[0]])
arr=map(int,raw_input().split(' '))
print quicksort(arr)
```

{'fraction_non_alphanumeric': 0.13296812749003983, 'fraction_numerical': 0.008964143426294821, 'mean_word_length': 2.240322580645161, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1201717', 'n_tokens_mistral': 665, 'n_tokens_neox': 647, 'n_words': 182}