Explain why a linked list is called dynamic data structure, C/C++ Programming

Assignment Help:

Question:

(a) (i) What is recursion?
(ii) What advantage is there in its use?
(iii) What disadvantage is there in its use?

(b) The factorial of a positive number can be computed using the formula n ! = 1 × 2 × 3 ×..........× n

However, the function ‘factorial' can also be defined as a recursive function in programming exercises.

Write down the main part of the program which contains the following:

(i) the function prototype
(ii) declare a positive integer variable n
(iii) an output statement to display n

(iv) an input statement to allow a user to enter a number (which is stored in variable n)

(v) another output statement that calculates and displays the factorial of the number.

Now write down the function using recursion.

(c) (i) Explain why a linked list is called dynamic data structure?

(ii) What are the three most important advantages of using linked list over arrays?

(iii) State one disadvantage of using linked list in programs.

(d) A stack is also a dynamic data structure which can be implemented in its simplest way by making use of arrays.

Declare a structure containing

(i) an integer array to hold the elements of the stack
(ii) an integer to indicate the position of the current stack top within the array.

Now write the ‘pop' operation to remove the top element from the stack. Write the ‘push' operation to add an element to the stack.


Related Discussions:- Explain why a linked list is called dynamic data structure

The car’s measurements are illustrated, The car’s measurements are illustra...

The car’s measurements are illustrated, using two arrays. Array 1 = {L, R, L, R, R, L, R, R, L, R, R, L, R, L, L, R, Z}

How to define a derived class, How to define a derived class ? A singly...

How to define a derived class ? A singly inherited derived class id defined by writing : The keyword class. The name of the derived class . A single colon (:).

Assignment, Hi, Can i get a quote for my Programming assignment

Hi, Can i get a quote for my Programming assignment

Experiment with the small test matrix, For this assignment, I've provided a...

For this assignment, I've provided a data file called 'elevation.mat', which contains the elevation data you'll be working with.   Type load elevation.mat to get the varia

Area under the curve, Write a program to find the area under the curve y = ...

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b

What is a command line argument and what is its use, Question 1) What are ...

Question 1) What are the commonly used input/output functions in C? Question 2) What is the difference between function declaration and function definition? Write a recursive

Luminous Jewels - The Polishing Game, plaese tell the full program for the ...

plaese tell the full program for the above given topic with the input and output

Assignment, Write a program that computes the cost of a long distance call....

Write a program that computes the cost of a long distance call. The cost of the call is determined according to the following rate schedules. a. A call made between 8:00 AM and

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd