Timeline for Finding an element in array, whose index number and element value same
Current License: CC BY-SA 4.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 28, 2019 at 15:30 | comment | added | Srestha | I am getting either O(1) time , or O(n) time, but not getting O(log n), because it is not checking only a element, but it is checking element with an index | |
Apr 28, 2019 at 15:27 | comment | added | Srestha | "either find an i such that a[i] = i or demonstrate that such an i does not exist. "-if I does not exists, we have to check every I in O(n) time. Is not it? | |
Apr 28, 2019 at 15:19 | comment | added | gnasher729 | Srestha, you are supposed to either find an i such that a[i] = i or demonstrate that such an i does not exist. You could check is a[1]=1? Is a[2]=2? And so on but that is slow. | |
Apr 28, 2019 at 14:59 | comment | added | Srestha | Plz check my above comment. I understand everything except , what a[I]=I is doing? Is it checking every I or it checking a particular I? | |
Apr 28, 2019 at 14:45 | history | answered | gnasher729 | CC BY-SA 4.0 |