<commit_before>#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#include "phonebook_opt_bst.h"

//search by bst
entry *findName(char lastName[], entry *pHead)
{
    entry *temp = pHead;
    int cmp;
    while (temp) {
        cmp = strcmp(lastName, temp->lastName);
        if (!cmp)
            return temp;
        temp = (cmp < 0) ? temp->pLeft : temp->pRight;
    }
    return NULL;
}

//recursively create balanced bst
entry *new_balance_bst(entry *root, int num, FILE *fp)
{
    if(!num)
        return NULL;

    //new tree root
    entry *bst_root = NULL;
    bst_root = balance_bst(bst_root, num, root, fp);
    return bst_root;
}




entry *balance_bst(entry *e, int num, entry *root, FILE *fp)
{
    //return if current node is leaf
    if(!num)
        return NULL;

    //malloc e if NULL
    if(!e) {
        e = (entry *) malloc(sizeof(entry));
        e->pRight = NULL;
        e->pLeft = NULL;
    }

    int mid = (num +1)/2;
    int i;<commit_msg>Remove extra blank lines<commit_after>#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#include "phonebook_opt_bst.h"

//search by bst
entry *findName(char lastName[], entry *pHead)
{
    entry *temp = pHead;
    int cmp;
    while (temp) {
        cmp = strcmp(lastName, temp->lastName);
        if (!cmp)
            return temp;
        temp = (cmp < 0) ? temp->pLeft : temp->pRight;
    }
    return NULL;
}

//recursively create balanced bst
entry *new_balance_bst(entry *root, int num, FILE *fp)
{
    if(!num)
        return NULL;

    //new tree root
    entry *bst_root = NULL;
    bst_root = balance_bst(bst_root, num, root, fp);
    return bst_root;
}

entry *balance_bst(entry *e, int num, entry *root, FILE *fp)
{
    //return if current node is leaf
    if(!num)
        return NULL;

    //malloc e if NULL
    if(!e) {
        e = (entry *) malloc(sizeof(entry));
        e->pRight = NULL;
        e->pLeft = NULL;
    }

    int mid = (num +1)/2;
    int i;
{'fraction_non_alphanumeric': 0.13863404689092762, 'fraction_numerical': 0.0030581039755351682, 'mean_word_length': 2.3214890016920475, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 19, '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': '1734560', 'n_tokens_mistral': 717, 'n_tokens_neox': 694, 'n_words': 202}