> For the complete documentation index, see [llms.txt](https://kgisl.gitbook.io/lab3003/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kgisl.gitbook.io/lab3003/lab/insort.md).

# insort

### insort

Define a function **insort(*****list*****,&#x20;*****item*****,&#x20;*****hi*****)** which takes three arguments.

It should locate the proper insertion point for *item* in *list* to maintain sorted order and place *item* at that location. The parameter *hi* is the current index of *item* in *list*.

Implement a solution that does not have any list methods.

#### OPTIONAL

* Implement a solution using list methods

### Example

```
insort([1, 2, 3, -1], -1, 3) => [-1, 1, 2, 3]
insort([3, 5, 4], 4, 2) => [3, 4, 5]
```
