Search
 
SCRIPT & CODE EXAMPLE
 

C

BSTNode root

void storeInorder(BSTNode root, int arr[])
{
    if (root == NULL)
        return
    storeInorder(root.left, arr)
    arr.append(root.val)
    storeInorder(root.right, arr)
}
boolean isBST(BSTNode root)
{
    int arr[]   // Auxiliary array to store inorder 
    storeInorder(root, arr) // Traverses the array in inorder fashion and stores the result in arr
    // Lets check if arr is in sorted order or not
    for(i = 1 to arr.length - 1)
        if (arr[i] < arr[i-1])
            return False 
    return True
}
Comment

PREVIOUS NEXT
Code Example
C :: reading arrays from stdin c 
C :: curl ftp upload file to directory 
C :: unigine 
C :: check if string is number c 
C :: Multi Select with icons htm; 
C :: __isoc99_sscanf 
C :: 25802 WARNING: lib not found: _pywrap_tensorflow_internal.pyd dependency of D:Devtoolsminicondalibsite-packages ensorflowpythonclient\_pywrap_tf_session.pyd 
C :: diiferent between * and & in c 
C :: write a c program to find out ncr factor of given number 
C :: c program for airthmetic operators 
C :: getopt optstr 
C :: wap in c to input n numbers in an array, find out the sum of odd nos. and even nos. display the numbers whose sum is high. 
C :: tetris rotate shape 
C :: convert curl to http request with authorization header 
C :: cannot reach esp8266 via udp while he is running with a static ip 
C :: print octal in c 
C :: The closest in between 
C :: error: dereferencing pointer to incomplete type 
C :: c ternary operator 
C :: hello world in c language 
C :: in c check if triangle is a right triangle 
Dart :: flutter textformfield hide underline 
Dart :: materialstateproperty 
Dart :: multi dex flutter 
Dart :: flutter textbutton autofocus 
Dart :: close keyboard on button click flutter 
Dart :: int to char dart 
Dart :: iran phone number regex 
Dart :: flutter AnimatedOpacity 
Dart :: flutter column mainaxissize 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =