' represents comment, all the given key-value pair will be unique). Operations will be represented as numbers.' />
In this assignment we are going to implement Binary Search Tree (BST) data structure for the 'date of birth (DOB), name' key-value pairs. Your code has to support the following operations('=>' represents comment, all the given key-value pair will be unique). Operations will be represented as numbers.
As before input will be privided in a text file. The first line will have the size of the BST. Following lines will have the key-value pairs to initialize the BST. Then there will be a break marker, '*'. This * should be ignored. Following the * are the operations you need to perform in the BST. For example,
8 => The BST will have 8 nodes
08/15/1975, Mujib => These are all the key-value pairs
05/30/1981, Zia
03/07/1971, Freedom
12/16/1971, Victory
02/21/1952, Molly
01/20/1969, Asad
03/25/1971, Genny
03/26/197, Independent
* => This is the break point, you should ignore this. Following lines will have the required operations.
1, 01/11/2007, Moyeen => This will put the value "Moyeen" using the DOB key as 01/11/2007 and print "Done"
2, 12/16/1971 => This will get the associated value with the key, 12/16/1971 and print "Victory"
3, => This will print (the min) oldest person's name in the console, "02/2/1952, Molly"
4, => This will print (the max) youngest person's name in the console, "01/11/2007, Moyeen"
5, 03/07/1970 => This will print (the floor) the largest DOB that is less than or equal to the given input (03/07/1970): "01/20/1969, Asad"
6, 04/07/1971 => This will print (the ceiling) the smallest DOB that is greater than or equal to given input(04/07/1971): "12/16/1971, Victory"
7, 08/15/1975 => This will print (the rank) number of person's less than the input DOB (08/15/1975): 6
8, => Should print in ascending order, all the key-value pair in the BST
Sample input file:
8
08/15/1975, Mujib
05/30/1981, Zia
03/07/1971, Freedom
12/16/1971, Victory
02/21/1952, Molly
01/20/1969, Asad
03/25/1971, Genny
03/26/1971, Independent
*
1, 01/11/2007, Moyeen
2, 12/16/1971
3,
4,
5, 03/07/1970
6, 04/07/1971
7, 08/15/1975
8,
Sample output:
Done
Vicroty
02/2/1952, Molly
01/11/2007, Moyeen
01/20/1969, Asad
03/25/1971, Genny
6
02/21/1952, Molly
01/20/1969, Asad
03/07/1971, Freedom
03/25/1971, Genny
03/26/1971, Independent
12/16/1971, Victory
08/15/1975, Mujib
05/30/1981, Zia
01/11/2007, Moyeen