You are on page 1of 17

http://www.tnbedcsvips.

in/study-materials/
Data Structures
As we have discussed above, anything that can store data can be called as a data
structure, hence Integer, Float, Boolean, Char etc, all are data structures. They are known
as Primitive Data Structures.
Then we also have some complex Data Structures, which are used to store large and
connected data. Some example of Abstract Data Structure are:
Linear:
 Linked List
 Stack
 Queue
Non-Linear:
 Tree
 Graph
All these data structures allow us to perform different operations on data. We select these
data structures based on which type of operation is required. We will look into these data
structures in more details in our later lessons.

The data structures can also be classified on the basis of the following characteristics:
Linear
In Linear data structures, the data items are arranged in a linear sequence.
Example: Array

V.MANIKANDAN.M.Sc.,B.Ed.,M.Phil,CCNA.
Paavai Engineering College,Namakkal-18. Email.ID : vmaniapt@Gmail.com
http://www.tnbedcsvips.in/study-materials/
Non-Linear
In Non-Linear data structures,the data items are not in sequence.
Example: Tree, Graph
Homogeneous
In homogeneous data structures, all the elements are of same type. Example: Array
Non-Homogeneous
In Non-Homogeneous data structure, the elements may or may not be of the same
type. Example: Structures
Static
Static data structures are those whose sizes and structures associated memory
locations are fixed, at compile time. Example: Array
Dynamic
Dynamic structures are those which expands or shrinks depending upon the
program need and its execution. Also, their associated memory locations changes.
Example: Linked List created using pointers

What is an Algorithm?
An algorithm is a finite set of instructions or logic, written in order, to accomplish a certain
predefined task. Algorithm is not the complete code or program, it is just the core
logic(solution) of a problem, which can be expressed either as an informal high level
description as pseudocode or using a flowchart.
Every Algorithm must satisfy the following properties:
1. Input- There should be 0 or more inputs supplied externally to the algorithm.
2. Output- There should be atleast 1 output obtained.
3. Definiteness- Every step of the algorithm should be clear and well defined.
4. Finiteness- The algorithm should have finite number of steps.
5. Correctness- Every step of the algorithm must generate a correct output.
An algorithm is said to be efficient and fast, if it takes less time to execute and consumes
less memory space. The performance of an algorithm is measured on the basis of following
properties:

1. Time Complexity
2. Space Complexity

V.MANIKANDAN.M.Sc.,B.Ed.,M.Phil,CCNA.
Paavai Engineering College,Namakkal-18. Email.ID : vmaniapt@Gmail.com
http://www.tnbedcsvips.in/study-materials/

1. Time Complexity
Time Complexity is a way to represent the amount of time needed by the program to run till
its completion. We will study this in details in later sections.
Time complexity of an algorithm signifies the total time required by the program to run till its
completion. The time complexity of algorithms is most commonly expressed using the big
O notation.
Time Complexity is most commonly estimated by counting the number of elementary
functions performed by the algorithm. And since the algorithm's performance may vary with
different types of input data, hence for an algorithm we usually use the worst-case Time
complexity of an algorithm because that is the maximum time taken for any input size.

2. Space Complexity
It’s the amount of memory space required by the algorithm, during the course of its
execution. Space complexity must be taken seriously for multi-user systems and in
situations where limited memory is available.
An algorithm generally requires space for following components:
 Instruction Space: It’s the space required to store the executable version of the
program. This space is fixed, but varies depending upon the number of lines of code in
the program.
 Data Space: It’s the space required to store all the constants and variables value.
 Environment Space: It’s the space required to store the environment information
needed to resume the suspended function.

Types of Notations for Time Complexity


Now we will discuss and understand the various notations used for Time Complexity.
1. Big Oh denotes "fewer than or the same as" <expression> iterations.
2. Big Omega denotes "more than or the same as" <expression> iterations.
3. Big Theta denotes "the same as" <expression> iterations.
4. Little Oh denotes "fewer than" <expression> iterations.
5. Little Omega denotes "more than" <expression> iterations.

