Assignment Contain 3 Question 1. All Questions Compulsory 2. Python Programming Language 3. Time Duration 4-5 Hours
Assignment Contain 3 Question 1. All Questions Compulsory 2. Python Programming Language 3. Time Duration 4-5 Hours
Q1.A sorted array is rotated at some unknown point, find the minimum element in
it.
Following solution assumes that all elements are distinct.
Examples:
Input: {5, 6, 1, 2, 3, 4}
Output: 1
Input: {1, 2, 3, 4}
Output: 1
Input: {2, 1}
Output: 1
Q2.Given two strings str1 and str2 and below operations that can
performed on str1. Find minimum number of edits (operations) required to
convert ‘str1′ into ‘str2′.
Operation :- replace
** replacement cost =1
Examples:
Input :
Str1= Quantom
Str2= Quantum
Output:
1
As Quantom can be changed to Quantum by replacing o with u
Examples 2:
Input :
Output:
2
As ee can be replace by or in 2 operation
Q3 .
Given: An Image with rectangular Boxes and labels associated to those Boxes. Index of every Box
and its Coordinates.
Problem Statement: Group together Boxes by labels and Neighboring Criteria and return the
Coordinates of the New Boxes formed.
Input: Index, Label and Coordinate of the Box(x0,y0,x1,y1) where (x0,y0) represents top-left corner
and (x1,y1) represents bottom-right corner of box with origin at top-left corner of image
Neighboring Criteria: Make a new Box that is 0.5 units away from the boundary of a selected original
box for all the sides. Now if the original boxes intersect with this new box, we consider them as
neighbors.
If label of the Neighbor Boxes matches within the newly formed Box we group them all together and
re-calculate the new Box using the same method that we used in Neighboring Criteria (0.5 units
away from extreme points among all the neighbor boxes).
Output: