mirror of
https://github.com/onyx-and-iris/grokking-algorithms.git
synced 2024-11-15 09:20:52 +00:00
upd readmes, rename exercises.
This commit is contained in:
parent
13a0852cb9
commit
1d22356ce5
10
chapter3/README.md
Normal file
10
chapter3/README.md
Normal file
@ -0,0 +1,10 @@
|
||||
# Recursion
|
||||
|
||||
Recursive functions must have both:
|
||||
|
||||
- one or more base cases
|
||||
- a recursive case
|
||||
|
||||
The base cases are required to ensure the recursion stops when meeting a condition
|
||||
|
||||
The recursive case adds functions onto the call stack and completes each one top down.
|
@ -1,12 +1,9 @@
|
||||
# Recursion
|
||||
# Quicksort
|
||||
|
||||
Recursive functions must have both:
|
||||
Similar to the previous recursive function, quicksort uses divide and conquer.
|
||||
|
||||
- one or more base cases
|
||||
- a recursive case
|
||||
The base case occurs for an array size 0 or 1 (doesn't need to be sorted).
|
||||
|
||||
The base cases are required to ensure the recursion stops when meeting a condition
|
||||
|
||||
The recursive case adds functions onto the call stack and completes each one top down.
|
||||
The recursive case works by partitioning the array around a chosen pivot repeatedly until the base case is met and then combining all sorted sub-arrays.
|
||||
|
||||
Note. Quicksort should be implemented using a random pivot to ensure average runtimes.
|
||||
|
Loading…
Reference in New Issue
Block a user