Quiz Space

Advanced Algorithms Quiz 2: 3 December 2023 (September 2023 term)

Question 1

+2 marksNumerical answer

You are given a sequence of integers aa of length 2n2n. You have to split these 2n2n integers into nn pairs; each pair will represent the coordinates of a point on a plane. Each number from the sequence aa should become the xx or yy coordinate of exactly one point. Note that some points can be equal.

After the points are formed, you have to choose a path ss that starts from one of these points, ends at one of these points, and visits all nn points at least once.

The length of path ss is the sum of distances between all adjacent points on the path. In this problem, the distance between two points (x1,y1)(x_1, y_1) and (x2,y2)(x_2, y_2) is defined as ∣x1−x2∣+∣y1−y2∣|x_1 - x_2| + |y_1 - y_2|.

Your task is to form nn points and choose a path ss in such a way that the length of path ss is minimized.

For example, if the given sequence is 15, 1, 10, 5, then you can form points (10,1)(10, 1) and (15,5)(15, 5) and start the path ss from the first point and end it at the second point. Then the length of the path will be ∣10−15∣+∣1−5∣=5+4=9|10 - 15| + |1 - 5| = 5 + 4 = 9. It can be shown that this is the best possible.

Based on the above data, answer the given subquestions.

Question 2

+2 marksNumerical answer

You are given a sequence of integers aa of length 2n2n. You have to split these 2n2n integers into nn pairs; each pair will represent the coordinates of a point on a plane. Each number from the sequence aa should become the xx or yy coordinate of exactly one point. Note that some points can be equal.

After the points are formed, you have to choose a path ss that starts from one of these points, ends at one of these points, and visits all nn points at least once.

The length of path ss is the sum of distances between all adjacent points on the path. In this problem, the distance between two points (x1,y1)(x_1, y_1) and (x2,y2)(x_2, y_2) is defined as ∣x1−x2∣+∣y1−y2∣|x_1 - x_2| + |y_1 - y_2|.

Your task is to form nn points and choose a path ss in such a way that the length of path ss is minimized.

For example, if the given sequence is 15, 1, 10, 5, then you can form points (10,1)(10, 1) and (15,5)(15, 5) and start the path ss from the first point and end it at the second point. Then the length of the path will be ∣10−15∣+∣1−5∣=5+4=9|10 - 15| + |1 - 5| = 5 + 4 = 9. It can be shown that this is the best possible.

Based on the above data, answer the given subquestions.

Question 3

+3 marksOne correct option

You are given a sequence of integers aa of length 2n2n. You have to split these 2n2n integers into nn pairs; each pair will represent the coordinates of a point on a plane. Each number from the sequence aa should become the xx or yy coordinate of exactly one point. Note that some points can be equal.

After the points are formed, you have to choose a path ss that starts from one of these points, ends at one of these points, and visits all nn points at least once.

The length of path ss is the sum of distances between all adjacent points on the path. In this problem, the distance between two points (x1,y1)(x_1, y_1) and (x2,y2)(x_2, y_2) is defined as ∣x1−x2∣+∣y1−y2∣|x_1 - x_2| + |y_1 - y_2|.

Your task is to form nn points and choose a path ss in such a way that the length of path ss is minimized.

For example, if the given sequence is 15, 1, 10, 5, then you can form points (10,1)(10, 1) and (15,5)(15, 5) and start the path ss from the first point and end it at the second point. Then the length of the path will be ∣10−15∣+∣1−5∣=5+4=9|10 - 15| + |1 - 5| = 5 + 4 = 9. It can be shown that this is the best possible.

Based on the above data, answer the given subquestions.

  1. A
  2. B
  3. C
  4. D

17 more questions in this paper

Sign in with Google — it is free — to see every question with its answer and explanation, practise it in learning mode, or take it as a timed mock test.

More on the Advanced Algorithms Quiz 2 3 Dec 2023 paper

The IIT Madras BS Advanced Algorithms (Advanced Algorithms) Quiz 2 paper sat on 3 Dec 2023, in the September 2023 term: 20 questions for 50 marks in 120 minutes. The first 3 questions are below. Sign in with Google — it is free — to see the whole paper with its answers and explanations, in learning mode or as a timed mock test.

FeatureAdvanced Algorithms Quiz 2 3 Dec 2023 at a glance
TermSeptember 2023 term
SubjectAdvanced Algorithms
Course codeBSCS4021
Questions20
Marks50
Duration120 min
Numerical3
MCQ17
Official paperIIT M DEGREE AN2 EXAM QDB2 03 Dec 2023
Negative markingNo negative marking.
Updated

Same Quiz 2, other subjects

More Advanced Algorithms