Data Structure Assignment
Data Structure Assignment
particular node.
(ii).Binary Tree:A binary tree has a special condition that each node can
have a maximum of two children. ... A binary tree has the benefits of both an
ordered array and a linked list as search is as quick as in a sorted array and
insertion or deletion operation are as fast as in linked list.
2.Average Case − This is the scenario depicting the average execution time
of an operation of a data structure. If an operation takes ƒ(n) time in
execution, then m operations will take mƒ(n) time.
3.Best Case − This is the scenario depicting the least possible execution
time of an operation of a data structure. If an operation takes ƒ(n) time in
execution, then the actual operation may take time as the random number
which would be maximum as ƒ(n).
Q.10.DISCUSS THREE CHARACTERISTICS OF DATA
STRUCTURE.
1.Linear or non-linear: This characteristic describes whether the
data items are arranged in sequential order, such as with an array, or
in an unordered sequence, such as with a graph.
2.Homogeneous or heterogeneous: This characteristic describes
whether all data items in a given repository are of the same type.
One example is a collection of elements in an array, or of various
types, such as an abstract data type defined as a structure in C or a
class specification in Java.
3.Static or dynamic: This characteristic describes how the data
structures are compiled. Static data structures have fixed sizes,
structures and memory locations at compile time. Dynamic data
structures have sizes, structures and memory locations that can
shrink or expand, depending on the use.
Array elements store in a contiguous memory Linked list elements can be stored anywher
location. memory or randomly stored.
Array works with a static memory. Here static The Linked list works with dynamic memor
memory means that the memory size is fixed and dynamic memory means that the memory
cannot be changed at the run time. be changed at the run time according
requirements.
Array elements are independent of each other. Linked list elements are dependent on eac
As each node contains the address of t
node so to access the next node, we n
access its previous node.
Array takes more time while performing any Linked list takes less time while perform
operation like insertion, deletion, etc. operation like insertion, deletion, etc.
Accessing any element in an array is faster as the Accessing an element in a linked list is slow
element in an array can be directly accessed starts traversing from the first element
through the index. linked list.
In the case of an array, memory is allocated at In the case of a linked list, memory is alloc
compile-time. run time.
Memory utilization is inefficient in the array. For Memory utilization is efficient in the ca
example, if the size of the array is 6, and array linked list as the memory can be allocated
consists of 3 elements only then the rest of the located at the run time according
space will be unused. requirement.
=ABD+*E/F-GHK/+-