Notice
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 항해99
- NotionAI
- 코린이
- rn
- 프론트엔드
- 필수강의
- D반8조
- TS
- Ai
- 7기
- 알pdf #파일탐색기미리보기안될때
- 실전프로젝트
- 사전준비
- 팀워크최고
- REACT
- 맥린이
- ReactNative
- 웹개발종합반
- 달리기반
- 스파르타코딩클럽
- typeScript
- ChatGPT
- 챗GPT
- 리액트
- 알고리즘기초주차
- TDD
- Expo
- 프로그래머스
- 멍친구
- Programmers
Archives
- Today
- Total
FrontEnd :-)
2. 배열과 오브젝트의 성능 평가 본문
Udemy - 【한글자막】 JavaScript 알고리즘 & 자료구조 마스터클래스 :: 섹션 3 배열과 오브젝트의 성능 평가
객체의 빅오
Big O of Objects
Insertion - O(1)
Removal - O(1)
Searching - O(N)
Access - O(1)
When you don't need any ordering, objects are an excellent choice!
Big O of Object Methods
Object.keys - O(N)
Object.values - O(N)
Object.entries - O(N)
hasOwnProperty - O(1)
Quiz
질문 1:
오브젝트에 키와 값을 추가하기 위한 빅오는 무엇일까요?
답: O(1)
질문 2:
오브젝트의 키에 접근하기 위한 빅오는 무엇일까요?
답: O(1)
질문 3:
오브젝트의 키를 제거하기 위한 빅오는 무엇일까요?
답: O(1)
빅오 배열 메소드
Big O of Arrays
Insertion - It depends....
Removal - It depends....
Searching - O(N)
Access - O(1)
Let's see what we mean by that!
push, pop 작업이 shift, unshift 작업보다 빠르다. (비어있는 배열일 때 제외)
Big O of Array Operations
- push - O(1)
- pop - O(1)
- shift - O(N)
- unshift - O(N)
- concat - O(N)
- slice - O(N)
- splice - O(N)
- sort - O(N * log N)
- forEach/map/filter/reduce/etc. - O(N)
You don't need to know all this...😵
Limitations of Arrays
Inserting at the beginning is not as easy as we might think! There are more efficient data structures for that!
Quiz
질문 1:
배열 안에 데이터를 삽입하는 빅오는 무엇일까요?
답: O(1)
질문 2:
배열 안에 데이터를 이동하는 빅오는 무엇일까요?
답: O(n)
질문 3:
forEach 함수를 위한 빅오는 무엇일까요?
답: O(n)
'JavaScript > Algorithm' 카테고리의 다른 글
Frequency Counter - sameFrequency (0) | 2023.03.14 |
---|---|
3. 문제 해결 접근법 (0) | 2023.03.13 |
1. Big O Notation(표기법) (0) | 2023.03.12 |
programmers 최빈값 구하기 (0) | 2023.03.11 |
programmers 개미 군단 (0) | 2023.03.10 |
Comments