Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

https://1drv.ms/w/c/a8770d713b7ef149/EUqovsn-mgZOkTqsLZ9t-SoBpRS528X_dNj1fhHkpcu1zQ?e=p3FIm4 #1

Open
aiby-jeffrey opened this issue Jan 21, 2025 · 0 comments

Comments

@aiby-jeffrey
Copy link
Owner

https://1drv.ms/w/c/a8770d713b7ef149/EUqovsn-mgZOkTqsLZ9t-SoBpRS528X_dNj1fhHkpcu1zQ?e=p3FIm4=class TreeNode:
def init(self, value):
self.value = value
self.children = []

def add_child(self, child_node):
    self.children.append(child_node)

Define custom operations

def unminus(a, b):
return a - b

def unadd(a, b):
return a + b

Create tree nodes

root = TreeNode("A1")
root.add_child(TreeNode("A2"))
root.add_child(TreeNode("B1"))

Example of custom operations

result1 = unminus(5, 4)
result2 = unadd(12, 13)

print(f"Result of 5 UNMINUS 4: {result1}")
print(f"Result of 12 UNADD 13: {result2}")

Example of AI model placeholders

def ai_model_vol_pyramid(input_data):
return "Factual Need Input Processed"

def ai_model_prism(input_data):
return "Creative and Imagination Processed"

Using AI model functions

factual_output = ai_model_vol_pyramid("Wikipedia Search")
creative_output = ai_model_prism("Creative Input")

print(f"AI Model VOL.PYRAMID Output: {factual_output}")
print(f"AI Model PRISM Output: {creative_output}")root.left.leftself.valroot.rightself.leftself.rightroot.leftroot.left.rightself.valueroot.rightself.childrenclass Node:
def init(self, key):
self.left = None
self.right = None
self.val = key

Inorder traversal of a binary tree

def inorder_traversal(root):
if root:
# First recur on left child
inorder_traversal(root.left)
# Then print the data of the node
print(root.val, end=' ')
# Finally, recur on right child
inorder_traversal(root.right)

Preorder traversal of a binary tree

def preorder_traversal(root):
if root:
# First print the data of the node
print(root.val, end=' ')
# Then recur on left child
preorder_traversal(root.left)
# Finally, recur on right child
preorder_traversal(root.right)

Postorder traversal of a binary tree

def postorder_traversal(root):
if root:
# First recur on left child
postorder_traversal(root.left)
# Then recur on right child
postorder_traversal(root.right)
# Finally, print the data of the node
print(root.val, end=' ')

Example usage

root = Node(1)
root.left = Node(2)
root.right = Node(3)
root.left.left = Node(4)
root.left.right = Node(5)

print("Inorder traversal of binary tree is")
inorder_traversal(root)

print("\nPreorder traversal of binary tree is")
preorder_traversal(root)

print("\nPostorder traversal of binary tree is")
postorder_traversal(root)traverse_tree is equal to the UNMINUS and unadd command in JCODEPY my personal ai code language class TreeNode:
def init(self, value):
self.value = value
self.children = []

def add_child(self, child_node):
    self.children.append(child_node)

Define custom operations

def unminus(a, b):
return a - b

def unadd(a, b):
return a + b

Create tree nodes

root = TreeNode("A1")
root.add_child(TreeNode("A2"))
root.add_child(TreeNode("B1"))

Example of custom operations

result1 = unminus(5, 4)
result2 = unadd(12, 13)

print(f"Result of 5 UNMINUS 4: {result1}")
print(f"Result of 12 UNADD 13: {result2}")

Example of AI model placeholders

def ai_model_vol_pyramid(input_data):
return "Factual Need Input Processed"

def ai_model_prism(input_data):
return "Creative and Imagination Processed"

Using AI model functions

factual_output = ai_model_vol_pyramid("Wikipedia Search")
creative_output = ai_model_prism("Creative Input")

print(f"AI Model VOL.PYRAMID Output: {factual_output}")
print(f"AI Model PRISM Output: {creative_output}")125self.valueself.childrenreplacement and reproduction of AI robot in JCODEPY jplayground xaomi sandbox and reproduction in general taking place at [email protected] FACTORIES WORLDWIDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant