Рет қаралды 13,741
Today we will be solving a very interesting question known as subsequence of a given string.
We have to write a program in Java to find all the subsequence of a given string using recursion.
What is a subsequence? This might be the first question in your mind.
A subsequence of a given sequence is a sequence that can be derived from the given sequence by deleting some of the elements or no elements without changing the order of the remaining elements.
For eg for a string abc or we call for a sequence abc.
The subsequences will be abc, bc, ac, ab, a, b, c and the empty string as well.
To find the total number of subsequences the formula is 2^n where n is the length of the string.
The next question is, can be solved recursively?
You all know the answer to this question is hidden in the 3 base questions of recursion.
With the course of this lecture, you will find that this problem can be easily solved recursively.
Complete the lecture to understand the concept behind the program and the program for finding all the subsequence of a given string using recursion in java.
Subscribe to our channel for regular updates on the dsa course and click on the bell icon to never miss an update from our dsa course.
Data Structures and Algorithms Free Course (Learn DSA Without Paise) Playlist - • Data Structures And Al...
For more information, fill this form: forms.gle/8eiU...
or call us at 8884881203
Facebook: / thetapacademy
Instagram: / tapacademy_online
Linkedin: / 73820805
Website: www.thetapacad...
#dsa #dsacourse #java #dsainjava #javaprogramming #coding #coder