Strings
Strings
How to define a
string?
Strings
X –String of length n
Sequences
A string is said be sequence when X is set of numbers.
For example , sequence of even numbers
Give an example of string of length 5 .
Strings
Words
A string is said be words when X is set is called alphabet and
elements are called letters .
For example, is 6-letter word and on 4- letters{a,b,c,d }
Array
strings are called arrays when the character is constrained
to belong to a subset , a string can be considered as an
element of the Cartesian product , which is
normally viewed as n-tuples of the form such
that for all i∈[n].
For example s=“ hello 123” n=9,
Strings
Binary strings
A string is said to be binary string when X={0,1}
For example:
Ternary strings
A string is said to be ternary string when
X={0,1,2}
For example: s=120110
Problem based on strings
In the state of Georgia, license plates
consist of four digits followed by a
space followed by three capital letters.
The first digit cannot be a 0. How many
license plates are possible?
solution
A String is of form
• Without Repetition
A permutation of a set of distinct objects is an ordered
arrangement of these objects.
No.ofstrings=C(10,2)
caseIV:No.of 1’s is 3, caseV:No.of 1’s is 4,
No.ofstrings=C(10,3) No.ofstrings=C(10,4)
************
4 3 3
3 4 3 2
2
************
a=0 b=0 C=6
c=0 d=12
d=6
a=0 b=5 c=7 d=0
By placing three bars in 15 places
stars (12stars +3 bars places)
gives solution . This can be done
in C(15,3) ways
Example
How many integer-valued solutions are there to each of
the following equalities and inequalities?
Solution
a) 63 stars and 4 bars .4 bars placed between 62
places to get the solution.
No. of solution =C(62,4)
b)Total 63+4=67places, 4 bars are placed in 67
places.
No. of solution=C(67,4)
c)
Here,
The coefficient of