V.MANIKANDAN.M.Sc.,B.Ed.,M.Phil,CCNA.
Paavai Engineering College,Namakkal-18. Email.ID : vmaniapt@Gmail.com
http://www.tnbedcsvips.in/study-materials/
Understanding Notations of Time Complexity
O (expression) is the set of functions that grow slower than or at the same rate as
expression. It indicates the maximum required by an algorithm for all input values. It
represents the worst case of an algorithm's time complexity.
Omega (expression) is the set of functions that grow faster than or at the same rate as
expression. It indicates the minimum time required by an algorithm for all input values. It
represents the best case of an algorithm's time complexity.
Theta (expression) consist of all the functions that lie in both O (expression) and Omega
(expression). It indicates the average bound of an algorithm. It represents the average case
of an algorithm's time complexity.
Introduction to Sorting
Sorting is nothing but storage of data in sorted order, it can be in ascending or descending
order. The term Sorting comes into picture with the term Searching. There are so many
things in our real life that we need to search, like a particular record in database, roll
numbers in merit list, a particular telephone number, any particular page in a book etc.

Types of Sorting
There are many types of Sorting techniques, differentiated by their efficiency and space
requirements. Following are some sorting techniques which we will be covering in next
sections.
1. Bubble Sort 4. Insertion Sort
2. Selection Sort 5. Quick Sort
3. Merge Sort 6. Heap Sort

The Complexity Analysis of Sorting


Sorting Complexity Analysis
1. Bubble Sort Worst Case Time Complexity : O(n^2)
Best Case Time Complexity : O(n)
Average Time Complexity : O(n^2)
Space Complexity : O(1)
2. Insertion Sort Worst Case Time Complexity : O(n2)
Best Case Time Complexity : O(n)
Average Time Complexity : O(n2)
Space Complexity : O(1)
3. Selection Sort Worst Case Time Complexity : O(n2)
Best Case Time Complexity : O(n2)
Average Time Complexity : O(n2)
Space Complexity : O(1)
V.MANIKANDAN.M.Sc.,B.Ed.,M.Phil,CCNA.
Paavai Engineering College,Namakkal-18. Email.ID : vmaniapt@Gmail.com
http://www.tnbedcsvips.in/study-materials/
4. Quick Sort Worst Case Time Complexity : O(n2)
Best Case Time Complexity : O(n log n)
Average Time Complexity : O(n log n)
Space Complexity : O(n log n)
5. Merge Sort Worst Case Time Complexity : O(n log n)
Best Case Time Complexity : O(n log n)
Average Time Complexity : O(n log n)
Space Complexity : O(n)
6. Heap Sort Worst Case Time Complexity : O(n log n)
Best Case Time Complexity : O(n log n)
Average Time Complexity : O(n log n)
Space Complexity : O(1)

Linear Search
A linear search is the basic and simple search algorithm. A linear search searches an
element or value from an array till the desired element or value is not found and it searches
in a sequence order. It compares the element with all the other elements given in the list
and if the element is matched it returns the value index else it return -1. Linear Search is
applied on the unsorted or unordered list when there are fewer elements in a list.

Binary Search
Binary Search is applied on the sorted array or list. In binary search, we first compare the
value with the elements in the middle position of the array. If the value is matched, then we
return the value. If the value is less than the middle element, then it must lie in the lower
half of the array and if it's greater than the element then it must lie in the upper half of the
array. We repeat this procedure on the lower (or upper) half of the array. Binary Search is
useful when there are large numbers of elements in an array.

V.MANIKANDAN.M.Sc.,B.Ed.,M.Phil,CCNA.
Paavai Engineering College,Namakkal-18. Email.ID : vmaniapt@Gmail.com
http://www.tnbedcsvips.in/study-materials/
STACKS
Stack is an abstract data type with a bounded (predefined) capacity. It is a simple
data structure that allows adding and removing elements in a particular order. Every time
an element is added, it goes on the top of the stack, the only element that can be removed
is the element that was at the top of the stack, just like a pile of objects.

Basic features of Stack


1. Stack is an ordered list of similar data type.
2. Stack is a LIFO structure. (Last in First out).
3. Push () function is used to insert new elements into the Stack and
Pop () function is used to delete an element from the stack. Both insertion and
deletion are allowed at only one end of Stack called Top.
4. Stack is said to be in Overflow state when it is completely full and is said to
be in Underflow state if it is completely empty.
Stack Operations
push - add a new item to the stack
pop - removes top item from the stack
initialize - create an empty stack
isEmpty - tests for whether or not stack is empty
isFull - tests to see if stack is full and cannot grow (not always needed)
top - looks at value of the top item but do not remove it
Applications of Stack
The simplest application of a stack is to reverse a word. You push a given word to stack -
letter by letter - and then pop letters from the stack.
There are other uses also like: Parsing, Expression Conversion (Infix to Postfix, Postfix
to Prefix etc) and many more.

