Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please give the solution in C language only and attach the output screenshot QA23.2 As part of MNTIP scholarship programme, first name, last name, gender,

Please give the solution in C language only and attach the output screenshot

QA23.2 As part of MNTIP scholarship programme, first name, last name, gender, date of bith, department

and CGPA of fourth semester students of NITC are gathered. The scholarship is for four semesters

from fifth semester onwards. The record information is organized using a hash table with the help

of a separate chaining technique. In separate chaining, the size of the hash table is 26, such that

to insert a record into the hash table, ASCII value of the first character of first name starts with

A points to index 0, ASCII value of the first character of first name starts with B points to index

1 and so on. The resulting location contains a pointer to a Binary Search Tree(BST), in this case

the root of a binary search tree (BST), where all elements with the same index are stored. Since

a BST requires that its nodes be comparable to each other, we need to define an order among the

records being stored in the BST lexiographically. The key value of each node in BST is students

(firstname, lastname) pair, assuming it is unique to a student. The update function updates the

CGPA of the corresponding key. The insert/update/delete function should return the number of

nodes touched in the BST (except the current node) while performing the given operation. The

location function returns index-bstsequence, where index represents the index of the key in the

hash table, and bstsequence represents the sequence of L/R steps taken on the binary search tree

of all records whose index is the same.

Input Format:

For insertion

The first line of the input should be the character i where i denotes insertion.

The second line of the input is a string representing the first name followed by a string

representing the last name followed by a single character either M or F representing

the gender followed by a string in the format DD-MM-YYYY representing the date of

birth followed by a string of length four representing the department and a floating point

number representing the CGPA separated by single space in between them.

For updation

The first line of the input should be the character u where u denotes updation.

The second line of the input is a string representing the first name, a string representing

the last name and a floating point number representing the updated CGPA separated by

single space in between them.

For location and deletion

The first line of the input should be the character either l, or d where l denotes location

and d denotes deletion.

The second line of the input is a string representing the first name and a string representing

the last name separated by single space in between them.

Input Output Format:

The output (if any) of each command should be printed on a separate line.

The insert/update/delete function should return the number of nodes touched in the BST

(except the current node) while performing the given operation.

The update/delete function returns 1, if key is not present.

The location function returns index-bstsequence, index represents the index of the key in the

hash table, and bstsequence represents the sequence of L/R steps taken on the binary search

tree of all records whose index is the same. The location function returns 1, if key is not

present.

Sample Input:

i

Ram Kumar F 18-05-2022 CSED 6.3

i

Ram Charan F 19-07-2022 CSED 6.3

u

Ram Charan 6.9

u

Ram Kiran 7.3

l

Ram Charan

d

Ram Charan

Sample Output:

0

1

1

-1

17-L

1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Medical Image Databases

Authors: Stephen T.C. Wong

1st Edition

1461375398, 978-1461375395

More Books

Students also viewed these Databases questions