GATE | GATE-CS-2003 | Question 90

Let ∑ = (a, b, c, d, e) be an alphabet. We define an encoding scheme as follows :
g(a) = 3, g(b) = 5, g(c) = 7, g(d) = 9, g(e) = 11.
GATECS2003Q39
Which of the following numbers is the encoding h of a non-empty sequence of strings ?
(A) 27 37 57
(B) 28 38 58
(C) 29 39 59
(D) 210 510 710


Answer: (B)

Explanation:
Since, the answer is a product of three prime numbers 2, 3 and 5. So, we have three non-empty sequence of strings : “a”, “a” and “a”.

f(s) = 2x for some x
Since, 7 and 9 are not multiple of 2. So, options (A) and (C) are eliminated.

f(a) = 23 = 8
h = 28 3858

 
Thus, option (B) is correct.

 
Please comment below if you find anything wrong in the above post.


Quiz of this Question

GATE CS Corner    Company Wise Coding Practice





Writing code in comment? Please use ide.geeksforgeeks.org, generate link and share the link here.