V.MANIKANDAN.M.Sc.,B.Ed.,M.Phil,CCNA.
Paavai Engineering College,Namakkal-18. Email.ID : vmaniapt@Gmail.com
http://www.tnbedcsvips.in/study-materials/
Algorithm for PUSH operation
1. Check if the stack is full or not.
2. If the stack is full,then print error of overflow and exit the program.
3. If the stack is not full,then increment the top and add the element .

Algorithm for POP operation


1. Check if the stack is empty or not.
2. If the stack is empty, then print error of underflow and exit the program.
3. If the stack is not empty, then print the element at the top and decrement the top.

Position of Top Status of Stack

-1 Stack is Empty

0 Only one element in Stack

N-1 Stack is Full

N Overflow state of Stack

Analysis of Stacks
 Push Operation : O(1)
 Pop Operation : O(1)
 Top Operation : O(1)
 Search Operation : O(n)

QUEUE
Queue is also an abstract data type or a linear data structure, in which the first element is
inserted from one end called REAR(also called tail), and the deletion of existing element
takes place from the other end called as FRONT(also called head). This makes queue as
FIFO(First in First Out) data structure, which means that element inserted first will also be
removed first.
The process to add an element into queue is called Enqueue and the process of removal
of an element from queue is called Dequeue.

V.MANIKANDAN.M.Sc.,B.Ed.,M.Phil,CCNA.
Paavai Engineering College,Namakkal-18. Email.ID : vmaniapt@Gmail.com
http://www.tnbedcsvips.in/study-materials/

Basic features of Queue


1. Like Stack, Queue is also an ordered list of elements of similar data types.
2. Queue is a FIFO( First in First Out ) structure.
3. Once a new element is inserted into the Queue, all the elements inserted before the
new element in the queue must be removed, to remove the new element.
4. peek( ) function is oftenly used to return the value of first element without dequeuing
it.
Queue Operations
enqueue - adds an item to the end of the queue
dequeue - remove an item from front of the queue
initialize - create an empty queue
isEmpty - tests for whether or not queue is empty
isFull - tests to see if queue is full (not needed if data structure grows automatically)
front - looks at value of the first item but do not remove it
Applications of Queue
Queue, as the name suggests is used whenever we need to manage any group of objects
in an order in which the first one coming in, also gets out first while the others wait for their
turn, like in the following scenarios:
1. Serving requests on a single shared resource, like a printer, CPU task scheduling
etc.
2. In real life scenario, Call Center phone systems uses Queues to hold people calling
them in an order, until a service representative is free.

V.MANIKANDAN.M.Sc.,B.Ed.,M.Phil,CCNA.
Paavai Engineering College,Namakkal-18. Email.ID : vmaniapt@Gmail.com
http://www.tnbedcsvips.in/study-materials/
3. Handling of interrupts in real-time systems. The interrupts are handled in the same
order as they arrive i.e First come first served.
4. When a resource is shared among multiple consumers. Examples include CPU
scheduling, Disk Scheduling.
5. When data is transferred asynchronously (data not necessarily received at same rate as
sent) between two processes. Examples include IO Buffers, pipes, file IO, etc.
Algorithm for ENQUEUE operation
1. Check if the queue is full or not.
2. If the queue is full, then print overflow error and exit the program.
3. If the queue is not full, then increment the tail and add the element.
Algorithm for DEQUEUE operation
1. Check if the queue is empty or not.
2. If the queue is empty, then print underflow error and exit the program.
3. If the queue is not empty, then print the element at the head and increment the
head.
Analysis of Queue
 Enqueue : O(1)
 Dequeue : O(1)
 Size : O(1)

Linked Lists
Linked List is a linear data structure and it is very common data structure which consists of
group of nodes in a sequence which is divided in two parts. Each node consists of its own
data and the address of the next node and forms a chain. Linked Lists are used to create
trees and graphs.

Advantages of Linked Lists


 They are a dynamic in nature which allocates the memory when required.
 Insertion and deletion operations can be easily implemented.
 Stacks and queues can be easily executed.
 Linked List reduces the access time.

V.MANIKANDAN.M.Sc.,B.Ed.,M.Phil,CCNA.
Paavai Engineering College,Namakkal-18. Email.ID : vmaniapt@Gmail.com
http://www.tnbedcsvips.in/study-materials/
Disadvantages of Linked Lists
 The memory is wasted as pointers require extra memory for storage.
 No element can be accessed randomly; it has to access each node sequentially.
 Reverse Traversing is difficult in linked list.
