IGKO is TODAY!
Mock Test ₹150 View Schedule

Ganita Manjari · Class 9 · Part II · Chapter 11

Ganita Manjari Class 9 Maths Chapter 11 The World of Algorithms Exercise 11.2 Solutions

Three questions on writing algorithms: working with lists, finding the lcm, and using pairs of divisors. Each algorithm is written step by step and executed on an example.

Last updated 6 October 2026

  • 3Questions
  • 1Diagrams
  • Ch 11The World of Algorithms

How to answer every question

  1. Name what you keep track of Give each list or number a name, such as only-in-first or c.
  2. Start empty or at 1 Begin lists empty and counters at their first value.
  3. Loop with a test Use "for each …" and an "if …" to decide what to add.
  4. Run it on a small example Execute the steps for a small case and check the output.

List: an ordered sequence of values, written in square brackets such as [1, 3, 5].

Increasing order: each number is larger than the one before it.

Pair of divisors: j and nj, which multiply to give n.

Working with lists

Chapter 11 Exercise 11.2 Question 1 Solution : List 1 and List 2 are lists of numbers in increasing order. (i) Write an algorithm to find the elements of List 1 that are not in List 2. (ii) Write an algorithm to find the elements of List 2 that are not in List 1.

Answer: two algorithms and examples
Part (i) · Algorithm: only-in-first(List 1, List 2)
  1. Start with an empty list called only-in-first.
  2. For each number x in List 1: if x does not appear in List 2, add x to the end of only-in-first.
  3. Report only-in-first.
Execute it on divisors of 375 and 825

Take List 1 = divisors(375) = [1, 3, 5, 15, 25, 75, 125, 375] and List 2 = divisors(825) = [1, 3, 5, 11, 15, 25, 33, 55, 75, 165, 275, 825].

x from List 1Appears in List 2?only-in-first becomes
1yes[ ]
3yes[ ]
5yes[ ]
15yes[ ]
25yes[ ]
75yes[ ]
125no[125]
375no[125, 375]

The answer for part (i) is [125, 375].

Part (ii) · Swap the roles of the two lists
  1. Start with an empty list called only-in-second.
  2. For each number y in List 2: if y does not appear in List 1, add y to the end of only-in-second.
  3. Report only-in-second.

On the same lists, the numbers 11, 33, 55, 165, 275 and 825 are not in List 1, and the others (1, 3, 5, 15, 25, 75) are.

only-in-second = [11, 33, 55, 165, 275, 825]
A faster way using the increasing order

Because both lists are increasing, we can walk along both lists once with a marker on each, instead of searching all of List 2 for every x.

  1. Put marker a on the first number of List 1 and marker b on the first number of List 2.
  2. If the numbers under the markers are equal, move both markers one step.
  3. If the number under a is smaller, it cannot be in List 2, so add it to only-in-first and move a.
  4. If the number under b is smaller, move b.
  5. When List 1 ends, stop. Report only-in-first.

(i) Elements of List 1 not in List 2: [125, 375]. (ii) Elements of List 2 not in List 1: [11, 33, 55, 165, 275, 825].

Chapter 11 Exercise 11.2 Question 2 Solution : Describe an algorithm to compute the least common multiple (lcm) of two numbers.

Answer: lcm(375, 825) = 4125
Algorithm A · Straight from the definition
  1. Let big be the larger of m and n, and small the smaller.
  2. For k = 1, 2, 3, …: let c = k × big.
  3. If small divides c, report c as the lcm and stop.

Example: lcm(12, 18). Here big = 18 and small = 12. For k = 1, c = 18, and 12 does not divide 18. For k = 2, c = 36, and 12 divides 36. So lcm(12, 18) = 36.

The algorithm always stops, because k = small gives c = big × small, which is a common multiple.

Algorithm B · Using the gcd

The product m × n contains the common divisor twice, so dividing by the gcd gives the lcm.

  1. Compute g = gcd(m, n) using Euclid's algorithm.
  2. Multiply m × n.
  3. Report m × ng as the lcm.
lcm(375, 825) = 375 × 82575 = 30937575 = 4125

Check: 4125 = 11 × 375 and 4125 = 5 × 825, so both numbers divide it, and no smaller common multiple exists because the gcd is 75.

Algorithm A tries multiples of the larger number. Algorithm B uses lcm = m × ngcd(m, n). For example lcm(375, 825) = 4125.

Divisors in pairs

Chapter 11 Exercise 11.2 Question 3 Solution : Divisors occur in pairs. For 18 they are (1, 18), (2, 9) and (3, 6). (i) If we list divisors in pairs, how many numbers between 1 and n must we examine? (ii) If we list the divisors in pairs, will our gcd algorithm still work as described?

StarredAnswer: check only up to the square root
Part (i) · Only up to the square root

If j divides n, then so does nj, and the two form a pair. In every pair, one number is at most √n and the other is at least √n. So it is enough to test j = 1, 2, 3, … up to √n. Each j that divides n gives the pair (j, nj).

j (up to √18 ≈ 4.2)Divides 18?Pair found
1yes(1, 18)
2yes(2, 9)
3yes(3, 6)
4nonone

For n = 36 we test only j = 1 to 6. The pair for j = 6 is (6, 6), a single divisor that is counted once.

Divisors of 36 joined in pairsPairs 1 and 36, 2 and 18, 3 and 12, 4 and 9, and 6 alone. Numbers up to 6 are shaded.Q3 · divisors of 36 in pairs: test only j up to √36 = 6test only these (up to 6)1234691218366 pairs with itself (6 × 6 = 36)each arc is a pair (j, n over j): one end is always in the shaded part
Q3 · every pair has one number up to the square root, so we test only those
Part (ii) · Does the gcd algorithm still work?Not as written

The gcd algorithm reports the rightmost element of the list of common divisors, and that only works when the list is in increasing order. Listing divisors in pairs gives a list that is not in order, for example divisors(18) = [1, 18, 2, 9, 3, 6].

Test gcd(18, 36). With divisors(18) written in pairs, every divisor of 18 is also a divisor of 36, so the common-divisors list is [1, 18, 2, 9, 3, 6]. The rightmost element is 6, but gcd(18, 36) = 18.

Fix: either sort the lists, or report the largest element of the common-divisors list instead of the rightmost one. With that change the algorithm works again.

(i) We examine only the numbers up to √n instead of up to n. (ii) The gcd algorithm fails as written, because the paired list is not increasing; sort it or take the largest element.

Answers at a glance

Each algorithm is executed on a small example to show that it works.

QuestionWhat is askedKey ideaAnswer
Q1 Elements missing from the other listTest each x, add if absent[125, 375] and [11, 33, 55, 165, 275, 825]
Q2 Algorithm for lcmMultiples, or m × ngcd(m, n)lcm(375, 825) = 4125
Q3 Divisors in pairsCheck up to √nGcd algorithm needs sorting

Source of the questions: NCERT, Ganita Manjari, Grade 9, Part II, Chapter 11, Exercise Set 11.2. The solutions, explanations and diagrams on this page are our own working.

Call WhatsApp Book Demo