这个算法的k值是多少? [英] What is the value of k for this algorithm?

查看:101
本文介绍了这个算法的k值是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

k←0

n←长度(str)

每个排列的str

j←1

而(j≤n)

k←k + 1

j←j + 1

打印k



我尝试了什么:



i试图找出答案我得到的是n ^ 2。

k ← 0
n ← length(str)
for each permutation of str
j ← 1
while (j ≤ n)
k ← k + 1
j ← j + 1
print k

What I have tried:

i have tried to find out the answer what i am getting is n^2.

推荐答案

你的问题不仅模糊,而且看起来像一个功课(哪个班级?)来学习语言C.



这是一个很好的 C-Tutorial ,您可以在这里学习一些基本知识。我建议你安装并使用Visual Studio IDE。



祝你好运。
Your questions isnt only vague, but looks like a homework (which class?) to learn the language C.

Here is a fine C-Tutorial, where you can learn some basic knowledge. I recommand you to install and use the Visual Studio IDE.

Good luck.


这篇关于这个算法的k值是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