Applications of Linked Lists
 Linked lists are used to implement stacks, queues, graphs, etc.
 Linked lists let you insert elements at the beginning and end of the list.
 In Linked Lists we don't need to know the size in advance.
Types of Linked Lists
 Singly Linked List : Singly linked lists contain nodes which have a data part as well
as an address part i.e. next, which points to the next node in sequence of nodes. The
operations we can perform on singly linked lists are insertion, deletion and traversal.

 Doubly Linked List : In a doubly linked list, each node contains two links the first
link points to the previous node and the next link points to the next node in the
sequence.

 Circular Linked List : In the circular linked list the last node of the list contains the
address of the first node and forms a circular chain.

V.MANIKANDAN.M.Sc.,B.Ed.,M.Phil,CCNA.
Paavai Engineering College,Namakkal-18. Email.ID : vmaniapt@Gmail.com
http://www.tnbedcsvips.in/study-materials/
Linear Linked List
The element can be inserted in linked list in 2 ways :
 Insertion at beginning of the list.
 Insertion at the end of the list.
We will also be adding some more useful methods like :
 Checking whether Linked List is empty or not.
 Searching any element in the Linked List
 Deleting a particular Node from the List
Insertion at the Beginning
Steps to insert a Node at beginning :
1. The first Node is the Head for any Linked List.
2. When a new Linked List is instantiated, it just has the Head, which is Null.
3. Else, the Head holds the pointer to the first Node of the List.
4. When we want to add any Node at the front, we must make the head point to it.
5. And the Next pointer of the newly added Node, must point to the previous Head,
whether it be NULL(in case of new List) or the pointer to the first Node of the List.
6. The previous Head Node is now the second Node of Linked List, because the new
Node is added at the front.
Inserting at the End
Steps to insert a Node at the end :
1. If the Linked List is empty then we simply, add the new Node as the Head of the
Linked List.
2. If the Linked List is not empty then we find the last node, and make it' next to the
new Node, hence making the new node the last Node.
Circular Linked List
Circular Linked List is little more complicated linked data structure. In the circular linked list
we can insert elements anywhere in the list whereas in the array we cannot insert element
anywhere in the list because it is in the contiguous memory. In the circular linked list the
previous element stores the address of the next element and the last element stores the
address of the starting element. The elements points to each other in a circular way which
forms a circular chain. The circular linked list has a dynamic size which means the memory
can be allocated when it is required.

V.MANIKANDAN.M.Sc.,B.Ed.,M.Phil,CCNA.
Paavai Engineering College,Namakkal-18. Email.ID : vmaniapt@Gmail.com
http://www.tnbedcsvips.in/study-materials/

Application of Circular Linked List


 The real life application where the circular linked list is used is our Personal
Computers, where multiple applications are running. All the running applications are
kept in a circular linked list and the OS gives a fixed time slot to all for running. The
Operating System keeps on iterating over the linked list until all the applications are
completed.
 Another example can be Multiplayer games. All the Players are kept in a Circular
Linked List and the pointer keeps on moving forward as a player's chance ends.
 Circular Linked List can also be used to create Circular Queue. In a Queue we have
to keep two pointers, FRONT and REAR in memory all the time, where as in Circular
Linked List, only one pointer is required.
Insertion at the Beginning
Steps to insert a Node at beginning :
1. The first Node is the Head for any Linked List.
2. When a new Linked List is instantiated, it just has the Head, which is Null.
3. Else, the Head holds the pointer to the fisrt Node of the List.
4. When we want to add any Node at the front, we must make the head point to it.
5. And the Next pointer of the newly added Node, must point to the previous Head,
whether it be NULL(in case of new List) or the pointer to the first Node of the List.
6. The previous Head Node is now the second Node of Linked List, because the new
Node is added at the front.
Insertion at the End
Steps to insert a Node at the end :
1. If the Linked List is empty then we simply, add the new Node as the Head of the
Linked List.
2. If the Linked List is not empty then we find the last node, and make it' next to the
new Node, and make the next of the Newly added Node point to the Head of the List.

V.MANIKANDAN.M.Sc.,B.Ed.,M.Phil,CCNA.
Paavai Engineering College,Namakkal-18. Email.ID : vmaniapt@Gmail.com
http://www.tnbedcsvips.in/study-materials/

