linheryt's blog

By linheryt, history, 2 months ago, In English

3.Cheerleaders(SotongPractice) Môtả ChomộtxâugồmNkítự(N≤10),yêucầuinratấtcảcáchoánvịphânbiệtcủaxâuđótheothứtựtừđiển. Vídụ Vớixâu“aba”,sẽcótấtcả3hoánvịkhácnhautheothứtựtừđiểnlà“aab”,“aba”,“baa”. Phântích MộtxâucóđộdàiNsẽcótốiđaN!hoánvịphânbiệtkhitấtcảcáckítựcủaxâuđóđềukhácnhau. Hướnggiải Vétcạn Dựavàotầnsốcủacáckítựtrongxâu,dùngkĩthuậtđệquyđểsinhratấtcảhoánvịkhácnhautheothứtựtừđiển. ĐộphứctạptínhtoánO(N!). 24 2. Exhaustive Search -Problem voidper(inti){ //basic condition// if(i == N){ cout << S << endl; return; } //Recursion// for (intj = 0; j < 26; j++){ if(cnt[j]){ S[i] = 'a'+j; cnt[j]--; per(i+1);//đệ quy cnt[j]++; } } }

 
 
 
 
  • Vote: I like it
  • -24
  • Vote: I do not like it

»
2 months ago, # |
  Vote: I like it +6 Vote: I do not like it

I would like to say that the word blog is not personal blog but it will be publicly published unless you draft those blogs.

Also, you should write in English as an international language for better understanding for readers

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

sorry but i can't understand

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by linheryt (previous revision, new revision, compare).