C Answers

Questions answered by Experts: 1 680

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search

Write a c program to perform deletion operation on BST. While deleting, consider all the deletion cases.


a. Deletion of node with degree 0.


b. Deletion of node with degree 1.


c. Deletion of node with degree 2.

Write a program to implement a binary search tree (BST) having following functionalities.


 BSTInsert(): This function adds a given ITEM to the BST. If the ITEM already exists in the BST then it


will not insert the ITEM any more.


 BSTInorderStack(): This function finds Inorder traversal sequence of a BST using stack. You are not


supposed to use recursive implementation of Inorder traversal

Use a double-subscripted array to solve the following problem. A company has four salespeople ( 1 to 4) who sell five different products ( 1 to 5). Once a day, each salesperson passes in a slip for each different type of product sold. Each slip contains:


a) The salesperson number

b) The product number

c) The total dollar value of that product sold that day


Assume that the information from all the slips for a day is available. Write a C program that will read all this information for the day and store in a double-subscripted array sales. For each product find and display the total sales.


In order to discourage excess electric


consumption, an electrical company charges


its customers a lower rate of P75 for the


first 250 kilowatt-hours and a higher rate


of P8.5 for each additional kilowatt-hour.


In addition, a 10% surtax is added to the


final bill. Write a program that calculates


the electrical bill given the number of


kilowatt-hours consumed as input. At the end,


print the number of kilowatt-hours consumed


and the computed bill

We've already tried comparing 3 numbers to see the largest among all, so let's try a more complicated mission where we locate the position of the largest among 5 numbers. There are only 4 possible cases for this mission:

- if the largest digit is the first digit, print "Leftmost"

- if the largest digit is the third digit, print "Middle"

- if the largest digit is the last digit, print "Rightmost"

- if none of the above is correct, print "Unknown"

 

Now, show me how far you've understood your lessons!

Input


1. First integer

2. Second integer

3. Third integer

4. Fourth integer

5. Fifth integer

Output

The first five lines will contain message prompts to input the five integers.

The last line contains the appropriate string.

Enter·integer·1:·1
Enter·integer·2:·4
Enter·integer·3:·6
Enter·integer·4:·3
Enter·integer·5:·2
Middle




Write the C code to print the post order traversal of a binary tree from its preorder and inorder traversal.


Given two single linked lists, write a C code to merge their nodes together to make one list, taking nodes alternately between the two lists. So the output with {1, 2, 3} and {7, 13, 1} should yield {1, 7, 2, 13, 3, 1}. If either list runs out, all the nodes should be taken from the other list.

Given a BST and a range low-to-high(inclusive). Write a C code to count the number of nodes in the BST that lie in the given range.




5. Write a C program to calculate area of an equilateral triangle.

LATEST TUTORIALS
APPROVED BY CLIENTS