22/12/01

CJB_ny·2022년 12월 1일
0

공부 요약

목록 보기
33/38
post-thumbnail

Algorithm

1. Tree

Tree구현후

재귀함수를 통해 높이, 깊이를 구하는 부분 구현을함.

std::max를 통해서 깊이와 높이를 구하는 부분 이해를 해야됨

이런트리에서

int GetHeight(NodeRef root)
{
	int height = 1;
	
	for (NodeRef& child : root->_children)
	{
		height = std::max(height, GetHeight(child) + 1);
	}

	return height;
}

이정도는 정말 기본적인 문제로 가볍게 나오는 수준의 문제이다.

이거랑 Tree이론 부분 강의 알고리즘 -> 재귀함수로 트리 구현하는 부분 조금 연습함

2. Heap Tree

힙 트리 이론

부모 노드가 항상 자식 노드보다 커야함.

노드 개수를 알면 트리 구조 확신할 수 있다.

data insertion/deletion 할 경우

제 2법칙 부터 사용함.

이런식으로 먼저 넣고 도장깨기 ㄱㄱ.

삭제는 root부터 삭제하고

14를 위로 올림.

그리고 다시 도장깨기. R/L자식 비교해서 큰 자식과 도장깨기한다.

C++20

1. concept

C#의 Generic과 같은거임

  • Requires Clause (절)

  • Trailling Requires Clause (뒤에붙는)

  • Constrained Template Parameter (강요된)

  • Abbreviated Fuction Template

2. module

빌드 시간 개걸리는거 혁명적으로 줄임. exprort, import

좀 혁명적인 부분임 submodule, fragment module방법이 있다.

3. ranges/Views

C# LINQ랑 비슷하다.

std::views::filter([](int n) { return n % 2 == 2; })
	| std::views::transform([]() {} );

https://velog.io/@starkshn/C20#1-방법-4가지

profile
https://cjbworld.tistory.com/ <- 이사중

0개의 댓글