

Hãy luôn nhớ cảm ơn và vote 5*
nếu câu trả lời hữu ích nhé!
`*` Insert(S1, S2, vt): Chèn xâu S1 vào xâu S2 tại vị trí vi
$\color{#CC66FF}{\text{_______________________________________}}$
`*` S1 = 'Hoc tap'
\begin{array}{|c|c|c|} \hline \text{Vị trí i}&\text{1}&\text{2}&\text{3}&\text{4}&\text{5}&\text{6}&\text{7}\\ \hline \text{S1[i]}&\text{H}&\text{o}&\text{c}&\text{}&\text{t}&\text{a}&\text{p}\\ \hline\end{array}
`*` S2 = 'Suot doi'
\begin{array}{|c|c|c|} \hline \text{Vị trí i}&\text{1}&\text{2}&\text{3}&\text{4}&\text{5}&\text{6}&\text{7}&\text{8}\\ \hline \text{S2[i]}&\text{S}&\text{u}&\text{o}&\text{t}&\text{}&\text{d}&\text{o}&\text{i}\\ \hline\end{array}
`*` S1 được chèn tại vị trí 5, đẩy các kí tự của S2 ra phía sau
`*` Kết quả:
\begin{array}{|c|c|c|} \hline \text{i}&\text{1}&\text{2}&\text{3}&\text{4}&\text{5}&\text{6}&\text{7}&\text{8}&\text{9}&\text{10}&\text{11}&\text{12}&\text{13}&\text{14}&\text{15}\\ \hline \text{S2[i]}&\text{S}&\text{u}&\text{o}&\text{t}&\text{H}&\text{o}&\text{c}&\text{}&\text{t}&\text{a}&\text{p}&\text{}&\text{d}&\text{o}&\text{i}\\ \hline\end{array}
`*` Đáp án: 'SuotHoc tap doi'
Hãy giúp mọi người biết câu trả lời này thế nào?

thủ tục Insert. Khi thực hiện thủ tục Insert, chuỗi S1 sẽ được chèn vào chuỗi S2 bắp đầu từ vị trí vt. Ví dụ, trong trường hợp của bạn, khi thực hiện thủ tục Insert(S1,S2, 5), kết quả sẽ là: 'SuotHoc tap doi'.
Hãy giúp mọi người biết câu trả lời này thế nào?

Bảng tin
0
696
0
https://hoidap247.com/cau-hoi/5608218