accessing each element in array only once called
Answers
Answered by
4
Answer:
Method-1: Using Sorting.
- Sort the array.
- Check for each element at index i (except the first and last element), if arr[i] != arr[i-1] && arr [i] != arr[i+1]
- For the first element, check if arr[0] != arr[1].
- For the last element, check if arr[n-1] != arr[n-2].
Answered by
0
Accessing each element in the array only once is called traversing.
- Traversing is a process in which each element of the array is accessed at least once.
- In most of the languages, the index starts with 0 and the last index is (n-1).
- the index can be used to access all elements or for multiple uses as each index has a unique element stored there.
Similar questions
India Languages,
3 months ago
Math,
3 months ago
English,
7 months ago
English,
7 months ago
English,
11 months ago
Social Sciences,
11 months ago
Math,
11 months ago