Skip to content

upesacm/21DaysOfCode-2024

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Questions for Day 16 – (06/07/2024)

DSA:

Question 1: Postorder Traversal Write a function to perform a postorder traversal (left-right-root) on a binary tree.

Inputs:
  • The root node of the binary tree.
Output:
  • The values of the nodes in postorder.
Example:

Binary Tree:

       1
      / \
     2   3
    / \
   4   5

Output: [4, 5, 2, 3, 1]

Question 2: Inorder Traversal Implement a function to perform an inorder traversal (left-root-right) on a binary tree.

Inputs:
  • The root node of the binary tree.
Output:
  • The values of the nodes in inorder.
Example:
Binary Tree:
      1
     / \
    2   3
   / \
  4   5
Output: [4, 2, 5, 1, 3]

WEB-DEV:

  1. 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.
  2. 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.
  3. 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".