404
.equals()比较方法如何影响算法的复杂性?会把它从线性变成二次吗?
答案 0 :(得分:0)
分析此算法的运行时,应将.equals()作为基本步骤。计算算法运行时间的重要事项是dataList的大小,从这个意义上说,“ it”的大小是恒定的。
最佳情况下的复杂度由在第一个位置找到元素的情况给出,然后为O(1),最坏的情况是在最后一个位置找到元素时为O(n) 。通过考虑所有可能性(元素位于位置1或位置2等),并正式除以n来给出平均情况:
2019-09-18 09:23:54.310 TRACE 8 --- [qtp254692047-20] s.n.www.protocol.http.HttpURLConnection : KeepAlive stream retrieved from the cache, sun.net.www.protocol.https.HttpsClient(https://privateURL/tokeninfo)
2019-09-18 09:23:54.310 TRACE 8 --- [qtp254692047-20] s.n.www.protocol.http.HttpURLConnection : Proxy used: DIRECT
2019-09-18 09:23:54.310 DEBUG 8 --- [qtp254692047-20] s.n.www.protocol.http.HttpURLConnection : sun.net.www.MessageHeader@3b6fad4e6 pairs: {GET /oauth2/tokeninfo HTTP/1.1: null}{Authorization: Bearer eyJraWQiOi####}{Accept: application/json, application/*+json}{User-Agent: Java/11.0.4}{Host: privateURL.com}{Connection: keep-alive}
2019-09-18 09:23:54.315 DEBUG 8 --- [qtp254692047-20] s.n.www.protocol.http.HttpURLConnection : sun.net.www.MessageHeader@56d0f8f314 pairs: {null: HTTP/1.1 401 Unauthorized}{Date: Wed, 18 Sep 2019 09:23:54 GMT}{Content-Type: application/problem+json}{Transfer-Encoding: chunked}{Connection: keep-alive}{Cache-Control: no-cache, no-store, max-age=0, must-revalidate}{Expires: 0}{Pragma: no-cache}{Server: unspecified}{Strict-Transport-Security: max-age=31536000 ; includeSubDomains}{X-Content-Type-Options: nosniff}{X-Flow-Id: RiNj7zF0fq3MWJBePUzlkA}{X-Frame-Options: DENY}{X-Xss-Protection: 1; mode=block}
2019-09-18 09:23:54.316 DEBUG 8 --- [qtp254692047-20] s.n.www.protocol.http.HttpURLConnection : Server Authentication for AuthenticationHeader: prefer null returned null
2019-09-18 09:23:54.316 DEBUG 8 --- [qtp254692047-20] org.springframework.web.HttpLogging : Response 401 UNAUTHORIZED
2019-09-18 09:23:54.317 DEBUG 8 --- [qtp254692047-20] o.s.w.c.HttpMessageConverterExtractor : Reading to [org.springframework.security.oauth2.common.exceptions.OAuth2Exception]
2019-09-18 09:23:54.318 WARN 8 --- [qtp254692047-20] o.s.b.a.s.o.r.UserInfoTokenServices : Could not fetch user details: class org.springframework.web.client.HttpClientErrorException$Unauthorized, 401 Unauthorized
2019-09-18 09:23:54.318 DEBUG 8 --- [qtp254692047-20] o.s.b.a.s.o.r.UserInfoTokenServices : userinfo returned error: Could not fetch user details
...
2019-09-18 09:23:54.229 DEBUG 8 --- [qtp254692047-18] o.s.b.a.audit.listener.AuditListener : AuditEvent [timestamp=2019-09-18T09:23:54.229553Z, principal=anonymousUser, type=AUTHORIZATION_FAILURE, data={details=org.springframework.security.web.authentication.WebAuthenticationDetails@0: RemoteIpAddress: 99.99.99.99; SessionId: xxx, type=org.springframework.security.access.AccessDeniedException, message=Access is denied}]
...
ttp_server_requests_seconds{exception="None",method="GET",outcome="REDIRECTION",status="302",uri="REDIRECTION",quantile="0.5",} 0.011534336
http_server_requests_seconds{exception="None",method="GET",outcome="REDIRECTION",status="302",uri="REDIRECTION",quantile="0.75",} 0.014680064
http_server_requests_seconds{exception="None",method="GET",outcome="REDIRECTION",status="302",uri="REDIRECTION",quantile="0.95",} 0.047710208
http_server_requests_seconds{exception="None",method="GET",outcome="REDIRECTION",status="302",uri="REDIRECTION",quantile="0.99",} 0.536346624
http_server_requests_seconds_count{exception="None",method="GET",outcome="REDIRECTION",status="302",uri="REDIRECTION",} 14.0
http_server_requests_seconds_sum{exception="None",method="GET",outcome="REDIRECTION",status="302",uri="REDIRECTION",} 0.719216709```
Any pointers on what could be the problem here ?
这也是O(n)