Skip to content

Commit

Permalink
fix: copy and paste the exact generated text
Browse files Browse the repository at this point in the history
  • Loading branch information
seonglae committed Dec 2, 2024
1 parent abafa51 commit 762c63d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion docs/source/pipelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,27 +185,37 @@ Logging `result[0].generated_text` to the console gives:
<details>
<summary>Click to view the console output</summary>
<pre>
Here's a simple implementation of the quick sort algorithm in Python:

```python
def quick_sort(arr):
if len(arr) <= 1:
return arr

pivot = arr[len(arr) // 2]
left = [x for x in arr if x < pivot]
middle = [x for x in arr if x == pivot]
right = [x for x in arr if x > pivot]

return quick_sort(left) + middle + quick_sort(right)

# Example usage:
arr = [3, 6, 8, 10, 1, 2]
sorted_arr = quick_sort(arr)
print(sorted_arr)
```

### Explanation:

- **Base Case**: If the array has less than or equal to one element (i.e., `len(arr)` is less than or equal to `1`), it is already sorted and can be returned as is.

- **Pivot Selection**: The pivot is chosen as the middle element of the array.

- **Partitioning**: The array is partitioned into three parts: elements less than the pivot (`left`), elements equal to the pivot (`middle`), and elements greater than the pivot (`right`). These partitions are then recursively sorted.

- **Recursive Sorting**: The subarrays are sorted recursively using `quick_sort`.

This approach ensures that each recursive call reduces the problem size by half until it reaches a base case.
```
</pre>
</details>

Expand Down

0 comments on commit 762c63d

Please sign in to comment.