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<cstring> | |
using namespace std; | |
const int MAX_WORD_LEN = 100; | |
const int TOTAL_LIVES = 10; | |
int find_len( const char word[] ); | |
void clear_screen(); |
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 <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) |
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 <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; |