struct node * convert_array_to_bst(int *arr, int len){
	if (arr == NULL || len <= 0)
		return NULL;
	struct node *root = NULL;
	return my_new_func(root, arr, 0, len - 1);
	
}
struct node *my_new_func(struct node *root, int *arr, int start, int end)
{
	int mid;
	if (start == end)
	{
		//printf("\narr[%d] = %d", start, arr[start]);
		root = Insert(root, arr[start]);
	}
	if (start < end)
	{
		mid = (start + end) / 2;
		//printf("\narr[%d] = %d", mid, arr[mid]);
		
		root = Insert(root, arr[mid]);
		root = my_new_func(root, arr, start, mid - 1);
		root = my_new_func(root, arr, mid + 1, end);
	}
	return root;

}
Example #3
0
int init_module(void)
{
	int		ret;
	ipmi_s_func 	my_ipmi_func;
	new_func 	my_new_func;

	// this is for wdog_panic_handler()
	my_ipmi_func = (ipmi_s_func)0xffffffff880b6065;
	// ret = my_ipmi_func(NULL, 0, NULL);

	// this is for wdog_panic_reset_ipmi_timer()
	my_new_func = (new_func)0xffffffff880b6139;
	my_new_func();

	printk("call_s_func ret %d\n", ret);

	return 0;
}