Ask Question
12 July, 07:13

An array UnsortedInt consists of integers in random order. Another array SortedInt consists of a sorted list of integers.

Which of the given options is faster in SortedInt array than UnsortedInt arrays?

A-inserting a new element

B-searching for a new element

C-Computing the mean of elements

a) only A

b) only C

c) A, B, and C

d) only B

e) A and B only

+4
Answers (1)
  1. 12 July, 08:34
    0
    B. searching for a new element.

    Explanation:

    Searching for an element in a sorted array is denoted as:

    O (log n)

    It uses a binary search algorithm to seek for the element in the array. So it gives only a logarithmic increase as the search moves up the array.

    To Insert a new element to an array, it tries to arrange the new element orderly is the array, checking from one element to another to see the position it fits.

    It is denoted as O (n), and is slower than inserting in an unsorted array, which is denoted as O (1), because it does not care of the position of the new element.

    The speed for computing the mean in both sorted and unsorted are the same.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “An array UnsortedInt consists of integers in random order. Another array SortedInt consists of a sorted list of integers. Which of the ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers