15forteen@data Structures VIVA Questions
15forteen@data Structures VIVA Questions
Complete Playlist
ARRAY
10. What are the advantages of linked list over array (static data structure)?
The disadvantages of array are
unlike linked list it is expensive to insert and delete elements in the array
One can’t double or triple the size of array as it occupies block of memory space.
In linked list
each element in list contains a field, called a link or pointer which contains the address of the next element
Successive element’s need not occupy adjacent space in memory.
11. Can we apply binary search algorithm to a sorted linked list, why?
No we cannot apply binary search algorithm to a sorted linked list, since there is no way of indexing the middle
element in the list. This is the drawback in using linked list as a data structure.
When new data is to be inserted into the data structure but there is no available space i.e. free storage list is
empty this situation is called overflow.
When we want to delete data from a data structure that is empty this situation is called underflow.
15. What are the disadvantages array implementations of linked list?
1.The no of nodes needed can’t be predicted when the program is written.
2.The no of nodes declared must remain allocated throughout its execution
After a call to free(p) makes a subsequent reference to *p illegal, i.e. though the storage to p is freed but the
value of p(address) remain unchanged .so the object at that address may be used as the value of *p (i.e. there is
no way to detect the illegality).Here p is called dangling pointer.
To avoid this it is better to set p to NULL after executing free(p).The null pointer value doesn’t reference a
storage location it is a pointer that doesn’t point to anything.
26. What are the issues that hamper the efficiency in sorting a file?
The issues are
i) Length of time required by the programmer in coding a particular sorting program
ii) Amount of machine time necessary for running the particular program
iii)The amount of space necessary for the particular program .
30. List out the areas in which data structures are applied extensively?
Compiler Design,
Operating System,
Database Management System,
Statistical analysis package,
Numerical Analysis,
Graphics,
Artificial Intelligence,
Simulation
31. What are the major data structures used in the following areas : network data model & Hierarchical data
model?
RDBMS – Array (i.e. Array of structures)
Network data model – Graph
Hierarchical data model – Trees
32. If you are using C language to implement the heterogeneous linked list, what pointer type will you use?
The heterogeneous linked list contains different data types in its nodes and we need a link, pointer to connect
them. It is not possible to use ordinary pointers for this. So we go for void pointer. Void pointer is capable of
storing pointer to any type as it is a generic pointer type.
33. Minimum number of queues needed to implement the priority queue?
Two. One queue is used for actual storing of data and another for storing priorities.
47. Does the minimum spanning tree of a graph give the shortest distance between any 2 specified nodes?
No.Minimal spanning tree assures that the total weight of the tree is kept at its minimum. But it doesn’t mean
that the distance between any two nodes involved in the minimum-spanning tree is minimum.