Skip to content

CSE2135 - Data Structure

String Processing

Term 161

  • Q2(a) [3]: Find (i) DELETE('AAABBB', 2, 2) and DELETE('JOHN PAUL JONES', 6, 5) (ii) REPLACE('AAABBB', 'AA', 'BB') and REPLACE('JOHN PAUL JONES', 'PAUL', 'DAVID').

Term 171

  • Q1(c) [3]: Find the following: (i) INSERT('AAAAA', 3, BBB); (ii) DELETE('AAABBB', 2, 2); (iii) REPLACE('AAABBB', 'AA', BB).
  • Q3(b) [4]: Write an algorithm which replaces every occurrence of pattern P in Text T by a new pattern Q.
  • Q3(c) [3]: Suppose \(S=\) "BANGLADESH IS THE MOST BEAUTIFUL COUNTRY" and \(T=\) "IN THE WORLD".
  • Find the length of S and T.
  • Find SUBSTRING(S, 9, 20).
  • Find INDEX(S, 'THE') and INDEX(T, 'THE').
  • Q3(d) [3]: Define static, semistatic and dynamic character variable.

Term 181

  • Q2(a) [4]: Write an algorithm which replaces every occurrence of pattern P in Text T by a new pattern Q.
  • Q2(b) [3]: Describe the three types of structures used for storing strings.
  • Q2(c) [3]: Find the following:
  • INSERT('PQRSPQRS', 4, AAA);
  • DELETE('DATA.STRUCTURE', 5, 4);
  • REPLACE('XYZXYZXXZZYY', 'ZXY', 'YXZ').

Term 191

  • Q7(a) [4]: Write an algorithm which deletes every occurrence of pattern P in Text T.
  • Q7(c) [3]: Define static, semistatic and dynamic character variable.
  • Q7(d) [2]: Suppose P = "BANGLADESH IS THE MOST BEAUTIFUL COUNTRY" and Q = "IN THE WORLD".
  • Find SUBSTRING(P, 7, 16).
  • Find INDEX(P, 'THE') and INDEX(P, 'THE').

Term 201

  • Q1(c) [2]: For the pattern \(P=aaa\) and text \(T=(aabb)^3\) find the number of comparisons to find the INDEX of P in T using the 'slow' algorithm.
  • Q2(a) [4]: Find the table and corresponding graph for the second pattern matching algorithm where the pattern is \(P=a^2b^2(ab)^2\).
  • Q2(b) [5]: Suppose T contains the text "INFORMATION AND COMMUNICATION TECHNOLOGY". Find:
  • SUBSTRING(T, 17, 24)
  • INDEX(T, 'CATION')
  • INSERT(T, 31, 'ENGINEERING')
  • DELETE(T, 13, 18)
  • REPLACE(T, 'TECHNOLOGY', 'SCIENCE')
  • Q2(c) [3]: Describe briefly the meaning of static, semi static and dynamic variables.