考虑下面的算法,通过使用二叉搜索树排序n个元素的列表,该算法的时间复杂度: initialise t to be an empty binary search tree
for each element x in the list,
add x to t
while t is not empty,
remove and print the smallest element
#include<stdio.h>
#include<stdlib.h>
// An AVL tree node
struct node
{
int key;
struct node *left;
struct node *right;
int height;
};
// A utility function to get maximum o
嘿,我必须找到最有效的方法来打印一个数字通过给位置。输入是这样的: 8 (N-> N Numbers)
INS 100 (Add 100 to the tree)
INS 200 (Add 200 to the tree)
INS 300 (Add 300 to the tree)
REM 200 (Remove the number 200 from the tree)
PER 1 (