Skip to content

Conversation

@SumangalaRao
Copy link
Owner

about the code:

  • i've written a simple brute force way to implement binary tree in C.
  • i"ve used structure data type to define nodes of the the tree,each node of the tree(struct tree) is provided with left and right links to build up the tree and connect to next nodes in other words it is simple doubly linked list with the feature of defining links on my own i.e,to insert either to the left or to the right.
  • it is not menu driven or user interactive since the main purpose was to implement only
  • insert function: integer type value is stored in each node,the order in which the nodes are inserted is root,left,right.
  • print function: prints the value of the node in a recursive way,where all left nodes are listed first then right nodes.eg:1,2,3,4,5,6(order of insertion)->1 2 4 5 6 3(print order using recursion)
  • delete function: here i've stored -1 instead of the value if it is to be deleted.I did not resturcture or delete the node because there is no rule to be followed since it is not a binary search tree.(if this is wrong let me know)

int main()

{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make the interface as generic as possible by taking inputs from stdin. And do test your code for large inputs, for example, 10000 elements.

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

Successfully merging this pull request may close these issues.

3 participants