Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit fb079a0

Browse files
Level 1 Interview Questions
1 parent aa7bd95 commit fb079a0

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

‎KissFlow/Level1.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
Expression - (a+b)*c
2+
3+
*
4+
/ \
5+
+ c
6+
/ \
7+
a b
8+
9+
10+
Basic Implementation:
11+
1. Create Node for each character.
12+
2. InterConnect with each other.
13+
3. Then Make postfix traversal.
14+
15+
Create Node:
16+
17+
struct Node {
18+
char value;
19+
struct Node* left;
20+
struct Node* right;
21+
};
22+
23+
Allocate Memory and Connection:
24+
25+
struct Node* createNode(char c){
26+
struct Node* node=(struct Node*)malloc(sizeof(struct Node));
27+
node->value=c;
28+
node->left=null;
29+
node->right=null;
30+
return node;
31+
}
32+
33+
Connection Between Nodes:
34+
35+
struct Node* Create(){
36+
struct Node* head = createNode('*');
37+
head->right=createNode('c');
38+
head->left=createNode('+');
39+
head->left->left=createNode('a');
40+
head->left->right=createNode('b');
41+
return root;
42+
}
43+
44+
Postfix Expression:
45+
46+
void Postfix(struct Node* head){
47+
if(head!=null){
48+
postfix(head->left);
49+
printf("%d ",head->value);
50+
postfix(head->right);
51+
}
52+
}
53+

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /