linheryt's blog

By linheryt, history, 2 years 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

| Write comment?
»
2 years 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