Ask Question, Ask an Expert

+1-415-315-9853

info@mywordsolution.com

Ask C/C++ Expert


Home >> C/C++

problem1)a) Consider the function defined below

Int Compute( int X[ ], int n)
{
        If (n==1)
               return X[0];
          else
                return X[n-1] + Compute(X, n-1);
}

If this function is called in the main program by the statement p = Compute(A, 5) ; where A is any array of integers, describe the process of execution. Finally what will be contained in p ?

b) How will you store the following sparse matrix in vector and linked list representation so that only nonzero elements are stored?

2321_Sparse matrix.jpg

c) prepare a statement or a set of statements to accomplish each of the following. Assume that all the manipulations occur in main and assume the following definitions

struct TTwenty
{

char Name[15];
Int Total _Runs;
struct TTwenty  *Next;
};
typedef struct TTwenty T20;
typedef T20 *ptr_T20;

i) Create a pointer to the start of the list called start_ptr . The list is empty.

ii) Create a node of type T 20 that is pointed to by pointer new_ptr of type ptr_T20. Assign the string“ Sachin ” to member Name and the value 96 to the member Total_Runs. Provide any  necessary declarations and statements.

iii) prepare a while loop that prints the data in each node of the list.1

problem2)a) prepare a program that computes the sum of the squares of the digits of an integer.

b) Consider the following declaration
typedef struct node
{ char Course_Grade;
Struct node *Next;
} Student;

For the above declaration, the following function displays the grades of a student in different courses.

Void Display_Grades(Student *S)
{ if (Is_Empty(S))
printf("The Stack is Empty!");
else
{
 printf("Printing the grades of courses..\n");
while(S->Next!=NULL)
{     printf("%c\n",S->Course_Grade);
S = S->Next;
}
printf("%c\n",S->Course_Grade);
}
}

Does it display all the grades? If not, do the necessary modifications so that it displays all the grades. Also prepare the definition of the function Is_Empty ( ). Also prepare down the corresponding Push( ) and Pop( ) functions.

c) Manually provide the inorder, preorder and postorder traversals of the following binary search tree

456_Binary search tre.jpg

d) Draw a binary tree for the expression A*B-(C+D)*(P/Q)

C/C++, Programming

  • Category:- C/C++
  • Reference No.:- M92593
  • Price:- $100

Priced at Now at $100, Verified Solution

Have any Question? 


Related Questions in C/C++

More often than not entrepreneurs will fail several times

"More often than not, entrepreneurs will fail several times before they make it and will usually learn a lot in the process. To help these entrepreneurs to succeed will require a cultural shift. We need to encourage Aust ...

Write an application that allows the user to enter two

Write an application that allows the user to enter two variables: number (real) and code (character). Calculate the value indicated by the table below: If code is Result A symbol the whole part of the number everything e ...

Computer programming assignment-q1 using for loop write a c

Computer Programming Assignment- Q1. Using for loop, write a C++ program that prints out the multiples of 3 up through 75, separated by a blank space.  3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 63 66 69 72 ...

Text exercise 413 gas mileagebulldrivers are concerned with

Text Exercise 4.13 (Gas Mileage) • Drivers are concerned with the mileage obtained by their automobiles. One driver has kept track of several trips by recording miles driven and gallons used for each trip. Develop a C++ ...

Question 1you are facing the following problem you are

Question 1 You are facing the following problem: You are given a robot and your task is to "guide" the robot through a 2-dimensional maze such that the robot can reach a desired goal state. Assume that the maze is define ...

This program involves using stl listsfor this program you

This program involves using STL lists. For this program you will implement three functions whose prototypes are given below: list ::iterator mxIter(list ::iterator first, list ::iterator last); void selectSort(list & aLi ...

This program involves using stl listsfor this program you

This program involves using STL lists. For this program you will implement three functions whose prototypes are given below: list ::iterator mxIter(list ::iterator first, list ::iterator last); void selectSort(list & aLi ...

Computer scienceprogram-write a c program that willpresent

Computer Science Program- Write a C++ program that will: Present the user with a menu of choices: 1. Random number 2. String 3. Type Casting 4. Integer Math Then, in an if-else if structure (or switch) write the code for ...

Please use codeblockslist the program and the output on the

Please use codeblocks List the program and the output on the command line Eg #include #include using namespace std; int main() { floatjohno = 0.5; size_t size = 24; vector array(size); for(inti=0; i     { johno = johno + ...

Only one programwrite a c program to find fibonacci numbers

Only one program Write a C++ Program to Find Fibonacci Numbers using Dynamic Programming.

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

A cola-dispensing machine is set to dispense 9 ounces of

A cola-dispensing machine is set to dispense 9 ounces of cola per cup, with a standard deviation of 1.0 ounce. The manuf

What is marketingbullwhat is marketing think back to your

What is Marketing? • "What is marketing"? Think back to your impressions before you started this class versus how you

Question -your client david smith runs a small it

QUESTION - Your client, David Smith runs a small IT consulting business specialising in computer software and techno

Inspection of a random sample of 22 aircraft showed that 15

Inspection of a random sample of 22 aircraft showed that 15 needed repairs to fix a wiring problem that might compromise

Effective hrmquestionhow can an effective hrm system help

Effective HRM Question How can an effective HRM system help facilitate the achievement of an organization's strate