input = [73,74,75,71,69,72,76,73] cnt =0 cntarr=[0] * len(input) for x in range(len(input)): for y in range(x+1, len(input)): cnt +=1 if input[y] > input[x]: cntarr[x] = cnt cnt=0 break else: continue else : cnt=0 cntarr[x] = cnt print(cntarr) 문제에 대해서 위와같이 풀었을때 (1) input = [73,74,75,71,69,72,76,73] cntarr=[0] * len(input) 리스트 넣는 시간복잡도가 O(n) (2) for x in range(len(input)): for y in range(x+1, len(input)): 이중반복문 시간복잡도가 (n-1)! 이니까 O(n) (3) if input[y] > input[x]: 리스트의 요소 비교의 시간 복잡도가 O(1) 첫 번째 질문으로 이 식의 시간복잡도가 O(n) 인것이 맞는지 궁금합니다. 두 번째는 for x in range(len(input)): for y in range(x+1, len(input)): 위와 같은 이중반복문도 완전탐색이라고 하는 지 궁금합니다. 답변주시면 정말 감사하겠습니다.
TestRestTemplate은 스프링 테스트에서 제공하는 라이브러리로 알고 있습니다. 굳이 스프링에서 제공하는 라이브러리 말고 외부 라이브러리인 RestAssured를 사용하는 이유가 따로 있을까요? 제가 아무리 검색해도 시원한 답변을 찾을 수가 없었습니다. 둘의 장단점이나 차이점을 좀 알고 싶습니다.
자바와 스프링 부트로 생애 최초 서버 만들기, 누구나 쉽게 개발부터 배포까지! [서버 개발 올인원 패키지]
안녕하세요 선생님. jdbcTemplate.query(readSql, (rs, rowNum) -> 0, request.getId())에서 (rs, rowNum) -> 0과 request.getId()의 자리가 바뀌면 안 되나요? 왜 위치가 저런 건가요? 그리고 왜 수정은 id 기준이고 삭제는 이름 기준인가요?
AttributeError AttributeError: 'Cursor' object has no attribute 'count' Traceback (most recent call last) File "C:\Users\hongbh\AppData\Roaming\Python\Python311\site-packages\flask\app.py", line 2551 , in __call__ return self.wsgi_app(environ, start_response) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\hongbh\AppData\Roaming\Python\Python311\site-packages\flask\app.py", line 2531 , in wsgi_app response = self.handle_exception(e) ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\hongbh\AppData\Roaming\Python\Python311\site-packages\flask\app.py", line 2528 , in wsgi_app response = self.full_dispatch_request() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\hongbh\AppData\Roaming\Python\Python311\site-packages\flask\app.py", line 1825 , in full_dispatch_request rv = self.handle_user_exception(e) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\hongbh\AppData\Roaming\Python\Python311\site-packages\flask\app.py", line 1823 , in full_dispatch_request rv = self.dispatch_request() ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\hongbh\AppData\Roaming\Python\Python311\site-packages\flask\app.py", line 1799 , in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\PM_WebService\main\member.py", line 23 , in member_join cnt = members.find({"email": email}).count() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'Cursor' object has no attribute 'count' The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error. To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side. You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection: dump() shows all variables in the frame dump(obj) dumps all that's known about the object
함수형 인터페이스(전반전) 강의를 듣는 도중 pulbic static void convertUSD(Convertible converter, int USD) { converter.convert(USD); } 메소드가 어떤식으로 동작되는지 궁금합니다. 추가로 클래스를 생성하고 객체 생성 후 객체를 어떠한 메소드의 변수로 넣었을 때 어떤 식으로 동작되는지 어떨때 사용하는지 예시로 알려주신다면 정말 감사합니다..
안녕하십니까. 수업을 듣고 연습을 하던 중 문제가 생겨서 글 남깁니다. 제가 Random Forest, LGBM으로 기기의 출력을 예측하는 과정을 하고 있는데 각각 단일 앙상블 학습보다 RF와 LGBM을 조합한 스태킹 학습을 통해 예측 성능을 높이려고 했는데 단일 앙상블 학습의 예측 성능이 MAE기준 1점 정도 더 높게 나왔습니다. 스태킹 학습을 통해 성능을 살짝만 올리면 원하는 목적에 달성할 수 있을 거 같은데 어떻게 하면 좋을까요? 현재 RF, LGBM, XGB, Linear 회귀 알고리즘을 조합하여 도전을 해봤는데도 예측성능이 오르질 않네요 ㅠㅠ
string qurad(int y, int x, int size){ if(size == 1) return string(1, a[y][x]); char b = a[y][x]; string ret = ""; bool flag = 0; for(int i = y; i < y + size; i++){ for(int j = x; j < x + size; j++){ if(b != a[i][j]){ ret += '('; ret += quard(y, x, size / 2); ret += quard(y, x + size / 2, size / 2); ret += quard(y + size / 2, x, size / 2); ret += quard(y + size / 2, x + size / 2, size / 2); ret += ')'; return ret; } } } return string(1, a[y][x]); } 안녕하세요 선생님 항상 좋은 강의를 올려주셔서 감사합니다. 위에 있는 코드에서 변수 flag는 사용되지 않았는데 혹시 flag를 변수를 선언할 때 어떤 의도로 선언했는지 알려주실 수 있나요?
아래 명령어를 통해 transaction이 실패했을 때 원복한다고 하는데, 저런 것은 catch문에 넣어야 하는 것이 맞나요? 아니면 if else로 문제점을 발견했을 때 처리하게 하는 걸까요? 즉, 저 코드를 실제로 사용할 때, 어떤 모습으로 들어가는 지 궁금합니다. session.abortTransaction()