50% found this document useful (2 votes)
217 views

Assignment Contain 3 Question 1. All Questions Compulsory 2. Python Programming Language 3. Time Duration 4-5 Hours

The document describes a 3 question assignment involving: 1. Finding the minimum element in a rotated sorted array. 2. Calculating the minimum number of edits to convert one string to another using a replace operation with a cost of 1. 3. Writing pseudo-code to explain an approach for grouping boxes in an image by label and proximity, and returning the coordinates of the new grouped boxes.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
50% found this document useful (2 votes)
217 views

Assignment Contain 3 Question 1. All Questions Compulsory 2. Python Programming Language 3. Time Duration 4-5 Hours

The document describes a 3 question assignment involving: 1. Finding the minimum element in a rotated sorted array. 2. Calculating the minimum number of edits to convert one string to another using a replace operation with a cost of 1. 3. Writing pseudo-code to explain an approach for grouping boxes in an image by label and proximity, and returning the coordinates of the new grouped boxes.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

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 :

Str1= Week Experience


Str2= Work Experience

Output:
2
As ee can be replace by or in 2 operation
Q3 .

Write a sudo code To explain your approach

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:

You might also like