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

Can you overload a function depend only on whether parameter, Can you overl...

Can you overload a function depend only on whether a parameter is a value or a reference? A: No. Passing by value and reference looks identical to the caller.

Create a class string which stores a string value, Question 1 Write a prog...

Question 1 Write a program that accepts two numbers from the user and swaps the two numbers without using a temporary variable Question 2 Write a program that accepts a 3x

Basic C++ Velocity and Momentum Program, Write a program that does the foll...

Write a program that does the following: Calculates the Velocity and Momentum of an object. The formula for the velocity is V=d/t and the formula Momentum is m=mass*velocity. Your

Summations, How do you write the code for summations

How do you write the code for summations

Decoding , http://www.expertsmind.com/questions/decodethecode-30110560.aspx...

http://www.expertsmind.com/questions/decodethecode-30110560.aspx

Advanced, how to create a shopping cart

how to create a shopping cart

Advance in c, create a program to populate the first array then the odd num...

create a program to populate the first array then the odd number is the second array and get the sum of the second array.

Explain the switch construct, The Switch Construct The switch statement...

The Switch Construct The switch statement is a multi-way decision-making construct that tests an expression matches one of a number of constant values, and branches accordingly

Assigment, C++ Programming Assignment ATM Machine Phase 1 In this assign...

C++ Programming Assignment ATM Machine Phase 1 In this assignment you will create a program that allows a user to do the following: 1) Create a bank account by supplying a use

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