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

Circle queue, countSpaceAvailbility function that counts and returns the sp...

countSpaceAvailbility function that counts and returns the space availability in the circle queue there are two elemnts at the circle queue and should return 5 space if size 7 .

Minimization and karnaugh maps, There are formal ways of reducing Boolean e...

There are formal ways of reducing Boolean expressions in order to minimize the logic circuit. The two elementary ways of minimization are using Boolean expressions/De Morgan Theore

Write a program for simulating jet-powered car acceleration, The absolute l...

The absolute land-speed record of 763.035 MPH (Mach 1.02) was set in October 15 1997 by a jet-powered car called Thrust SSC in the Black Rock Desert of northern Nevada. The team th

Develop capturing printer output apps using raspberry, In POS system, cashi...

In POS system, cashier computer connect to printer using serial rs232 usb or cable. We need to capture data from that connection, and parsing the data to get total amount for every

Define types of storage classes in c language, Define Types of storage clas...

Define Types of storage classes in C language? There are four storage classes in C language: 1. Automatic storage class. 2. External storage class. 3. Register storage cla

Explain the defination and declaration of union, Explain the Defination and...

Explain the Defination and Declaration of Union? Generally in terms the composition of a union may be defined as be as union tag { member 1; member 2; member m; }; Wh

How to write a global inline function, How to write a global inline functio...

How to write a global inline function First, let's get away from member functions for a moment and consider a global function.  To make a request that this function be in line:

Stack push pop, 2 flowcharts, pseudocode for each (at least 4 algorithms), ...

2 flowcharts, pseudocode for each (at least 4 algorithms), and code for either a stack or a queuestion..

Describe how a structure differs from a union, Question : (a) How does...

Question : (a) How does a structure differ from an array? (b) Describe how a structure differs from a union? (c) Declare a union called ‘clothes' which consists of the

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

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