COMPUTER SCIENCE AND ENGINEERING
DATA STRUCTURES
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
can be both dynamic and static
|
|
can only be static
|
|
can only be dynamic
|
|
cannot be both static and dynamic
|
Detailed explanation-1: -The stack data structure can be of two types: static and dynamic stack. A static stack is implemented using an array in C, whereas a dynamic stack is implemented using a linked list in C.
Detailed explanation-2: -Like other data structures, stacks and queues can be static or dynamic. Static queues and stacks are instantiated with a certain capacity that can not be changed in the future. Dynamic queues and stacks grow and shrink automatically, without the need of setting a capacity.
Detailed explanation-3: -1 Answer. (b) Static data structures such as stack and queue are implemented by array and has the fixed storage capacity. That is these implementations are static.
Detailed explanation-4: -Typically the stack and heap are viewed as dynamic meaning that they are allowed to expand in size-usually done with memory management along the lines of malloc() etc.
Detailed explanation-5: -You can perform the implementation of stacks in data structures using two data structures that are an array and a linked list. Array: In array implementation, the stack is formed using an array.