Coin Change: Minimum number of coins

Problem: You are given n types of coin denominations of values v(1)<v(2)<…<v(n) (all integers). Assume v(1)=1, so you can always make change for any amount of money C. Give an algorithm which makes change for an amount of money C with as few coins as possible. #include <stdio.h> #include <stdlib.h> int main() { int i,n,den[20],temp[20],min,min_idx, … Read more

Better test names

I have some simple tests written, however, the names are not good…I think, any suggestions on better names? I’m not really sure how these tests should be named. I’m looking for a format or pattern I can follow. [TestClass] public class DoorTests { [TestMethod] public void DoorIsNotVirtualIfNameStartsWithLetterOtherThanV() { var door = new Door {Name = … Read more

Windows socket class

I need some advice to see if my simple Windows socket class is good enough to be used in a simple chat application. #include <iostream> #include <string> #include <Windows.h> class Socket { private: WSADATA wsaData; SOCKET hSocket; sockaddr_in service; std::string addr; USHORT port; int exitCode; bool initializeWSA(); bool initializeSocket(); bool bind(); bool listen(); bool connect(); … Read more