Ask Question, Ask an Expert


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];
                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!");
 printf("Printing the grades of courses..\n");
{     printf("%c\n",S->Course_Grade);
S = S->Next;

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++

Objectives- gain experience with if if else and switch

Objectives - Gain experience with if, if else, and switch statements in C programs. - Experience using % operator and true false logic. Hints This program will be MUCH easier if you design how to do the logic in your own ...

1 learner objectivesat the conclusion of this programming

1. Learner Objectives: At the conclusion of this programming assignment, participants should be able to: * Apply repetition structures within an algorithm * Construct while (), for (), or do-while () loops in C * Compose ...

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 ...

C program codeoverviewfor this assignment write a program

C++ program code Overview For this assignment, write a program that will simulate a single game of Craps. Craps is a game of chance where a player (the shooter) will roll 2 six-sided dice. The sum of the die will determi ...

Fix a programthe program is already done and it runs welli

Fix a program The program is already done and it runs well.. I just need someone to fix it for me, the problem happens when you insert invalid day or invalid ticket type, I want you to end the program *at that point* as ...

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 ...

1 requirementsin this assignment you can unleash your

1. REQUIREMENTS In this assignment, you can unleash your imaginations and use OpenGL with C/C++ programming to produce a scene(s) that represents what you envision could possibly be seen under the sea. Please note that a ...

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 ...

For this program you will add and test 2 new member

For this program you will add and test 2 new member functions to the IntSLList class posted on the website. The two member functions are: insertByPosn(int el, intpos) Assuming that the positions of elements of a list beg ...

Problem 1overview for problem 1a of this assignment you

Problem #1 Overview: For problem 1(a) of this assignment, you will need a C++ compiler. In order to receive credit, your program must compile and run; and you must provide the actual source code file so that I can compil ...

  • 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