0% found this document useful (0 votes)
5 views

Strings

The document discusses the definition and types of strings, including sequences, words, arrays, binary, and ternary strings, along with various problems related to counting and permutations. It introduces fundamental principles of counting, combinations, and permutations, providing examples and problems to illustrate these concepts. Additionally, it covers combinatorial proofs and techniques like stars and bars for counting arrangements of identical objects.

Uploaded by

zenitsu032020
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Strings

The document discusses the definition and types of strings, including sequences, words, arrays, binary, and ternary strings, along with various problems related to counting and permutations. It introduces fundamental principles of counting, combinations, and permutations, providing examples and problems to illustrate these concepts. Additionally, it covers combinatorial proofs and techniques like stars and bars for counting arrangements of identical objects.

Uploaded by

zenitsu032020
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 49

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

Total number of strings


Problem based on strings
A machine instruction in a 32-bit
operating system is just a bit string of
length 32.how many such strings are
possible ?
Fundamental Principles of Counting
• Multiplication Principle
If first operation can be performed in m ways and then a
second operation can be performed in n ways. Then,
the two operations taken together can be performed in
mn ways. This can be extended to any finite number of
operations.
Suppose you have 3 shirts and 4 pants .Find
the total number of outfits.
Fundamental Principles of Counting
• Addition Principle
If first operation can be performed in m ways and another
operation, which is independent of the first, can be
performed in n ways. Then, either of the two
operations can be performed in m + n ways. This can
be extended to any finite number of exclusive events
There are 5 action movies , 7 comedies and 16
dramas playing at the local movies theater. If you go
to the theater to a single movie, how many choices
do you have for which movie to watch ?
Problem based on strings
Letters ABCDE,
Find number of strings
• of length 5 with repetitions
• of length 5 without repetitions
• of length 3 With repetitions
• of length 3 without repetitions of length 3
• Beginning with A, with repetitions(length 5)
• Beginning with A , without repetitions
Permutation
There are basically two types of permutation:
• Repetition Allowed
When a thing has n different types and choosing r of
something that has n different types then permutation are:

• Without Repetition
A permutation of a set of distinct objects is an ordered
arrangement of these objects.

If X is an m-element set and n is a positive integer with m≥n, then


the number of X-strings of length n that are permutations
is P(m,n).
Properties of permutation
• P(n,n)=n!
• P(n,0)=1
• P(n,1)=n
• P(n,n-1)=n!
• The number of permutations of n things taken all at a time, in
which p are alike of one kind, q are alike of second kind and r
are alike of third kind and rest are different is n!/(p!q!r!)
• Circular permutation of n objects (n-1)!
Problems based on Permutation
• How many permutations of the letters {a,b,c,d,e,f,g,h}
are there?
• How many permutations of {a,b,c,d,e,f,g,h} are there
that don’t contain the letters “bad” (appearing
consecutively)?
• How many permutations of {a,b,c,d,e,f,g,h} are there
that don’t contain either the letters “bad” appearing
consecutively or the letters “fech” appearing
consecutively?
Problem based on permutation
Find the number of ways in which four girls and three
boys can arrange themselves in a row so that none of
the boys is together? How is this arrangement
different from that in a circular way?
Problem based on permutation
How many different string can be made by
reordering the letters of the word
SUCCESS?
No of letters=7
S=3times,c=2times,
Total words=7!/3!.2!.1!.1!
Are these two examples Same?
Answer the following questions:
From 3 letters A, B, and C, From 3 players, A, B, and C,
how many two letter words how many doubles team can
can be formed? be formed?
Problem
It's time to elect a slate of four class officers (President,
Vice President, Secretary and Treasurer) from the pool
of 80 students enrolled in Applied Combinatorics. If
any interested student could be elected to any position
how many different slates of officers can be elected?
Problem
Suppose that instead of electing students to specific
offices, the class is to elect an executive council of
four students from the pool of 80 students. Each
position on the executive council is equal, so there
would be no difference between Alice winning the
“first” seat on the executive council and her winning
the “fourth” seat. In other words, we just want to pick
four of the 80 students without any regard to order.
Combination
An r- combination of elements of a set is an unordered
selection of r elements from set. This r- combination is
subset is simply a subset of the set with r elements.
The number of r – combination of set with n distinct
element is denoted by C(n,r). It is also denoted by
and is also called binomial coefficient .
Properties of combination
problem

A student taking a history examination is directed to


answer any 7 of 10 essay questions. In how many
ways the students can answer the examination if
there is no concern about the order?
No ways =C(10,7)
problem
How many bit string of length 10 contain
a) exactly four 1’s?
b) at most four 1’s?
c) at least four 1’s?
d) An equal number of 0s and 1s?
No .of strings =C(10,5)
a) exactly four 1’s?
No.ofways=C(10,4)0rC(10,6)

At Most four one’s


caseI: No.of 1’s is zero
No . strings=1
caseI: No.of 1’s is one
No. of strings=C(10,1)=10
CaseIII:No.of 1’s is 2

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)

Total no. of strings=1+C(10,1)+C(10,2)+C(10,3)+C(10,4)


problem

There are 7 points in the plane ,3 are collinear then find:


1. Number of straight lines formed.
No .of lines=C(7,2)-C(3,2)+1
2. Number of triangles formed.
No. of triangles=C(7,3)-1
Combinatorial Proofs
Prove that
Count bit string of length n

Another way finding total number of bit string length is number


of 0’s in string
Combinatorial Proofs
Prove that

Count ternary string of length n so x={0,1,2}

Another way finding total number of ternary string of length n is


number of 2’s in string
problem

In how many ways can 5 balls be selected from 10 identical red


balls and 8 identical blue balls.
Integer Equation –stars and bars
A frequently occurring problem in combinatorics
arises when counting the number of ways to
group identical objects, such as placing balls into
labelled urns. We discuss a combinatorial
counting technique known as stars and
bars or balls and urns to solve these problems,
where the indistinguishable objects are
represented by stars and the separation into
groups is represented by bars.
Example
consider an equation

************
4 3 3
3 4 3 2
2

By placing three bars between stars (11


places) gives non-zero solution . This can be
done in C(11,3) ways
Example

Consider the equation

************
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)

Total 63+5=68 places , 5 bars are placed in 68


places
No. of solution =C(68,5)
solution
d)

Total places 53 stars and 4 bars, so


Total solution =C(57,4)
e)Case I
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)

Total 63+5=68 places , 5 bars are placed in 68


places
No. of solution =C(68,5)
solution
d)

Total places 53 stars and 4 bars, so


Total solution =C(57,4)
e)Case I
Solution
Solution
Example

In how many ways Ravi can distribute 10 computers to 4 office


departments so that each department will get at least one
computer?

In how many ways 12 different books be distributed among 3


students x,y,z such that y and z receives exactly double books as
that of x.
Binomial coefficient
Binomial theorem

Let a and b e real numbers with a, b and


a+b are nonzero . Then for every non
–negative integer n
formula
Problem
Find the coefficient of in .
By Binomial Theorem

Here,

To find the coefficient of


n=13,k=8
coefficient=
Problem
Find the coefficient of

To find the coefficient of


is same as finding coefficient of
problem

The coefficient of

You might also like