What is the Big-O for an algorithm that takes two arrays of equal size n, and returns true if the arrays are disjoint—no elements in common—by taking an element from the first array and then checking if it is in the second array?
a. O(n^2)
b. O(n^3)
c. O(2^n)
d. O(n!)
a. O(n^2)
The first array is traversed, and then the second array is traversed to find if the element from the first is in the second. Both are of length n so O(n) * O(n) = O(n^2).
You might also like to view...
To use the Java Iterator Interface you must import the ____________ package.
(a) java.tools (b) java.linkedlist (c) java.iterator (d) java.util
Because ____ are cumbersome to revise and can support unstructured programming practices easily, they have fallen out of favor by professional programmers.
a. algorithms b. formulas c. pseudocodes d. flowcharts
Answer the following statement(s) true (T) or false (F)
Static electricity is an electrical charge in motion.
What section of a report should contain broader generalizations?
a. The appendixes b. The introduction c. The conclusion d. The discussion