This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TABLE TO TREE ALGORITHM PSEUDOCODE | |
The algorithm can traverse and read an infinite number of cells of an | |
infinite number of depth, as it reads the cells in a recursive fashion | |
with the base case as the leaf of the cells. Note that you should not | |
think this will work for graphs (there's simply no way you could | |
represent graphs in a table structure anyway). | |
Some Notes: | |
- A cell is either a leaf or a branch. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
const int SIZE = 4; | |
void printArray(int arr[], int size) | |
{ | |
for ( int i = 0; i < size; i++ ) | |
cout << arr[i] << ' '; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cmath> | |
using namespace std; | |
// rounds a double variable to nPlaces decimal places | |
double Round(double dbVal, int nPlaces /* = 0 */) | |
{ | |
const double dbShift = pow(10.0, nPlaces); | |
return floor(dbVal * dbShift + 0.5) / dbShift; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <memory> | |
#include <string> | |
#include <cassert> | |
#include "Point.hpp" | |
class PointMan | |
{ | |
public: | |
static const size_t SIZE = 3; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <sstream> | |
#include <iostream> | |
class Point | |
{ | |
public: | |
typedef std::shared_ptr<Point> SPtr; | |
typedef std::unique_ptr<Point> UPtr; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.SUFFIXES: .cpp | |
#for sgi -- comment out the lines below to use on HP | |
#CC=CC -g0 -o32 | |
#CC=gcc | |
# Compiler options | |
#OPTS=-g | |
#OPTS=-O0 | |
#OPTS=-O3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// simple matrix calculator | |
#include <iostream> | |
#include <cstdlib> | |
#include <limits> | |
// A 3x3 matrix | |
const int M_SIZE = 3; | |
typedef double matrix[M_SIZE][M_SIZE]; | |
// function prototypes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define _USE_MATH_DEFINES | |
#include <iostream> | |
#include <cmath> | |
#include <windows.h> | |
using namespace std; | |
int main() | |
{ | |
for (int i = 0; i < 100000; i++) { |