In Progress

Delphi: Balanced binary tree control

Implement in Delphi 10.3 (or compatible) two non visual data structure controls called TBinaryKeySearch and TBinaryKeyValueSearch.

These two controls are balanced binary search trees. The controls are identical other than TBinaryKeyValueSearch contains name = value pairs, i.e. each node contains a key just like TBinaryKeySearch but also each key contains a string value.

TBinaryKeySearch must have these methods:

0) Constructor Create(CaseSensitive : Boolean = False); - Creates an instance of the structure. If the given CaseSensitive is False, all Key comparisons of the control must be done as not case sensitive. Note: You can implement this simply by converting all Keys to LowerCase().

1) Function Add(const Key : String) : Boolean; - Returns true if Key was added. Key is not added if key is empty string or if key already exists in the structure.

2) Function Query(const Key : String) : Boolean; - Returns true if Key exists in the structure.

3) Procedure Clear; - Clears the structure.

4) Function Remove(const Key : String) : Boolean; - Removes the given Key. Returns true if the Key was removed. Key is not removed if it does not exist in the structure.

5) Procedure SaveToFile(const Filename : String); - Saves the structure to a text file in human readable format. For example, one key per line.

6) Procedure SerializeToFile(const Filename : String); - Saves the structure to a file.

7) Procedure SerializeFromFile(const Filename : String); - Loads the structure from a file generated by an earlier SerializeToFile() call.

8) Procedure SelfTest(); - Perform a random number of the above methods and verify with assert() they work correctly. For example, add key "foobar" and after verify Query confirms "foobar" exists. The method must test all methods except SaveToFile()

TBinaryKeyValueSearch must have these methods:

0) Constructor Create(CaseSensitive : Boolean = False); - Creates an instance of the structure. If the given CaseSensitive is False, all Key comparisons of the control must be done as not case sensitive. Note: You can implement this simply by converting all Keys to LowerCase(). This does not affect the Values in any ways, i.e. do not convert them lower case.

1) Function Add(const Key, Value : String) : Boolean; - Returns true if Key Value pair was added. Key is not added if key is empty string. If Key already exists in the structure, its value is updated with the given Value. Note: Value can be empty.

2) Function Query(const Key : String; Var Value : String) : Boolean; - Returns true if Key exists in the structure and returns the Value of the key via Value.

3) Procedure Clear; - Clears the structure.

4) Function Remove(const Key : String) : Boolean; - Removes the given Key. Returns true if the Key was removed. Key is not removed if it does not exist in the structure.

5) Procedure SaveToFile(const Filename : String); - Saves the structure to a text file in human readable format. For example, in format of "Key => Value", one pair per line.

6) Procedure SerializeToFile(const Filename : String); - Saves the structure to a file.

7) Procedure SerializeFromFile(const Filename : String); - Loads the structure from a file generated by an earlier SerializeToFile() call.

8) Procedure SelfTest(); - Perform a random number of the above methods and verify with assert() they work correctly. For example, add key "foobar" and after verify Query confirms "foobar" exists. The method must test all methods except SaveToFile()

These controls are used mainly with the Add() and Query() methods and expected data is under 200 000 rows of data with average Key (and Value) lengths of 200 characters. The Remove() is rarely used.

You can use any existing ready made code as a base of this work. Googling "Delphi balanced binary tree" shows up many cases of sample code.

Skills: Delphi

See more: binary tree program web based, binary tree morse code translation, binary tree creator, free binary tree creator, php ajax tree control prado, user control binary tree, binary tree delphi, balanced binary tree, delphi simple binary tree, balanced binary search tree, balanced binary search tree example, balanced binary tree example, balanced binary tree in data structure, balanced binary tree java, binary tree balanced

About the Employer:
( 621 reviews ) Turku, Thailand

Project ID: #19730318

Awarded to:

Snake4eva

Hi, I'm not that verse in Delphi but have messed with it in the past and it is similar to many other programming languages in my repertoire. I am familiar with key search algorithms and have reference text and as you s More

$111 USD in 4 days
(0 Reviews)
0.0

4 freelancers are bidding on average $150 for this job

Rfynther

hi, i can do this project, but need know what you want inheritance from Component or simple Object? TBinaryKeySearch = class(TComponent) or TBinaryKeySearch=class(TObject)? or you want use generics like: TBinaryKeySea More

$250 USD in 7 days
(19 Reviews)
4.9
AntonBliznetc

Hello. You need binary tree pascal code write. Is small task for my I coded delphi from 1998 I have hi degree in information system in economics. Pay only full complete

$99 USD in 3 days
(11 Reviews)
3.2
BlackEagle86

Hi, High talented Delphi, MatLab, Unity, VBA, Access, Microsoft Office, Java, Python and R, C#, C++, QT expert is here! I have graduated from National University of Singapore and received Master Degree there. As I am More

$140 USD in 7 days
(0 Reviews)
0.0