728x90

분류 전체보기 36

1장 사용자 수에 따른 규모 확장성

* Scale up : 수직적 규모 확장( CPU, RAM등을 추가하는 행위) 1. 트래픽의 양이 적을때는 좋은 선택 2. 한대에 서버에 CPU 나 RAM등이 메모리 확장은 한계가 있음 3. 장애에 대한 자동복구 방안이나 다중화 방안을 제시하지 않음. => 따라서 Scale out(수평적 규모 확장)을 서비스를 위한 선택으로 선호 함 * Scale Out : 수평적 규모 확장(더 많은 서버를 추가하여 성능 향상) * 로드 밸런서 부하 분산 집합(load balancing set)에 속한 웹 서버들에게 트래픽 부하를 고르게 분산하는 역할 * 데이터 베이스 다중화 읽기 기능만을 제공하는 부 데이터 베이스(replica)를 둠으로써 성능 향상을 꾀함(application은 주로 쓰기 보다는 읽기 동작을 많이 ..

HackerRank, C++, Bit Array

data type에 따른 값의 크기와, cycle을 어떻게 처리할지에 대해 고민 할 수 있는 문제 #include #include #include #include #include using namespace std; #include int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ unsigned int N,S,P,Q; cin >> N; cin >> S >> P >> Q; unsigned int bigNumber = pow(2,31); unsigned int a0 = S; unsigned long long a = a0; unsigned long long a1 = a0; unsigned int i = ..

HackerRank, C++, C++ Variadics

비트 연산과 파라미터 팩, variadics를 섞은 문제. variadics를 이해하는데 좀 시간이 들었고, 이후 파라미터 팩이 뭔지, 비트연산에 대해 공부하면서 많은 시간이 들은 문제 이다. 시간을 정해서 비트연산을 따로 정리해봐야 겠다.(문제를 풀면서) #include #include #include #include #include using namespace std; // Code Start ============================================== template int reversed_binary_value(){ int result = 0; bool ary[sizeof...(digits)] = { digits... }; for(int i = 0 ; i < sizeof(a..

HackerRank, C++, Class Template Specialization

class template specialization을 처음 써봤다. Template 변수로 설정해서 모든 타입에 대해서만 사용하는 것이 아니라, 내가 직접 특정 타입을 선택해서 사용 할 수 도 있다. 이때는 template를 써주긴 해야 한다. 예를들어 공통 된 template을 위에서 만들고, 특정 color와 fruit이라는 enum을 위한 특별한 template을 만들었다. #include using namespace std; enum class Fruit { apple, orange, pear }; enum class Color { red, green, orange }; template struct Traits; // Define specializations for the Traits class..

HackerRank, c++, Attending Workshops

greedy algorithm 문제, 이걸 모든 경우의 수를 계산해서 접근하는 방식으로 생각했으나, 말이 안되는 거라 생각했더니 greedy algorithm 이더라, 즉 workshop이 시작하는 시간으로 정렬(예외가 있음) workshop이 진행되는 시간이 가장 낮은 것으로 정렬(예외가 있음) workshop이 마무리 되는 시간으로 정렬.. #include using namespace std; #include //Define the structs Workshops and Available_Workshops. //Implement the functions initialize and CalculateMaxWorkshops struct Workshops{ int startTime; int endTime; ..

HackerRank, c++, Magic Spells

AquaVitae is not, and when you compare it with AruTaVae in your spell journal, you get a sequence: AuaVae => 이 라인때문에 당황함,, 결론은 dynamic_cast와 LCS(longgest common substring) 문제 였음;; 문제 이해 안되서 해답보고 이해한 문제;; void counterspell(Spell *spell) { /* Enter your code here */ Fireball* fireball; Frostbite* frostbite; Waterbolt* waterbolt; Thunderstorm* thunderstorm; Spell* spellPointer; if((fireball = dynam..

HackerRank, C++, Accessing Inherited Functions

간단한 소인수 분해 문제. 2,3,5의 횟수를 세면됨. class D : public A, public B, public C { int val; public: //Initially val is 1 D() { val = 1; } //Implement this function void update_val(int new_val) { while(new_val % 2 == 0) { A::func(val); new_val /= 2; } while(new_val % 3 == 0) { B::func(val); new_val /= 3; } while(new_val % 5 == 0) { C::func(val); new_val /= 5; } } //For Checking Purpose void check(int); //Do..

728x90