

 Thread Tools  Search this Thread 
#1
 
 
Dictionary with a binary tree I do not know too well the C programming language but I wanted to know if anyone can help me to set a dictionary with a binary tree. I have a text file that contains all the words in the dictionary and I wanted to know if I can insert into a binary tree. I know that normally we should have a piece of code to start but then I have no idea how do I do. 
#2
 
 
Re: Dictionary with a binary tree Read the file with the help of fopen + fgets + fclose, and insert the data into a binary tree which is nothing other than a special linked list. I hope that helps. 
#3
 
 
Re: Dictionary with a binary tree Thanks for that reply But I do not know how to make the binary tree. Can you show me some way may be with the help of some sample code to make the binary tree? 
#4
 
 
Re: Dictionary with a binary tree In computer science, a binary tree is a tree data structure in which each node has at most two children. Typically the child nodes are called left and right. A binary tree is a connected acyclic graph such that the degree of each vertex is no more than 3. It can be shown that in any binary tree, there are exactly two more nodes of degree one than there are of degree three, but there can be any number of nodes of degree two.With the root thus chosen, each vertex will have a uniquely defined parent, and up to two children. Binary trees can be constructed from programming language primitives in several ways. Binary trees can also be stored as an implicit data structure in arrays, and if the tree is a complete binary tree, this method wastes no space. Source: wikipedia For the rest, I said: it's almost like a linked list. 
#5
 
 
Re: Dictionary with a binary tree A binary tree is a treelike structure that is rooted and in which each vertex has at most two children and each child of a vertex is designated as its left or right child Because binary trees have log (base 2) n layers, the average search time for a binary tree is log (base 2) n. To fill an entire binary tree, sorted, takes roughly log (base 2) n * n. First, it is necessary to have a struct, or class, defined as a node. Simple example would be: struct node { int key_value; node *left; node *right; }; 

Tags: binary tree, c programming, dictionary 
Thread Tools  Search this Thread 

Similar Threads for: "Dictionary with a binary tree"  
Thread  Thread Starter  Forum  Replies  Last Post 
What is the difference between binary tree sort and heap sort in data structure  sRIPRIYA  Software Development  3  04012011 01:25 AM 
Algorithm for counting number of nodes in a binary tree  anithachacko  Software Development  1  20042010 01:20 PM 
JAVA binary tree  Daren  Software Development  4  29092009 12:17 AM 
How to Count nodes in Binary Tree ?  Harshini  Software Development  4  23042009 10:54 PM 
Dictionary API for .NET  Pratyush  Software Development  3  24022009 12:17 PM 