Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Binary tree from a list
#11
It´s against project rules. I have to create other method, which counts nodes, but just from the node given as it´s parameter. Therefore I need to find the reference for this node for that parameter, from "nodes".
Reply
#12
If the node is given as a parameter, why do you need to find the node? I would think that given a node, you would just recursively count the children of the node.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply
#13
It should be non-recursive. And the parameter is just a value of that node (sorry for wrong information in my post above).
Reply
#14
I have a feeling that you are not expected to have a root dictionary, although you could pass it as a parameter to the method. Again, it would help to see your code of the classes, and it would be good to see the actual assignment.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply
#15
Simply, this new method should count nodes in a selected subtree, specified by a given node data. This node represents a root of that subtree, whose nodes it has to count. So what do I want to do, is to find that node data in already created "nodes" (dictionary), to find its Node refference and then apply the basic nodes counting, beginning with this node. However, I have "nodes" in other method and so what I need to know is, how can I use "nodes" also in this new method, without making an attribute for the whole class.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Python Code for Preorder Traversal of a Binary Tree Bolt 1 555 Sep-22-2023, 09:32 AM
Last Post: Gribouillis
  Binary tree AlexPython 3 931 Dec-07-2022, 06:41 AM
Last Post: ndc85430
  Group List Elements according to the Input with the order of binary combination quest_ 19 6,243 Jan-28-2021, 03:36 AM
Last Post: bowlofred
  Python3 binary tree not replacing parent nodes with child nodes Aspect11 0 1,741 Sep-23-2020, 02:22 PM
Last Post: Aspect11
  search binary file and list all founded keyword offset Pyguys 4 2,701 Mar-17-2020, 06:46 AM
Last Post: Pyguys
  hex file to binary or pcap to binary baran01 1 5,630 Dec-11-2019, 10:19 PM
Last Post: Larz60+
  Pack binary data to list of integers bearer 0 2,131 Mar-29-2019, 12:17 PM
Last Post: bearer
  Convert tree to list of lists Dylan_T_Rabbit 2 11,682 Jul-12-2017, 02:09 PM
Last Post: Dylan_T_Rabbit

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020