Print All Subsequences of a String || C++ || Recursion || By Mohit Gupta

preview_player
Показать описание
.................. In this video, we discuss the recursive approach to printing all subsequences of a given string in C++.
-----------------------------------------------------------------------------------------------------------------
iBytes Academy is a leading platform to learn coding.We have courses ranging from C++ with data structures to machine Learning using Python.
------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------
Follow us on social media:

Рекомендации по теме
Комментарии
Автор

I could not understand this question even from big platforms like Coding Ninjas, Coding Blocks, but from ur video, I understood it in very first time

Anonymous-gjkm
Автор

Wow ..for me this is the easiest solution of subsequence problem .

T_tintin
Автор

This is my 5th video on this problem in youtube. And Ive understood now

hhcdghjjgsdrt
Автор

Great explanation sir, really appreciate you.I was getting difficulty in understanding the implementation even on platforms like coding ninjas.But your clear cut explanation helped me a lot.
Thank you!

pranavkittad
Автор

In This Que Most Imp Thing is Return Type which is Int . Bcz Of Thsi We Can Use Loop And Print As Well No Need To Worry For Finding The Index No and So On ....

Shri_Radhe_Aaditya_Here
Автор

Very clear and precise explanation thanks a lot sir

elitegamer
Автор

Mysolution:

def allSubstrings(s, i, j, ans):
if len(s)==0:
return
if i==len(s):
return
if j==len(s):
i+=1
j=i
sr=s[i:j+1]
ans.append(sr)
allSubstrings(s, i, j+1, ans)
return

ans=[]
allSubstrings("ABC", 0, 0, ans)
print(ans)

#output:
['A', 'AB', 'ABC', 'B', 'BC', 'C', '']

just little different approach but using recursion.

ashutoshbichare
Автор

You are doing great sir....Be consist content is very good.

AmanSingh-mqfn
Автор

Sir you make recursion feel so simple, thanks a lot.

rohanmishra
Автор

I think this solution will not work with string having repeated characters like aaabbc. (Correct me if am wrong)

MR-znix
Автор

Bhot hi bdia yr, , no complications, , easy to grasp, , keep up the good work sir

riagupta
Автор

Crisp and accurate explanation . Can you tell the time complexity of the program ?

samyakkumarsahoo
Автор

Sir you make recursion feel so easy, thanks a

rahulgovindkumar
Автор

what will be the time complexity & space complexity of this program ?

binitrajshah
Автор

int smallersizesubsequence = subsequence(str.substr(1), output);
i did not understand how do you get the substring using this statement. please explain this .

parthsingh
Автор

would anyone care to explain the time complexity of this solution. Im having hard time understanding the compexities

gaishiya
Автор

I want to explain a necessary substring

csv.
Автор

how empty string is a subsequence of any string??

mohitsharma-pvmd
Автор

better to store it in list rather than static array, btw thanks for explanation

anubhavnegi
Автор

this video is really helpful and easy to understand

anubhawsharma