Array Flashcards

1
Q

Time complexity

A

Access by index - o(1)
Search - (n)
Add in the end - o(1)
Add at any location - O(n)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Techniques

A
  • linear search
  • double pointer search - front,back
  • divide and search
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Array Sort in ascending order

A

Arrays.sort( T[])

Arrays.sort(T[], Collections.reverseOrder())

How well did you know this?
1
Not at all
2
3
4
5
Perfectly