Counting sort query

how to use counting sort in case of -ve numbers

@Namanjain123 One way you can handle such cases is by doing a manual mapping.
Say you have array elements as : -9, 1, 2, 7, 3, 6, -1
Most negative element is -9.
So take index for -9 as 0(ie. -9+ 9)
Take index for 1 as 1+9=10
index for 2 as 2+9=11 and so on.
So by doing such index manipulation you can handle the negative numbers.

Hope this helps :slightly_smiling_face: