├── Example Code └── README.md /Example Code: -------------------------------------------------------------------------------- 1 | # Example of quick sort algorithm 2 | def quick_sort(arr): 3 | if len(arr) <= 1: 4 | return arr 5 | pivot = arr[len(arr) // 2] 6 | left = [x for x in arr if x < pivot] 7 | middle = [x for x in arr if x == pivot] 8 | right = [x for x in arr if x > pivot] 9 | return quick_sort(left) + middle + quick_sort(right) 10 | 11 | # Example usage 12 | arr = [3, 6, 8, 10, 1, 2, 1] 13 | sorted_arr = quick_sort(arr) 14 | print(sorted_arr) 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Algorithms-and-Data-Structures 2 | This repository contains implementations of various algorithms and data structures in Python 3 | --------------------------------------------------------------------------------