Skip to content

Instantly share code, notes, and snippets.

@Goom11
Goom11 / isSearch.cpp
Last active August 29, 2015 14:12 — forked from n2westman/isSearch.cpp
#include <climits>
#include <stack>
typedef struct Holder {
Node* node;
int min;
int max;
Holder(Node* n, int min, int max): node(n), min(min), max(max) {}
} *Holder_p;
@Goom11
Goom11 / isSearch.cpp
Last active August 29, 2015 14:12 — forked from lowellbander/isSearch.cpp
Converted the lowellbander/isSearch.cpp into a one liner solution
#include <climits>
// Cracking the Coding Interview, Question 4.5
// Implement a function to check if a binary tree is a binary search tree
// One-liner version
bool isSearch(Node* root, int max = INT_MAX, int min = INT_MIN) {
return (!root)
|| (
!(root->value <= min)
&& !(root->value > max)
@Goom11
Goom11 / hangman
Created January 4, 2013 23:41 — forked from anonymous/hangman
#include<iostream>
#include<cstring>
using namespace std;
const int MAX_WORD_LEN = 100;
const int TOTAL_LIVES = 10;
int find_len( const char word[] );
void clear_screen();