1.What is Linear Data Structure?
A Linear data structure have data elements arranged in sequential manner and each
member element is connected to its previous and next element. This connection helps
to traverse a linear data structure in a single level and in single run. Such data structures are
easy to implement because computer memory is arranged in a linear way.
2. Define Linked List.
Linked lists are the types linear data structure where the data is stored in the form of nodes
which consist of an element of data and a pointer. The use of the pointer is that it points or
directs to the node which is next to the element in the sequence. The data stored in a linked
list might be of any form, strings, numbers, or characters. Both sorted and unsorted data can
be stored in a linked list along with unique or duplicate elements.
3.Define various functions of Single Linked List.
Create and display
B. Describe Asymptotic Notations, Big – O and Omega, with examples.
Asymptotic Notations:-
Asymptotic notations are the mathematical notations used to describe the running time of an
algorithm when the input tends towards a particular value or a limiting value. For example: In
bubble sort, when the input array is already sorted, the time taken by the algorithm is linear
i.e, the best case. But, when the input array is in reverse condition, the algorithm takes the
maximum time (quadratic) to sort the elements i.e, the worst case. When the input array is
neither sorted nor in reverse order, then it takes average time. These durations are denoted
using asymptotic notations.
Big – O Notation:-
Big-O notation represents the upper bound of the running time of an algorithm. Thus, it gives the
worst-case complexity of an algorithm.
Asymptotic Analysis: Big-O notation
Big-O gives the upper bound of a function
O(g(n)) = { f(n): there exist positive constants c and n0
such that 0 ≤ f(n) ≤ cg(n) for all n ≥ n0 }
The above expression can be described as a function f(n) belongs to the set O(g(n)) if there exists a
positive constant c such that it lies between 0 and cg(n), for sufficiently large n.
For any value of n, the running time of an algorithm does not cross the time provided by O(g(n)).
Since it gives the worst-case running time of an algorithm, it is widely used to analyze an algorithm
as we are always interested in the worst-case scenario.
Omega Notation:-
Omega notation represents the lower bound of the running time of an algorithm. Thus, it provides
the best case complexity of an algorithm.
Asymptotic Analysis: Omega Notation
Omega gives the lower bound of a function
Ω(g(n)) = { f(n): there exist positive constants c and n0
such that 0 ≤ cg(n) ≤ f(n) for all n ≥ n0 }
The above expression can be described as a function f(n) belongs to the set Ω(g(n)) if there exists a
positive constant c such that it lies above cg(n), for sufficiently large n.
For any value of n, the minimum time required by the algorithm is given by Omega Ω(g(n)).