

I have made the three units alrady but having huge difficulties with the coding of the tree and the passing of data. It contains two units, one the holds the inforamtion form the text file in a link lists and the orders it, then passes to the bianry tree, to store it, from there it is displyed onto the screen. The line numbers should appear in ascending order and, if a word appears on a line of the text more than once, then the line number should appear only once for that word in the cross-reference list. It should display each line of the text preceded by its line number (starting from 1) and then display a list, in alphabetic order, of each word in the text and the line numbers of the lines on which it appears. Do you mean to have just a simple form of associative container, for example: type p_integer = ^integer p_word_node = ^t_word_node t_word_node = record word_key: string word_value: p_integer next_node: p_word_node end This is basically a degenerate tree, which is semantically the same as a single-linked list: p_word_node = ^t_word_node t_word_node = record word_key: string word_value: integer // the value is now part of the node, instead of a child next_node: p_word_node end Did that make sense? Here is the brief You are required to construct a program that will generate a cross-reference listing of a text provided in a file.

It looks to me like all you have is an ordered list.

I'm sorry, but I'm really tired right now and maybe I'm just missing something. In Delphi: type pNode = ^tNode tNode = record word: string left, right: pNode end In Pascal, I'd use a Schema type: type pNode = ^tNode tNode( wordsize: integer ) = record word: string( wordsize ) left, right: pNode end If you can't use Schemata, then just make a simple character array: type pNode = ^tNode tNode = record word: array of char left, right: pNode end Hope this helps. How do I program a binary search algorithm with a hard.Īre you using Delphi or Pascal? (It makes a difference.) All binary trees are just a fancy form of linked-list, so there is no reason why you can't include a string in your node record. If I were still coding in pascal, I would go with AVL trees or Treaps, because they are easier to write compared to other implementations of BBST, such as Red-black trees.
#Contoh program binary search tree pascal update#
What type of binary search trees do Pascal users code in programming contests? Update Cancel.
