Ask Question
6 January, 01:20

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. 6 January, 01:42
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers