DATA STRUCTURE

If you have any queries please leave a message here
Your Message
×



What is the difference between array and stack?

A stack and an array are two entirely different things. The number of elements in an array is fixed and is assigned by the declaration for the array. In general the user cannot change this number. A stack on the other hand, is fundamentally a dynamic object whose size is constantly changing as items are popped and pushed.

However although an array cannot be a stack, it can be the home of a stack. That is an array can be declared large enough for the maximum size of the stack.


Why the circular queue better than a linear queue?

If we delete element from the linear queue or normal queue then empty space is create there but we cannot insert any new element into this empty space because in a linear queue the insertion has to be done from one side and deletion has to be done from another side.

In circular queue the front and rear are adjacent to each other that means the insertion and deletion point is same. So if any element delete from the circular queue, we can insert a new element to this position.


Advantage and Disadvantage of a linked list over an array

When we make an array we must allocate memory for a certain number of elements. If we want to add more elements to the array then we allocated memory for create a new array and copy the old array into the new array. This can take lots of time and wasting the memory.

In a linked list we can start with space for just one element allocated and add on new elements easily without the needs to do coping and reallocating. It does not require any extra space therefore it does not waste extra memory.

The advantage of linked list is that it can quickly insert and delete items in a linked list. Inserting and deleting items in an array requires you to either make room for new items or fill the "hole" after deleting an item.

Linked list also allow you to have different sized nodes in the list.

The limitation of linked list is that it consumes extra space when compared to a array. Since each node must also contain the address of the next item in the list to search for a singly item in a linked list is cumbersome and time consuming.


Compare recursion and iteration. Which one is better and why?

Recursion
Iteration
Recursion refers to a situation where a function calls itself again and again until some base condition is not reached. Iteration refers to a situation where some statements are executed again and again using loops until some condition is true.
It is comparatively slower because before each function call the current state of function is stored in stack. After the return statement the previous function state is again restored from stack. Its execution is faster because it doesn’t use stack.
Memory usage is more as stack is used to store the current function state. Memory usage is less as it doesn’t use stack.
Size of code is comparatively smaller in recursion. Iteration makes the code size bigger.


What is B-Tree in Data Structure?

A B-Tree is a self-balancing tree data structure that maintains sorted data and allows searches, sequential access, insertions, and deletions in logarithmic time. The B-Tree is a generalization of a binary search tree in that a node can have more than two children. Unlike self-balancing binary search trees, the B-Tree is well suited for storage systems that read and write relatively large blocks of data, such as discs. It is commonly used in databases and file systems.

Click here to get more details on B-Tree




RELATED TOPIC



ABOUT US

QuestionSolves.com is an educational website that helps worldwide students in solving computer education related queries.

Also, different software like Visual Studio, SQL Server, Oracle etc. are available to download in different versions.

Moreover, QuestionSolves.com provides solutions to your questions and assignments also.


MORE TOPIC


Windows Command

UNIX Command

IGNOU Assignment Solution

IGNOU Question Paper Solution

Solutions of Different Questions


WHAT WE DO


Website Devlopment

Training

Home Learning

Provide BCA, MCA Projects

Provide Assignment & Question Paper Solution


CONTACT US


Follow Us