사실 아직 통과할 테스트가 많이 남았음에도, 주석조차 쓰지 않은 문제들이 있음에도 불구하고 6시에 제출하고 HA를 마무리하신 분들이 훨씬 더 많이 확인되었습니다.
풀어보셔서 아시겠지만, 첫 HA는 개념의 내용을 십분 활용한다기 보단 기본적으로 알고리즘적인 접근을 요하는 Assessment입니다.
단순히 개념이 부족해서 어려운 것이 아닙니다. 고민하는 시간의 절댓값만큼 테스트 통과율은 무조건 올라갑니다.
하지만 충분히 시도해보지 않고 제출하고 끝내버리신 분들이 많은 것 같아 걱정과 아쉬운 마음이 듭니다.
앞으로의 스프린트들은, 이전보다 더 스프린트끼리 의존도가 높고, 처음 접했을 때 이해하기 쉽지 않은 방대한 범위의 개념들 또한 포함되어 있기 때문에 이전보다 훨씬 더 많은 치열함과 끈질김을 요구합니다.
“내가 정말 최선을 다 했을까” 돌아보셨으면 좋겠습니다.
코스 리플렉션 시간에 말씀드린 것처럼 솔로 데이 때는 가장 먼저 어제 푼 HA를 다시 공부해서 100%로 채우는 것을 목표로 해 주시기 바랍니다. - code 형찬 님이 작성하신 글을 가져와 봤습니다.
시작하기에 앞서 객관식으로 문제를 푸는 문제와 간단한 개념을 알고 있는지 확인하는 것들로 시작해서 단계별로 올라갈 수 있도록 차례대로 놓으신 것 같다는 생각이 들었다. 복잡도를 시작으로 트리까지 일단 알고리즘적으로 표현하는 게 중요하다는 것을 알게 되었고 코드 구현은 못하더라도 그다음 문제라고 생각이 들기도 합니다. 한 번에 다 갈 수 없다는 것을 알고 있지만 한 번에 못 간다는 것에 좌절하는 나의 모습을 보면서 아 나는 어쩔 수 없는 한국사람인가 완벽을 원하고 한국인 특성상 빨리빨리에 시대에 살아와서 그런지 그만큼 좌절이 깊게 들어가는 것 같은 내 모습을 보면서 반성을 하는 시간을 가져보도록 한다.
algo-complexity
문제는 총 3문제로 나왔으며, 일단 영어로 나와있어서 번역기 돌리면서 풀었었다.
var TimeComplexity = {
FIX_ME: 'wrong answer',
CONSTANT: 'constant',
LOGARITHMIC: 'logarithmic',
LINEAR: 'linear',
QUADRATIC: 'quadratic',
EXPONENTIAL: 'exponential'
};
exports.TimeComplexity = TimeComplexity;
Problem 1: Sum the squares of the values in a given array. [ 문제 1: 주어진 배열의 값의 제곱을 합한다. ]
exports.sumSquaresTimeComplexity = TimeComplexity.fixme
var sumSquares = function(array) {
return array.reduce(function(memo, val) {
return memo + (Math.pow(val, 2));
});
};
Problem 2: Calculate the n-th power of given number. [ 문제 2 : 주어진 숫자의 n 번째 거듭 제곱을 계산합니다. ]
exports.nthPowerTimeComplexity = TimeComplexity.fixme; // TODO: Update this constant
var nthPower = function(base, exponent) {
// Base case:
if (exponent === 0) {
return 1;
// If exponent is odd
} else if (exponent % 2 !== 0) {
return base * nthPower(base, exponent - 1);
// If exponent is even
} else {
return nthPower(base * base, exponent / 2);
}
};
Problem 3: Generate every sequence of throws for an n-round rock-paper-scissors game. [ 문제 3: n라운드 가위바위보 게임을 위해 모든 연속 투구를 생성한다. ]
exports.rockPaperScissorsTimeComplexity = TimeComplexity.fixme; // TODO: Update this constant
var rockPaperScissors = function(rounds) {
var sequences = [];
var plays = ['rock', 'paper', 'scissors'];
var generate = function(sequence, round) {
// Base case:
if (round === rounds) {
sequences.push(sequence);
} else {
plays.forEach(function(play) {
generate(sequence.concat(play), round + 1);
});
}
};
generate([], 0);
return sequences;
};
pseudocode
Problem 1: Sum the squares of the values in a given array.
배열의 모든 엘리먼트들을 각각 제곱해서 더해져야 하는 함수이기 때문에 0(n)이라는 순차 탐색을 사용
Problem 2: Calculate the n-th power of given number.
재귀 함수를 통해서 exponent -1 과 / 2 계산되어 문제를 해결하는데 필요한 단계들이 연산마다 특정 요인에 의해 줄어드는 것을 알 수 있기 때문에 복잡도는 0(lon n)
Problem 3: Generate every sequence of throws for an n-round rock-paper-scissors game.
가위바위보에서 라운드가 올라갈수록 경우의 수가 늘어나기떄문에 문제를 해결하기 위해서는 3배씩 늘어나는 것을 알 수 있다.
따라서 0(3^n)으로 알 수 있다.
ds-queue
queue에 관한 것을 생각해보고 풀어보는 방식으로 기본적인 삽입과 삭제에 대해서 출제를 하신 것 같다.
/* CODE GOES HERE
* Don't forget newlines at the end of all files :) */
var Queue = function () {
}
Queue.prototype.add = function (value) {
};
Queue.prototype.remove = function () {
};
module.exports = Queue;2
처음에는 Queue에 대한 것을 일단 알고 있어야 어떻게 돌아가는지 알게 될 것이다. Queue는 Data Structure의 한 부분이며, 놀이공원에서 서는 줄과 같이 작동합니다. 사람들이 맨 끝에 줄을 서고, 맨 앞에서부터 놀이기구에 탑승하는 것과 같다고 보면 된다 (FIFO)
pseudocode
1. 맨 앞부분과, 맨 뒤에 부분을 설정해주는 할당 값을 만든 뒤에 저장소에 저장소에 저장하는 방식도 같이 만들어준다.
2. add 부분은 저장소에서 들어올 때 뒤에 있는 곳이 들어오는 것을 설정해주도록 만들어 놓는다.
3. remove는 add 부분에서 들어올 시에 앞에서 나갈 수 있도록 하는 방식을 만들어 주면 될 것 같다.
ㄹ
ㄹㄷ
ㄷㄹㄷㄹㄷㄹ
js-inheritance-pseudo-classical-alt.
// We've provided `makeHorse` and `makeFlyingHorse` for you, written using the
// functional pattern. Your task is to rewrite these classes to use the
// pseudoclassical pattern. They should have all the same methods as the
// objects returned from the maker functions except in pseudo classical style.
// You must be able to use your new functions to create new horse instances,
// just like this:
//
// var myHorse = new Horse();
// var myFlyingHorse = new FlyingHorse();
//
// DO NOT MODIFY FUNCTIONS 'makeHorse' AND 'makeFlyingHorse'
// USE THE CONSTRUCTOR FUNCTIONS LOCATED AT THE END OF THIS FILE
var makeHorse = function (name) {
var result = {};
result.name = name;
result.goSomewhere = function (destination) {
return name + ' is galloping to ' + destination + '!';
};
return result;
};
var makeFlyingHorse = function (name, color) {
var result = makeHorse(name);
result.color = color;
var oldGoSomewhere = result.goSomewhere;
result.goSomewhere = function (destination, milesToDestination) {
if (milesToDestination < 10) {
return oldGoSomewhere(destination);
} else {
return name + ' is flying to ' + destination + '!';
}
};
return result;
};
// YOUR WORK GOES BELOW
// Here's some starter code to get you going!
var Horse = function (name) {
this.name = name;
};
Horse.prototype.goSomewhere = function (destination) {
return this.name + " is galloping to " + destination + "!";
};
var FlyingHorse = function (name, color) {
Horse.call(this, name);
this.color = color;
};
FlyingHorse.prototype = Object.create(Horse.prototype);
FlyingHorse.prototype.constructor = FlyingHorse;
FlyingHorse.prototype.goSomewhere = function (destination, milesToDestination) {
if (milesToDestination < 10) {
return Horse.prototype.goSomewhere.call(this, destination);
} else {
return this.name + " is flying to " + destination + "!";
}
};
module.exports = {
Horse,
FlyingHorse
}
recursion-print-array.js
/* CODE GOES HERE
* Don't forget newlines at the end of all files :) */
var printArray = function printArr() {
}
module.exports = printArray;
this-keyword.js
// Example use :
//
// sport.playerNames();
// returns ["Lebron James plays basketball", "Kevin Durant plays basketball"]
var sport = {
name: 'basketball',
players: [
{ name: 'LeBron James', age: 31 },
{ name: 'Kevin Durant', age: 28 }
],
playerNames: function () {
};
module.exports = sport;
tree-map.js
/**
*
* Implement a `addChild` and map` method on this Tree class, using psuedoclassical instantiation.
*
* Map accepts a mapping function as its only argument. It traverses the tree,
* passing each node's value into the mapping function, and generates a new
* tree containing the results.
*
* So `map` should return a tree with the same structure, and different values,
* but it should NOT modify the tree that was passed in.
*
* Example:
* var root1 = new Tree(1);
* var branch2 = root1.addChild(2);
* var branch3 = root1.addChild(3);
* var leaf4 = branch2.addChild(4);
* var leaf5 = branch2.addChild(5);
* var leaf6 = branch3.addChild(6);
* var leaf7 = branch3.addChild(7);
* var newTree = root1.map(function (value) {
* return value * 2;
* })
* newTree.value // 2
* newTree.children[0].value // 4
* newTree.children[1].value // 6
* newTree.children[0].children[1].value // 10
* newTree.children[1].children[1].value // 14
* root1.value // still 1
*/
var Tree = function(value) {
this.value = value;
this.children = [];
};
Tree.prototype.addChild = function() {
};
Tree.prototype.map = function() {
};
module.exports = Tree;
'Codestates > Full IM' 카테고리의 다른 글
IM Basic CS Section을 마치며. (0) | 2020.08.04 |
---|---|
Algorithms (0) | 2020.08.03 |
Subclass Dance Party (0) | 2020.07.30 |
BeesBeesBees (0) | 2020.07.30 |
Inheritance patterns (0) | 2020.07.30 |