Question

State True or False. i) Binary search is used for searching in a sorted array. AND ii) The time complexity of binary search is O(log n). A) True, False B) False, True C) False, False D) True, True Explain

Answer #1

D) TRUE,TRUE.

i) Binary search searcha sorted array by repeatedly dividing the search interval in half .If the value of the search key is less than the item in the middle of the interval ,narrow the interval to the lower half.Otherwise, narrow it to th eupper half.Repeat the steps and check untill the value is found or the interval becomes empty.

ii) The time Complexity of Binary search is O(log n)

.

*-------------------------------------------------thank
You----------------------------------------------------------------------------------*

1. Given an
n-element array A, Algorithm X executes an
O(n)-time computation for each even
number in A and an O(log n)-time computation for
each odd number in A.
What is the best-case running time of Algorithm X?
What is the worst-case running time of Algorithm X?
2. Given an array,
A, of n integers, give an O(n)-time algorithm that finds
the longest subarray of A such that all the numbers in that
subarray are in sorted order. Your algorithm...

Write the following program in MIPS:
a) declare an array A of the following numbers: 3, 5, 8, 10, 12,
2, 76, 43, 90, 44
b) declare a variable called size which stores the number of
element in array A, that is 10.
c) write a subroutine to search for a number stored in an array
and return true or false. In C++ the subroutine is as
follows:
search(array, size, number_To_Search)
e.g. search(A, 10, 12)
The subroutine should return 0...

In heapsort we view an array as a binary tree using the
following mapping: a[0] is the root of the entire tree and for
element a[i], its left child is a[2i+1] and its right child is
a[2i+2]. Answer the following questions for an array of size n. (
Answers in some cases may be in terms of n.)
a) What is the index of the parent a[i] for any i > 0?
b) What is the biggest index for which...

True or false; for each of the statements below, state whether
they are true or false. If false, give an explanation or example
that illustrates why it's false.
(a) The matrix A = [1 0] is not invertible.
[1 -2]
(b) Let B be a matrix. The rowspaces row (B), row (REF(B)) and
row (RREF(B)) are all equivalent.
(c) Let C be a 5 x 7 matrix with nullity 3. The rank of C is
2.
(d) Let D...

1.A stack implemented with an array has what performance?
Select one:
a.
O(n3)
b.
O(n log n)
c.
O(n)
d.
O(n2)
2.
A stack uses the first in first out insertion and deletion
method.
Select one:
True
False
3. Match the following stack operations with their meaning.
object pop();
boolean isEmpty();
push (object);
integer size();
object top();
meanings are:
- returns the number of elements stored
-just removes the last inserted elements
- returns the last inserted elements without removing...

Data Structures using C++
Searching a Linked List
Here are the declarations for a simple unsorted linked list of
ints that ends in a null pointer.
//===============================================================
class Cell {
friend class UList;
private:
int data;
Cell* next;
Cell( int dt, Cell* nx=nullptr ) : data(dt), next(nx) {}
};
//===============================================================
class UList {
private:
Cell* head = nullptr; // stationary head
pointer.
Cell* scan =
nullptr; //
for walking down the List.
Cell* follow = nullptr;
public:
void find( int...

i)
What would be stored in the 4-digit binary codes if the clock
display time was:17:29
(7)
(c)
Using two’s complement binary arithmetic, find the sum
of (i)
48 and – 19 (ii) ( 6) ( 13) and (iii) Convert
(b)
(i)Convert 87.25 in decimal to Binary and show it value in Octal
and Hex.
n

Type I error is:
A. Deciding the alternative hypothesis is true
when it is false
B. Deciding the alternative hypothesis is true
when it is true
C. Deciding the null hypothesis is true when it is
false
D. Deciding the null hypothesis is false when it
is true
E. All of the above
F. None of the above
Type II error is:
A. Deciding the null hypothesis is false when it
is true
B. Deciding the null hypothesis is true...

I took an education class that taught true or false questions
shouldn’t be used on quizzes or tests because the student can guess
and still have a 50% chance of getting the correct answer. Was my
professor right? If Joe gets 9 true or false questions correct on a
10 question stats quiz, is this evidence that Joe understands the
content of the quiz?
1. What are the observational units? How many are there?
2. What is the variable? What...

Which of the following statements are true and which are false
regarding the ploidy level of a cell (N) and its DNA content (C)? T
= true and F = false.
A) At metaphase I of meiosis, a cell is 2N, 4C.
B) at anaphase I of meiosis, a cell is 2N, 4C.
C) at metaphase II of meiosis, a cell is 1N, 2C.
D) a gamete is 1N, 1C.

ADVERTISEMENT

Get Answers For Free

Most questions answered within 1 hours.

ADVERTISEMENT

asked 11 minutes ago

asked 17 minutes ago

asked 27 minutes ago

asked 37 minutes ago

asked 38 minutes ago

asked 40 minutes ago

asked 41 minutes ago

asked 41 minutes ago

asked 48 minutes ago

asked 49 minutes ago

asked 1 hour ago

asked 1 hour ago