TRB-CS: DS Model Questions & Answers:


1. Which of the following sorting algorithms can be used to sort a random linked list with
minimum time complexity? A.Insertion Sort B.Quick Sort C.Heap Sort D.Merge Sort
2. In the worst case, the number of comparisons needed to search a singly linked list of length n
for a given element is A.log 2 n B.n/2 C.log 2 n – 1 D.n
3. What are the time complexities of finding 8th element from beginning and 8th element from
end in a singly linked list? Let n be the number of nodes in linked list, you may assume that n >
8. A.O(1) and O(n) B.O(1) and O(1) C.O(n) and O(1) D.O(n) and O(n
4. Is it possible to create a doubly linked list using only one pointer with every node.
A. Not Possible
B. Yes, possible by storing XOR of addresses of previous and next nodes.
C. Yes, possible by storing XOR of current node and next node
D. Yes, possible by storing XOR of current node and previous node
5. Let P be a singly linked list. Let Q be the pointer to an intermediate node x in the list. What is
the worst-case time complexity of the best known algorithm to delete the node x from the list?
A.O(n) B.O(log2 n) C.O(logn) D.O(1)
6. The concatenation of two lists is to be performed in O(1) time. Which of the following
implementations of a list should be used?
A. Singly Linked List B. Doubly Linked List
C Circular Doubly Linked List D. Array Implementation Of Lists
7. Which one of the following is an application of Stack Data Structure?
A. Managing function calls B. The stock span problem
C.Arithmetic expression evaluation D. All of the above
8. The result evaluating the postfix expression 10 5 + 60 6 / * 8 – is
A.284 B.213 C.142 D.71
9. A priority queue Q is used to implement a stack S that stores characters. PUSH(C) is
implemented as INSERT(Q, C, K) where K is an appropriate integer key chosen by the
implementation. POP is implemented as DELETEMIN(Q). For a sequence of operations, the keys
chosen are in
A. Non-increasing order B. Non-decreasing order C. Strictly Increasing Order
D. Strictly Decreasing Order
V.MANIKANDAN.M.Sc.,B.Ed.,M.Phil,CCNA.
Paavai Engineering College,Namakkal-18. Email.ID : vmaniapt@Gmail.com
http://www.tnbedcsvips.in/study-materials/
10. Which one of the following is an application of Queue Data Structure?
A.When a resource is shared among multiple consumers.
B.When data is transferred asynchronously (data not necessarily received at same rate as sent)
between two processes
C.Load Balancing
D.All of the above
11. A priority queue can efficiently implemented using which of the following data structures?
Assume that the number of insert and peek (operation to see the current highest priority item)
and extraction (remove the highest priority item) operations are almost same.
A.Array
B.Linked List
C.Heap Data Structures like Binary Heap, Fibonacci Heap
D.None of the above
12. The maximum number of binary trees that can be formed with three unlabeled nodes is:
A.1 B.5 C.4 D.3
13. Consider a complete binary tree where the left and the right subtrees of the root are max-
heaps. The lower bound for the number of operations to convert the tree to a heap is
A.Ω(logn) B.Ω(n) C.Ω(nlogn) D.Ω(n2)
14. Which of the following operations is not O(1) for an array of sorted data. You may assume
that array elements are distinct.
A.Find the ith largest element B.Delete an element
C.Find the ith smallest element D.All of the above
15. The minimum number of comparisons required to determine if an integer appears more
than n/2 times in a sorted array of n integers is
(A) Theta(n) (B) Theta(logn)
(C) Theta(log*n) (D) Theta(1)
16. You have to sort 1 GB of data with only 100 MB of available main memory. Which sorting
technique will be most appropriate?
A.Heap sort B.Merge sort C.Quick sort D.Insertion sort
16. Which sorting algorithm will take least time when all elements of input array are identical?
Consider typical implementations of sorting algorithms.
A.Insertion Sort B.Heap Sort C.Merge Sort D.Selection Sort
V.MANIKANDAN.M.Sc.,B.Ed.,M.Phil,CCNA.
Paavai Engineering College,Namakkal-18. Email.ID : vmaniapt@Gmail.com
http://www.tnbedcsvips.in/study-materials/
17. Which of the following sorting algorithms has the lowest worst-case complexity?
A.Merge Sort B.Bubble Sort C.Quick Sort D.Selection Sort
18. You have an array of n elements. Suppose you implement quicksort by always choosing the
central element of the array as the pivot. Then the tightest upper bound for the worst case
performance is A.O(n2) B.O(nLogn) C.Theta(nLogn) D.O(n3)
19. What is the best sorting algorithm to use for the elements in array are more than 1 million
in general? A.Merge sort. B.Bubble sort. C.Quick sort. D.Insertion sort.
Which of the below given sorting techniques has highest best-case runtime complexity.
A.Quick sort B.Selection sort C.Insertion sort D.Bubble sort
20. Which data structure is used for balancing of symbols?
A.Stack B.Queue C.Tree D.Graph
21. Which data structure is used in redo-undo feature?
A.Stack B.Queue C.Tree D.Graph
21. What does the following function print for n = 25?
void fun(int n)
{
if (n == 0)
return;

printf("%d", n%2);
fun(n/2);
}

A.11001 B.10011 C.11111 D.00000

V.MANIKANDAN.M.Sc.,B.Ed.,M.Phil,CCNA.
Paavai Engineering College,Namakkal-18. Email.ID : vmaniapt@Gmail.com
http://www.tnbedcsvips.in/study-materials/
1. What are linear and non linear data Structures?
1. Linear: Array. Linked List, Stacks and Queues
2. Non-Linear: Graph and Trees.
2. What are the various operations that can be performed on different Data Structures?
 Insertion − Add a new data item in the given collection of data items.
 Deletion − Delete an existing data item from the given collection of data items.
 Traversal − Access each data item exactly once so that it can be processed.
 Searching − Find out the location of the data item if it exists in the given collection of data items.
 Sorting − Arranging the data items in some order i.e. in ascending or descending order in case of
numerical data and in dictionary order in case of alphanumeric data.

3. How is an Array different from Linked List?


 The size of the arrays is fixed, Linked Lists are Dynamic in size.
 Inserting and deleting a new element in an array of elements is expensive, Whereas both insertion
and deletion can easily be done in Linked Lists.
 Random access is not allowed in Linked Listed.
 Extra memory space for a pointer is required with each element of the Linked list.
 Arrays have better cache locality that can make a pretty big difference in performance.
4. What is Stack and where it can be used?
Stack is a linear data structure which the order LIFO(Last In First Out) or FILO(First In Last
Out) for accessing elements. Basic operations of stack are : Push, Pop , Peek
5. Applications of Stack:

1. Infix to Postfix Conversion using Stack


2. Evaluation of Postfix Expression
3. Reverse a String using Stack
4. Implement two stacks in an array
5. Check for balanced parentheses in an expression

6. What is a Queue, how it is different from stack and how is it implemented?


Queue is a linear structure which follows the order is First In First Out (FIFO) to access
elements. Mainly the following are basic operations on
queue: Enqueue, Dequeue, Front, Rear
The difference between stacks and queues is in removing. In a stack we remove the item
the most recently added; in a queue, we remove the item the least recently added. Both
Queues and Stacks can be implemented using Arrays and Linked Lists.

V.MANIKANDAN.M.Sc.,B.Ed.,M.Phil,CCNA.
Paavai Engineering College,Namakkal-18. Email.ID : vmaniapt@Gmail.com
http://www.tnbedcsvips.in/study-materials/
7. Types of Linked List :
1. Singly Linked List : In this type of linked list, every node stores address or reference of next node
in list and the last node has next address or reference as NULL. For example 1->2->3->4->NULL
2. Doubly Linked List : Here, here are two references associated with each node, One of the
reference points to the next node and one to the previous node. Eg. NULL<-1<->2<->3->NULL
3. Circular Linked List : Circular linked list is a linked list where all nodes are connected to form a
circle. There is no NULL at the end. A circular linked list can be a singly circular linked list or doubly
circular linked list. Eg. 1->2->3->1 [The next pointer of last node is pointing to the first]
8. What are Infix, prefix, Postfix notations?
 Infix notation: X + Y – Operators are written in-between their operands. This is the usual way we
write expressions. An expression such as
A * ( B + C ) / D

 Postfix notation (also known as “Reverse Polish notation”): X Y + Operators are


written after their operands. The infix expression given above is equivalent to
A B C + * D/

 Prefix notation (also known as “Polish notation”): + X Y Operators are written before their
operands. The expressions given above are equivalent to
/ * A + B C D

V.MANIKANDAN.M.Sc.,B.Ed.,M.Phil,CCNA.
Paavai Engineering College,Namakkal-18. Email.ID : vmaniapt@Gmail.com

You might also like