Cha

# Heap Data Structure Challenges

## Challenge 1:

Write a function to find the `nth`

smallest integer in an unsorted array. For example:

```
let integers = [3, 10, 18, 5, 21, 100]
n = 3
```

If `n = 3`

, the result should be `10`

.

*/

**func** getNthSmallestElement(n: Int, elements: [Int]) -> Int? {

*// Your code here*

**return** **nil**

}

**let** elements = [3, 10, 18, 5, 21, 100]

**let** nthElement = getNthSmallestElement(n: 3, elements: elements)

why if n = 3 the result should be 10?

what i am missing what i understand

Write a function to find the `nth`

smallest integer in an unsorted array.

then it will be 3 from our this array > `[3, 10, 18, 5, 21, 100]`

becz 3 is most smallest yes?

we dont search by index here we are searching smallest integer if yes it should be 3 ?