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

.Change to palindrome, A palindrome is a string that reads the same from bo...

A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your task is to convert S to palindrome

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

Determine the capacitor voltage by c program, Write a program to determine ...

Write a program to determine V c for a given value of time (t)   #include stdio.h #include math.h void main() {      char prompt;   float vs,cr,t,vc;   /* input time */

Described the order that objects in an array is destructed?, Described the ...

Described the order that objects in an array is destructed?

Reverse digit function, how can i write reverse digit function like writing...

how can i write reverse digit function like writing 1234 and printing 4321

Structure and classes in c++, want to understand the working of structure a...

want to understand the working of structure and classes

How to creat a file herachy for stream class, Ask questionhow to creat a fi...

Ask questionhow to creat a file herachy for stream class #Minimum 100 words accepted#

What are the differences among a struct in c & in c++?, A: In C++ a struct ...

A: In C++ a struct is alike to a class except for the default access specifier( refer to other question in the document). In C we ought to include the struct keyword while declarin

Program of binary tree, Program of Binary tree: Btree::Btree(int O) : ...

Program of Binary tree: Btree::Btree(int O) : itemsInContainer(0) {     finishInit(O); }   Btree::~Btree(void) {     if( root != 0 )         delete roo

Artificial block, What if I cannot wrap the local in an artificial block? n...

What if I cannot wrap the local in an artificial block? need help on Artificial Block in c++.

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