프로그래밍4 Dijkstra's algorithm(다익스트라 알고리즘) Dijkstra's algorithm은 graph의 node 사이의 shortest path를 찾는 알고리즘입니다. pseudocode 는 다음과 같습니다. 1 function Dijkstra(Graph, source): 2 3 create vertex set Q 4 5 for each vertex v in Graph: // Initialization 6 dist[v] ← INFINITY // Unknown distance from source to v 7 prev[v] ← UNDEFINED // Previous node in optimal path from source 8 add v to Q // All nodes initially in Q (unvisited nodes) 9 10 dist[source.. 2017. 5. 29. functionally complete가 아닌 경우 5가지 중 하나에 해당하는 경우 functionally complete하지 않습니다. monotonic : changing the truth value of any connected variable from false to true never makes the return value change from true to false;self-dual : reversing the truth value of the connected variables revers the truth value of the return value;affine : each connected variable either always or never affects the truth value of the return value;truth.. 2017. 4. 11. 비정적 멤버 참조는 특정 개체에 대해 상대적이어야 합니다. 클래스 static 메서드에서 클래스 멤버변수를 사용했는지 확인해봅시다. http://softwareengineering.stackexchange.com/questions/284088/why-static-methods-cant-call-non-static-methods-directly 2017. 4. 2. string에서 single char를 int로 변환하는 법 ASCII에서 0 ~ 9까지는 48에서 57로 표현됩니다. string str = "123456789";int x = 0;x = str[3] - '0'; 따라서 이런 방식으로 ASCII 코드의 차이를 이용해서 변환시키면 됩니다. 사실 C++ standard class에서 지원하는 것이 있는지 찾아보다가 그냥 C 스타일로 하는 방법으로 하는 것이 더 편할 것 같아서 이 방법을 쓰시면 될 것 같습니다. 혹시 standard class를 찾으신다면 std::stringstream을 찾아보시면 있을 것 같습니다. http://www.cplusplus.com/reference/sstream/stringstream/?kw=stringstream 2017. 4. 2. 이전 1 다음