#include<stdio.h>
    int main()
{
    static char *s[] = {“one”, “two”, “three”, “four”};
    char **ptr[] = {s+3, s+2, s+1, s}, ***p;
    p = ptr;



    ++p;
    printf("%s", **p+1);
    return 0;
}    
S+2 
Three
P -> &ptr
++p -> &(ptr+1)
*p = s+2
**p = &(three)
**p + 1 = “hree”



#include<stdio.h>
int main(){
   int i = 3;
   int *j;
   int **k;
   j=&i;
   k=&j;
   printf("%u %u %d ",k,*k,**k);
   return 0;
}


*j= 3
k=&j
*k =&i
**k=j=3


Write a function sortedList(node * root)
Input: the ordered binary tree.
Output: The header of a circular doubly linked list.
The list should be arranged so that nodes are in the increasing order. 


Struct node {
    Int data;
    Struct node * small;  // prev
    Struct node * large;  // next
};

     4
    /  \
  2    7   =>                2=>4=>5=>7=>10
       /  \
      5    10

Struct node *flatten(Struct node *root){
    if(!root->small && !root->large){
              root->small = root;
              root->large = root;
              return root;
              }
    if(!root) return NULL;
    Struct node *left = flatten(root->small);
    Struct node *right = flatten(root->large);
    root->small = NULL;
    root->large =NULL;
    root->small=left->small; 
    left->small ->large = root;
    root->large=right;
        right->small->large = left;
        right->small = root;
        return left;
}

results matching ""

    No results matching ""