0% found this document useful (0 votes)
9 views

Advanced Problem Solving Binary Search

The document contains assignment questions and solutions related to binary search and data structures. It includes problems on packing rectangles, finding unique elements in sorted arrays, and various questions about binary search characteristics and complexities. Solutions are provided for each question, along with JavaScript code links for implementation.

Uploaded by

jj491bendreacc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Advanced Problem Solving Binary Search

The document contains assignment questions and solutions related to binary search and data structures. It includes problems on packing rectangles, finding unique elements in sorted arrays, and various questions about binary search characteristics and complexities. Solutions are provided for each question, along with JavaScript code links for implementation.

Uploaded by

jj491bendreacc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Advanced Problem Solving:

Binary Search

Assignment Questions
Assignment Questions

Assignment -Question

1.N rectangles of the same size are supplied to you: B in width and L in length. It is necessary to determine the
smallest square into which these rectangles can be completely packed. (It's worth noting that rectangles can't
be rotated or adjusted.)

Sample input: B = 2, L = 3, R = 10

Sample output: 9

Constraints: 1 <= B,L,R <= 10^9

2.Given an N-dimensional array of sorted elements, where each element appears twice and only one element
appears once. Find the unique element that takes less than O(n) time.

1. A character of the data that binary search uses but the linear search ignore, is

A.Order of the list

B.Length of the list

C.The maximum value in the list

D.The minimum value in the list

2.Which need not to be a binary tree?

A.Search tree

B.Heap

C.AVL-Tree

D.B-Tree

3. Which data structure is required to convert

arithmetic expression in infix to its equivalent postfix notation?

A. Queue

B. Linked list

C. Binary search tree

D. None of above

4. Binary search algorithm cannot be applied to …

A. sorted linked list

B. sorted binary trees

C. sorted linear array

D. pointer array

5. Complexity of linear search algorithm is ………

A. O(n)

B. O(logn)

C. O(n2)

6
Advanced Problem Solving:
Binary Search

Assignment Solutions
Assignment Solutions

Assignment Solutions
1.

JavaScript:

Live code- https://jsfiddle.net/shree998/mchaogk1/2/

6
Assignment Solutions

2.

JavaScript:

Live code- https://jsfiddle.net/shree998/pdj3z6sh/


1 A character of the data that binary search uses but the linear search ignore, is

AOrder of the list

BLength of the list

CThe maximum value in the list

DThe minimum value in the list

Ans : A

2.Which need not to be a binary tree?

ASearch tree

BHeap

CAVL-Tree

DB-Tree

Ans: D

3. Which data structure is required to convert

arithmetic expression in infix to its equivalent postfix notation?

(A) Queue

(B) Linked list

(C) Binary search tree

(D) None of above

Ans: D

6
Assignment Solutions

4. Binary search algorithm cannot be applied to …

A. sorted linked list

B. sorted binary trees

C. sorted linear array

D. pointer array

Ans : A

5. Complexity of linear search algorithm is ………

A. O(n)

B. O(logn)

C. O(n2)

D. O(n logn)

Ans: A

You might also like