Ask Question
26 May, 08:06

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

+2
Answers (1)
  1. 26 May, 09:27
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers