<commit_before><commit_msg>Program to check if given tree is a BST<commit_after>#include <stdio.h>
#include <stdlib.h>
typedef struct node_t node;
struct node_t
{
	/* data */
	int value;
	node * left;
	node * right;
};

bool isBST(node * root){
	static node * prev = NULL;
	if (root == NULL){
		return 1; // Empty tree is also a BST
	}
	if (isBST(root->left)){
		if (prev != NULL && root->value <= prev->value)
			return 0;
			prev = root;
			return isBST(root->right);
	}
	return 1;
}
/* Helper functions*/

node * newNode(int val){
	node * newNode = (node *) malloc(sizeof(node));
	newNode->left = NULL;
	newNode->right = NULL;
	newNode->value = val;
	return newNode;
}


int main(int argc, char const *argv[]){
  node *root = newNode(4);
  root->left        = newNode(2);
  root->right       = newNode(5);
  root->left->left  = newNode(1);
  root->left->right = newNode(3);
  if(isBST(root))
    printf("Given tree is a Binary Search Tree");
  else
    printf("Given tree is NOT a Binary Search Tree"); 
	return 0;
}
{'fraction_non_alphanumeric': 0.15799803729146222, 'fraction_numerical': 0.008832188420019628, 'mean_word_length': 3.3404255319148937, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6574810', 'n_tokens_mistral': 395, 'n_tokens_neox': 370, 'n_words': 111}