列表 第页
我想知道如何关联数组构造/执行shell脚本中使用时。I would like to know how an associative array is constructed/implemented when used in shell scripts.另外,我想知道,如果shell脚本的时间复杂度基础的关联数组是...阅读全文
我有以下的code,它确定一个数字是否为素数:I have the following code which determines whether a number is prime:public static boolean isPrime(int n){boolean answer = (n>1)? true:...阅读全文
我有列出的阵列(即阵列中的每个单元包含一个列表)。数组的长度 N 键,所有列表中的所有长度为 K 总和我想遍历所有的列表元素(全阵列中):的for(int i = 0;我n种; ++ I){对于(INT J = 0; J<数组[我] .list.Length(); ++ j)条{//做一些O(1)}}注意的内...阅读全文
什么是二叉树层次序遍历的时间复杂度?它是为O(n)或O(log n)的? 无效levelorder(节点* N){队列<节点*>问;q.enqueue(N);而(!q.empty()){节点*节点= q.front();DoSmthwith节点;q.dequeue();如果(与于节点GT;!左= NULL...阅读全文
我有以下的公式,我为了得到我的算法的时间复杂度,简化:(N ^ 2-N)/ 3。是否有应用,可以让我更进一步简化EX pression到一个更普通Θ(N ^ 2)或类似的东西(我假定这就是结果会是,可能是任何规则错误的)。I have the following formula that I have to simp...阅读全文
我有问题的特例,但它会很高兴知道它是否是可能的任何功能。I have the special case of the problem, but it would be nice to know whether it is possible for any function.所以,我想找到一个子字符串中的位置。好吧,...阅读全文
有:输入数组 A [1 ... N] N 的长度 A input array A[1...n]N length of A算法:for(int i=N; i>0; i--) { // Loop 1for(int j=1; j
有人问我一个有趣的问题,在我的采访,在Atrenta公司。这是一个包含有一个O(n)的复杂性,我说的是不可能的排序,但他坚持说,即使在面试后。I was asked an interesting question at my interview at Atrenta. It was to sort an array...阅读全文
我不知道什么是make_heap的算法在C ++中,这样的复杂度是3 * N?只有这样我能想到的通过插入元素具有复杂性为O(N日志N)作堆。非常感谢!I wonder what's the algorithm of make_heap in in C++ such that the complexity is 3*...阅读全文
我想弄清楚,我写了一个函数的时间复杂度(它生成一个发电机组获取给定的字符串):I'm trying to figure out the time complexity of a function that I wrote (it generates a power set for a given string):p...阅读全文
我与亚马逊前几天接受采访。我不能回答的让我自己满意的问题之一。我曾试图让面试后的答案,但我一直没成功为止。这里有一个问题:I interviewed with Amazon a few days ago. I could not answer one of the questions the asked me to...阅读全文
如果我使用 SciPy的.linalg.solve 我的工作站上(我相信调用LAPACK的gesv功能)上〜12000未知的问题(有〜12000平方,致密,非对称矩阵),我得到一个很好的答案 10-15分钟 只是为了探索什么是可能的限制(请注意,我不说有用),我一倍我根本问题,从而导致需要解决的〜50000未知的...阅读全文
有人可以告诉我的加成和放大器的复杂性;减法的分割和放大器;征服矩阵乘法算法?Can someone tell me the Complexity of the Addition & Subtraction for the Divide & Conquer Matrix Multiplication algorithm...阅读全文
这是interveiewer问我以下的问题:An interveiewer asked me below question:从十亿记录排序的数组搜索出独特的整数值(约1000张)(如1,1,1,1,3,3,3,4,5,5,6,6,6,6, 6,7,7,7,7,7,7,8,8,8,8 ...........)与复杂度...阅读全文
我有一个字符串数组排序:例如:酒吧,富,顶,斑马]我想搜索,如果输入一个词是present在一个阵列。 例如:搜索(字符串[]海峡,串词){//二进制搜索实现+字符串助动词。}现在二进制搜索将占复杂度是O(LOGN),其中n是一个数组的长度。所以这么好。不过,在某些时候,我们需要做一个字符串比较,它可以在线性时间内完...阅读全文
帮帮我!这是一种算法,其计算之间与长度为n的矢量dotproduct的时间和空间复杂度。?Help me!What is the time and space complexity of an algorithm, which calculates the dotproduct between to vecto...阅读全文
我不明白是怎么下的复杂性来的。i dont understand how the following complexities come from.espeacialy为B(b ^ D-1)中的时间复杂度espeacialy b(b^d-1) in the time complexity时间复杂度:总麻木。节点...阅读全文
我需要计算一个二进制字符串的LZ复杂性。 LZ的复杂度是遇到作为流differencet子的数量从开始时到结束时被观看。作为一个例子:S = 1001111011000010 在不同的子标记序列的复杂性C(S)= 6:S = 1/0/01 /一千一分之一千一百一十/ 0010 / 有人可以指导我找到一个简单的解决方案...阅读全文
如何确定时间这一code的复杂性?我想这modPow方法是最贵。导入java.math.BigInteger的;公共类FermatOne{公共静态无效的主要(字串[] args){的BigInteger一个=新的BigInteger(2);BigInteger的K =新的BigInteger(15);BigInte...阅读全文
我有一个递归算法,如:I have a recursive algorithm like :int alg(int n) {if (n == 0)return 2;for (int i = 0; i<= n-1; ++i)alg(i);}显然,ñ== 0 情况下是Θ(1)。但是我无法理解它到底是如何工作的。我的意...阅读全文
你能解释我如何找到时间,这种复杂性Can you explain me how to find time complexity for thissum1=0;for(k=1;k<=n;k*=2)for(j=1;j
我觉得时间复杂度和空间复杂度图灵机defenitions是相同的,我不能区分他们之间。I think defenitions of time complexity and space complexity for Turing machines are identical and I can't different...阅读全文
我有关于矩阵乘法的实现一个简单的问题。我知道有同等大小(n×n个)具有的为O(n ^ 2.xxx)复杂的矩阵算法。但是,如果我有两个矩阵A和不同大小的B(PXQ,qxr),这将是实施日期的最小的复杂性?我猜想它是O(PQR),因为我想实现一个乘法3嵌套循环使用P,Q和R迭代。特别是,有没有人现在怎么样了征库实现乘法?...阅读全文
许多算法中都有循环,即是这样的:Many algorithms have loops in them that look like this:for a from 1 to nfor b from 1 to afor c from 1 to bfor d from 1 to cfor e from 1 to d.....阅读全文
我有一个字符串列表。我有一组数字:I have a list of strings. I have a set of numbers: {1,2,3,4} {1, 2, 3, 4} 和我需要生成所有组合(字符串)要检查我的列表,组合(?):and I need to generate all combinati...阅读全文
我发现下面的for循环中的SO问题。我发现,时间复杂度为为O(n log n)的。我如何找到时间的复杂性,如果我们改变 K * = 2 到 K * = 3 ?//'诠释N'某处定义INT变种= 0;对于(INT K = 1; K&LT; = N,K * = 2)对于(INT J = 1; J&LT; = N; J...阅读全文
我有我写了下面的函数。这个功能实际上是一个合并排序。公共静态长nlgn(双[] NUMS){如果(nums.length→1){INT elementsInA1 = nums.length / 2;INT elementsInA2 = nums.length - elementsInA1;双[] ARR1 =新的双...阅读全文
大家都知道,基于比较模型中的任何排序算法下界nlogn即欧米茄(nlogn)的。这可以用数学证明。as we all know that any sorting algorithm based on comparison model has lower bound of nlogn i.e Omega(nlogn)...阅读全文
有没有什么办法来计算编程算法的时间复杂度?例如,我怎么能计算出一个斐波纳契(N)功能?Is there any way to compute the time complexity of an algorithm programatically? For example, how could I calculate...阅读全文
我知道,在复杂性方面,O(LOGN)比为O(n),这比O(nlogn),这比O(N2)快了快了快。但对于O(N2)和O(n2log),或O(n2.001)和O(n2log):I know that in terms of complexity, O(logn) is faster than O(n), which...阅读全文
有关系T(N)= T(N-1)+ T(N / 2)+ N T(n) = T(n-1) + T(n/2) + n我可以先解决这个词(T(N-1)+ N),这也是为O(n ^ 2),进而解决项T(N / 2)+ O(N ^ 2)?can I first solve the term (T(n-1) + n) which...阅读全文
由于配重块无向连通图。 W:ê - > {1,2,3,4,5,6,7} - 这意味着,只有7的权重可能。我需要用Prim算法在O(N + M),并Kruskal算法为O找到一个生成树(M * A(M,N))。Given an undirected connected graph with weights. w:E...阅读全文
我试图解决这个问题回溯,并打印所有可能的解决方案。I have tried solving this problem with backtracking and it prints all possible solutions.两个问题上来:1 我可以实现N使用其他技术的女王? 2 是否有可能作出以下打印code只...阅读全文
谁可以告诉我的时间复杂度为以下code?Can someone tell me the time complexity for the following code?#include#includeusing namespace std;int main(){cha...阅读全文
因此,如果给定4N ^ 2,log3中(N),20N,N ^ 2.5的log(n!),N ^ N,3 ^ N,N-的log(n),100N ^(2/3),2 ^ N, 2 ^(N + 1)中,n!,第(n-1)!2 ^ 2n个4n^2, log3(n), 20n, n^2.5, log(n!), n^n, 3^n...阅读全文
字歇(用动态规划:上>下)给定一个字符串s和文字的字典dict,以s加空格来构造一个句子其中每个字是一个有效的字典中的单词。 返回所有这些可能的句子。 例如,因为 S =catsanddog,字典=猫,猫,和,沙,狗。 一个解决方案是[猫与狗,猫沙狗。 问: 在时间复杂度?在空间的复杂性?我个人认为, 在时间复杂...阅读全文
由于2单向链表已经排序,合并列出。 例:List1中:1 2 3 5 7 list2中:0 4 6 7 10 - 0 1 2 3 4 5 6 7 7 10 尽管从这一事实的解决方案是相当简单和有问题的使用或不使用递归(这样的 http://www.geeksforgeeks.org/merge-two-sort...阅读全文
我刚刚做了以下Codility 峰的问题。的问题如下:I've just done the following Codility Peaks problem. The problem is as follows:一个非空的零索引数组A由N个整数给出。一峰比邻国更大的数组元素。更precisely,它是一个索引p,...阅读全文