小编Vla*_*lav的帖子

与 OpenSSL 的多个连接的上下文

我想与 OpenSSL 建立多个连接。

  1. 我应该SSL_CTX context为每个新连接创建新连接还是接受所有连接context

  2. 我是否应该对内存或启动/停止连接执行其他操作,除了

    close(_socket); //socket which accept the connection
    SSL_shutdown(_ssl); //_ssl — SSL connection
    SSL_free (_ssl);
    
    Run Code Online (Sandbox Code Playgroud)

c connection ssl openssl

4
推荐指数
1
解决办法
3081
查看次数

这个算法的复杂性是多少?

我需要计算这段代码的复杂性.我知道它是O(n),但我需要公式中的证据.例如,循环具有复杂性1 + 3*n + n*f(body).

代码1:

int i = 0;
int t = 0;
int j = n/2;
while (i<n) {
    while (t<n/2) {
        t++;
        i++;
    }
    while (j<n) {
        j++;
        i++;
   }
Run Code Online (Sandbox Code Playgroud)

}

UPD:我也需要计算这段代码的复杂性.它与Code 1不同吗?

代码2:

int k = 0;
int i = 0;
int t = 0;
int j = n/2;
while (i<n) {
    k=0;
    while ((t<n/2) && (k<=10)) {
         t++;
         i++;
         k++;
    }
    k=0;
    while ((j<n) && (k<=10)) {
         j++;
         i++;
         k++;
    } …
Run Code Online (Sandbox Code Playgroud)

algorithm complexity-theory time-complexity asymptotic-complexity

0
推荐指数
1
解决办法
120
查看次数