Question 1: Postorder Traversal Write a function to perform a postorder traversal (left-right-root) on a binary tree.
- The root node of the binary tree.
- The values of the nodes in postorder.
1
/ \
2 3
/ \
4 5
Question 2: Inorder Traversal Implement a function to perform an inorder traversal (left-root-right) on a binary tree.
- The root node of the binary tree.
- The values of the nodes in inorder.
Binary Tree:
1
/ \
2 3
/ \
4 5
- Create a React functional component called GreetUser that takes a username prop and displays a personalized greeting. If no username is provided, display a generic greeting.
- Create a React component called NameForm that includes a form with a single input field (name). Display an alert with the entered name when the form is submitted.
- Create a React component called InputLengthChecker that includes an input field for text. Display a message indicating "Too short" if the input length is less than 5 characters, otherwise display "Long enough".