Write me a c code based on data structures mentioned in description.
₹600-1500 INR
Plačilo ob prevzemu
Problem Statement
• Input: A set S = {a1, a2, . . . , an} of natural numbers given as a se-
quence. Additionally, several requests to perform operations on S.
• Goal: Store the elements of S in a Red-black tree and serve the follow-
ing requests:
1. Add an input number x into set S. (i.e., S ← S ∪ {x})
2. Find successor of a given number x in S.
3. Delete a given number x from S. (i.e., S ← S \ {x})
4. Search for a given number x in S.
5. Print the set.
Input Format
Each line of the input starts with one of six symbols:
• ‘N’ (stands for new set)
• ‘+’ (Add element to set)
• ‘>’ (Find successor)
• ‘–’ (Delete element)
• ‘S’ (search within most recent set)
• ‘P’ (pre-order traversal)
The input format specification for all of the above are exactly like in assign-
ments 2B and 3.
1
Output Format
• For input lines starting with ‘N’, ‘P’, ‘+’, ‘–’, ‘>’ the output format is
exactly as per specification in assignments 2B and 3.
• If input line was “S t”:
– Output “-1” if t is not found in the set formed by the numbers in
the most recent line that started with “N”.
– Else, output a bit string that represents the path from root to
the node N containing t followed by a space and the color of N.
Represented black with ‘B’ and red with ‘R’. End the line with a
\n character.
Implementation rules
• The data structure used to implement the set should be a Red-black
Tree.
• All requests are to be handled with respect to the most recent set built.
ID projekta: #18040888
Več o projektu
5 freelancerjev ponuja v povprečju za ₹2138 na tem delu
Hi, I am experienced programmer and I can help you to solve this task. Please contact me if you are interested in cooperation.
A professional having 5 years of experience in embedded software development. Excellent programming skills in C/C++ and Linux. Strong programming skills in data structures linked list, stack, graph, queue etc
I have a vast experience in C projects and problems. I can assist you in this project. You won't be disappointed hiring me!