We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ea7678e commit ebd15feCopy full SHA for ebd15fe
problem6
@@ -0,0 +1,34 @@
1
+//By A. Divya, CSE
2
+KthElementIterative(struct node * root, int k)
3
+{
4
+struct node * temp = root;
5
+struct node * x;
6
+
7
+push(root);
8
+temp = temp->left;
9
10
+while( stack is not empty)
11
12
13
+while( temp ! = NULL)
14
15
+push( temp );
16
+temp = temp ->left;
17
+}
18
19
+x = pop();
20
+count ++;
21
22
+if(count == k )
23
+break;
24
25
26
+if( x->right)
27
+{push(x-right);temp = x->right;}
28
29
+else temp=null;
30
31
32
33
+return x->data;
34
0 commit comments