0% found this document useful (0 votes)
49 views82 pages

Unit 1-Data Structure

data structure

Uploaded by

Pratham Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views82 pages

Unit 1-Data Structure

data structure

Uploaded by

Pratham Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 82

Course Name: Data Structure

Course Code:CAP:301-22
Name of the Program/Semester: BCA 3rd

By: Ms.Gurpreet Kaur


Course Objective and Outcomes
Objectives: The objective of this course is to develop an understanding of the concept of algorithm design, methods and
techniques used to improve their performances.

Course Outcome: The successful completion of this course shall enable the student:

CO1: Ability to analyse the performance of algorithms

CO2: Ability to choose appropriate data structures and algorithm design methods for a specified application.

CO3: Ability to understand how the choice of data structures and the algorithm design methods impact the
performance of programs.

CO4: Ability to analyse the performance of algorithms.


Syllabus
Units Unit Name
1. Introduction
2. Arrays
3. Linked Lists
4. Stacks and queues
5. Trees and graphs
6. Search Algorithms
Unit 1

Syllabus
•Algorithms and Flowcharts
•Basic Analysis on algorithms
•Complexity of Algorithm
•Introduction and Definition of Data Structure
•Classification of Data Arrays
•Various Types Of Data Structure
•Static and Dynamic Memory Allocation
•Function
•Recursion
Algorithms
• An algorithm is a set of commands that must be followed for a computer to perform calculations or other
problem-solving operations.
• According to its formal definition, an algorithm is a finite set of instructions carried out in a specific order to
perform a particular task.
• It is not the entire program or code; it is simple logic to a problem represented as an informal description in
the form of a flowchart or pseudocode.

www.ctuniversity.in Campus:ludhiana
www.ctuniversity.in Campus:ludhiana
Example:Write an algorithm to multiply 2 numbers and print the result:

Step 1: Start
Step 2: Get the knowledge of input. Here we need 3 variables; a and b will be the user
input and c will hold the result.
Step 3: Declare a, b, c variables.
Step 4: Take input for a and b variable from the user.
Step 5: Know the problem and find the solution using operators, data structures and logic
We need to multiply a and b variables so we use * operator and assign the result to c.
That is c <- a * b
Step 6: Check how to give output, Here we need to print the output. So write print c
Step 7: End

CT UNIVERSITY
www.ctuniversity.in Campus:ludhiana
For Practice
• Write an algorithm to input marks of a student in three subjects and print the total
marks.
• Write an algorithm to print subtraction of two numbers.

CT UNIVERSITY CAMPUS:LUDHI
www.ctuniversity.in ANA Campus:ludhiana
Charateristics of an algorithm
• Problem: A problem can be defined as a real-world problem or real-world instance
problem for which you need to develop a program or set of instructions. An algorithm is a
set of instructions.
• Algorithm: An algorithm is defined as a step-by-step process that will be designed for a
problem.
• Input: After designing an algorithm, the algorithm is given the necessary and desired
inputs.
• Processing unit: The input will be passed to the processing unit, producing the desired
output.
• Output: The outcome or result of the program is referred to as the output.

www.ctuniversity.in Campus:ludhiana
Flowchart

Flowchart is a graphical representation of an algorithm. Programmers often use it as a program-


planning tool to solve a problem. It makes use of symbols which are connected among them to
indicate the flow of information and processing.

www.ctuniversity.in Campus : Ludhiana


Symbols used in flowchart
• Terminal: The oval symbol indicates Start, Stop and Halt in a program’s logic flow. A pause/halt
is generally used in a program logic under some error conditions. Terminal is the first and last
symbols in the flowchart.

www.ctuniversity.in Campus : Ludhiana


• Input/Output: A parallelogram denotes any function of input/output type. Program instructions
that take input from input devices and display output on output devices are indicated with
parallelogram in a flowchart.

www.ctuniversity.in Campus : Ludhiana


• Processing: A box represents arithmetic instructions. All arithmetic processes such as adding,
subtracting, multiplication and division are indicated by action or process symbol.

www.ctuniversity.in Campus : Ludhiana


• Decision: Diamond symbol represents a decision point. Decision based operations such as yes/no
question or true/false are indicated by diamond in flowchart.

CT UNIVERSITY CAMPUS:LUDHI
www.ctuniversity.in ANA Campus : Ludhiana
• Flow lines: Flow lines indicate the exact sequence in which instructions are executed. Arrows
represent the direction of flow of control and relationship among different symbols of flowchart.

www.ctuniversity.in Campus : Ludhiana


FIND THE SUM

CT UNIVERSITY CAMPUS:LUDHI
www.ctuniversity.in ANA Campus : Ludhiana
For Practice

• Draw a flowchart to input two numbers from the user and display the
largest of two numbers.
• Create a flowchart to input marks of a student in three subjects and
print the total marks.

www.ctuniversity.in Campus : Ludhiana


CT UNIVERSITY CAMPUS:LUDHI
www.ctuniversity.in ANA Campus : Ludhiana
Algorithms Vs Flowcharts

www.ctuniversity.in Campus : Ludhiana


• ANALYSIS OF ALGORITHMS

www.ctuniversity.in Campus : Ludhiana


Asymptotic notations
• Asymptotic notations are used to represent the complexities of
algorithms for asymptotic analysis.
• These notations are mathematical tools to represent the
complexities.
• There are three notations that are commonly used.

www.ctuniversity.in Campus : Ludhiana


Big Oh Notation

• The notation Ο(n) is the formal way to express the upper bound of an
algorithm's running time.
• It measures the worst case time complexity or the longest amount of time an
algorithm can possibly take to complete.

www.ctuniversity.in Campus : Ludhiana


Big Omega Notation

• The notation Ω(n) is the formal way to express the lower bound of an
algorithm's running time.
• It measures the best case time complexity or the best amount of time
an algorithm can possibly take to complete.

www.ctuniversity.in Campus : Ludhiana


Big Theta Notation

• The notation θ(n) is the formal way to express both the lower bound and
the upper bound of an algorithm's running time.
Average case complexity.

www.ctuniversity.in Campus : Ludhiana


Basic rules
1. Nested loops are multiplied together.
2. Sequential loops are added.
3. Only the largest term is kept, all others are dropped.
4. Constants are dropped.
5. Conditional checks are constant (i.e. 1).

www.ctuniversity.in Campus:ludhiana
Example 1
• //linear
• for(int i = 0; i < n; i++)
• {
• cout << i << endl;
• }

• A. n
• B. n^2
• C. nlogn
• D. logn
• Ans: O(n)

www.ctuniversity.in Campus:ludhiana
Example 2
• //quadratic
• for(int i = 0; i < n; i++) {
• for(int j = 0; j < n; j++){
• //do swap stuff, constant time
• }
• }

• A. n
• B. n^2
• C. nlogn
• D. logn
www.ctuniversity.in Campus:ludhiana
• Ans O(n^2)

www.ctuniversity.in Campus:ludhiana
Example 3
• for(int i = 0; i < 2*n; i++) {
• cout << i << endl;
•}

• A. n
• B. n^2
• C. nlogn
• D. logn

www.ctuniversity.in Campus:ludhiana
• At first you might say that the upper bound is O(2n); however, we
drop constants so it becomes O(n)

www.ctuniversity.in Campus:ludhiana
Example 4
• //linear
• for(int i = 0; i < n; i++) {
• cout << i << endl;
• }

• //quadratic
• for(int i = 0; i < n; i++) {
• for(int j = 0; j < n; j++){
• //do constant time stuff
• }
• }

• A. n
• B. n^2
• C. nlogn
www.ctuniversity.in
• D. logn Campus:ludhiana
• Ans : In this case we add each loop's Big O, in this case n+n^2.
O(n^2+n) is not an acceptable answer since we must drop the lowest
term. The upper bound is O(n^2). Why? Because it has the largest
growth rate

www.ctuniversity.in Campus:ludhiana
Example 5
• for(int i = 0; i < n; i++) {
• for(int j = 0; j < 2; j++){
• //do stuff
• }
•}

• A. n
• B. n^2
• C. nlogn
• D. logn
www.ctuniversity.in Campus:ludhiana
• Ans: Outer loop is 'n', inner loop is 2, this we have 2n, dropped
constant gives up O(n)

www.ctuniversity.in Campus:ludhiana
Example 6
• for(int i = 1; i < n; i *= 2) {
• cout << i << endl;
•}

• A. n
• B. n^2
• C. nlogn
• D. logn

www.ctuniversity.in Campus:ludhiana
• There are n iterations, however, instead of simply incrementing, 'i' is
increased by 2*itself each run. Thus the loop is log(n).

www.ctuniversity.in Campus:ludhiana
Example 7
• for(int i = 0; i < n; i++) { //linear
• for(int j = 1; j < n; j *= 2){ // log (n)
• //do constant time stuff
• }
•}

• A. n
• B. n^2
• C. nlogn
• D. logn
www.ctuniversity.in Campus:ludhiana
• Ans: n*log(n)

www.ctuniversity.in Campus:ludhiana
For Practice

• Draw a flowchart to input two numbers from the user and display the
largest of two numbers.
• Create a flowchart to input marks of a student in three subjects and
print the total marks.

www.ctuniversity.in Campus : Ludhiana


Performance of an algorithm

• Generally, the performance of an algorithm depends on the following elements...


1.Whether that algorithm is providing the exact solution for the problem?
2.Whether it is easy to understand?
3.Whether it is easy to implement?
4.How much space (memory) it requires to solve the problem?
5.How much time it takes to solve the problem? Etc.,

CT UNIVERSITY CAMPUS:LUDHI
www.ctuniversity.in ANA Campus : Ludhiana
Algorithm Analysis

• Algorithm analysis is an important part of computational complexity theory, which provides


theoretical estimation for the required resources of an algorithm to solve a specific computational
problem. Analysis of algorithms is the determination of the amount of time and space resources
required to execute it.

www.ctuniversity.in Campus : Ludhiana


Why Analysis of Algorithms is important?

• To predict the behavior of an algorithm without implementing it on a specific computer.


• It is much more convenient to have simple measures for the efficiency of an algorithm
than to implement the algorithm and test the efficiency every time a certain parameter in
the underlying computer system changes.
• It is impossible to predict the exact behavior of an algorithm. There are too many
influencing factors.
• The analysis is thus only an approximation; it is not perfect.
• More importantly, by analyzing different algorithms, we can compare them to determine
the best one for our purpose.

www.ctuniversity.in Campus : Ludhiana


Types of Algorithm Analysis

1.Best case
2.Worst case
3.Average case

www.ctuniversity.in Campus : Ludhiana


Complexity of an Algorithm

• Complexity in algorithms refers to the amount of resources (such as time or memory) required to
solve a problem or perform a task. The most common measure of complexity is time complexity,
which refers to the amount of time an algorithm takes to produce a result as a function of the size
of the input.
• The complexity of an algorithm is a function describing the efficiency of the algorithm in terms of
the amount of data the algorithm must process.

CT UNIVERSITY CAMPUS:LUDHI
www.ctuniversity.in ANA Campus : Ludhiana
Time Complexity: Time taken by the algorithm to solve the problem. It is measured by calculating
the iteration of loops, number of comparisons etc.
• Time complexity is a function describing the amount of time an algorithm takes in terms of the
amount of input to the algorithm.
• “Time” can mean the number of memory accesses performed, the number of comparisons between
integers, the number of times some inner loop is executed, or some other natural unit related to the
amount of real time the algorithm will take.

www.ctuniversity.in Campus : Ludhiana


Space Complexity: Space taken by the algorithm to solve the problem. It includes space
used by necessary input variables and any extra space (excluding the space taken by inputs)
that is used by the algorithm. For example, if we use a hash table (a kind of data structure),
we need an array to store values so
• This is an extra space occupied, hence will count towards the space complexity of the
algorithm. This extra space is known as Auxiliary Space.
• Space complexity is a function describing the amount of memory(space)an algorithm
takes in terms of the amount of input to the algorithm.
• Space complexity is sometimes ignored because the space used is minimal and/ or
obvious, but sometimes it becomes an issue as time.

www.ctuniversity.in Campus : Ludhiana


Definition of Data Structures
Data Structure

Name indicates itself, data structure is organizing the data in memory.


There are many ways of organizing the data in the memory.
The data structure is not any programming language like C, C++, java, etc.
It is a set of algorithms that we can use in any programming language to structure the data in the
memory.
Mathematical or logical representation of data: data structure

www.ctuniversity.in Campus : Ludhiana


Types of Data Structures
There are two types of data structures:
• Primitive data structure
• Non-primitive data structure

Primitive Data structure


• The primitive data structures are primitive data types.
• The int, char, float, double, and pointer are the primitive data structures that can hold a single
value.

Non-Primitive Data structure: that can hold many values.


• The non-primitive data structure is divided into two types:
• Linear data structure
• Non-linear data structure

www.ctuniversity.in Campus : Ludhiana


Linear Data Structure
• The arrangement of data in a sequential manner is known as a linear data structure.
• The data structures used for this purpose are Arrays, Linked list, Stacks, and Queues.
• In these data structures, one element is connected to only one another element in a linear
form.

www.ctuniversity.in Campus : Ludhiana


Non linear Data Structure
• When one element is connected to the 'n' number of elements known as a non-linear data structure.
• The best example is trees and graphs. In this case, the elements are arranged in a random manner.

www.ctuniversity.in Campus : Ludhiana


Data structures can also be classified as:
• Static data structure: It is a type of data structure where the size is allocated at the
compile time. Therefore, the maximum size is fixed.
• Dynamic data structure: It is a type of data structure where the size is allocated at the
run time. Therefore, the maximum size is flexible.

www.ctuniversity.in Campus : Ludhiana


Major Operations
The major or the common operations that can be performed on the data structures are:
• Searching: We can search for any element in a data structure.
• Sorting: We can sort the elements of a data structure either in an ascending or descending
order.
• Insertion: We can also insert the new element in a data structure.
• Updation: We can also update the element, i.e., we can replace the element with another
element.
• Deletion: We can also perform the delete operation to remove the element from the data
structure.

www.ctuniversity.in Campus : Ludhiana


www.ctuniversity.In Campus:ludhiana
• When talking in terms of computer science and programming, the algorithms we use to solve
complex problems in a systematic and controlled way are designed on the basis of two approaches
• Top-down approach
• Bottom-up approach

CT UNY CAMPUS:LUDHIANA
CTwww.ctuniversity.in
UNIVERSITY CAMPUS:LUDHIANA
Campus:ludhiana
Difference between Top-down and Bottom-up
Approach
Top-Down Approach Bottom-Up Approach

Divides a problem into smaller units and then solve it. Starts from solving small modules and adding them up together.

This approach contains redundant information. Redundancy can easily be eliminated.

A well-established communication is not required. Communication among steps is mandatory.

The individual modules are thoroughly analysed. Works on the concept of data-hiding and encapsulation.

Structured programming languages such as C uses top-down approach. OOP languages like C++ and Java, etc. uses bottom-up mechanism.

Relation among modules is not always required. The modules must be related for better communication and work flow.

Primarily used in code implementation, test case generation, debugging and


Finds use primarily in testing.
module documentation.

CTwww.ctuniversity.in
UNIVERSITY CAMPUS:LUDHIANA
Campus:ludhiana
DATA TYPES
• As its name indicates, a data type represents a type of the data which you can process
using your computer program. It can be numeric, alphanumeric, decimal, etc.
• Each variable is assigned a data type that determines what type of data the variable may
contain.
• The term "data type" and "primitive data type" are often used interchangeably.
• Primitive data types are predefined types of data, which are supported by the
programming language. For example, integer, character, and string are all primitive data
types. Programmers can use these data types when creating variables in their programs.
• For example, a programmer may create a variable called "lastname" and define it as a
string data type. The variable will then store data as a string of characters.

CTwww.ctuniversity.in
UNIVERSITY CAMPUS:LUDHIANA
Campus:Ludhiana
• Non-primitive data types are not defined by the programming language, but are instead
created by the programmer.
• They are sometimes called "reference variables," or "object references," since they
reference a memory location, which stores the data.

www.ctuniversity.in Campus:ludhiana
CTwww.ctuniversity.in
UNIVERSITY CAMPUS:LUDHIANA
Campus:ludhiana
www.ctuniversity.in Campus:ludhiana
Difference between Variables and Constant in C Program

Variables Constants
It is a variable that stores data type value in a It is similar to a variable and cannot be
program and can be changed during program changed during program execution.
execution.
It is a variable that can be changed after It is a fixed variable that cannot be changed
defining the variable in a program after defining the variable in a program.

The value of a variable can change depending In constants, the value cannot be changed.
on the conditions.

Typically, it uses int, float, char, string, double, It can be express in two ways: #define pre-
etc. data types in a program. processor and the const keyword.

Example: int a = 5; float radius = 5.2; char Example: const int Len = 5;
'A'; #define PI 3.14

www.ctuniversity.In Campus:ludhiana
• A pointer is a variable whose value is the address of another variable.

The general form of a pointer variable declaration is −


type *var-name;

int *ip; /* pointer to an integer */


double *dp; /* pointer to a double */
float *fp; /* pointer to a float */
char *ch /* pointer to a character */

www.ctuniversity.in Campus:ludhiana
Atomic data type
• An instance of an atomic data type is a single, indivisible unit of data. For each type, a description
of its instances is given.
• Example of Atomic Data Types
• Data Type INTEGER
• LONG
• FLOAT

www.ctuniversity.In Campus:ludhiana
Complex Data Types
• An instance of a complex data type contains multiple values and provides access to its
nested values. Currently, Oracle NoSQL Database supports the following kinds of
complex values:
• Example of Complex Data Types
• ARRAY : In general, an array is an ordered collection of zero or more items. The items
of an array are called elements. Arrays cannot contain any NULL values.An instance of
ARRAY (T) is an array whose elements are all instances of type T. T is called element
type of the array.
• MAP (T)In general, a map is an unordered collection of zero or more key-item pairs,
where all keys are strings. The keys in a map must be unique. The key-item pairs are
called fields. The keys are called fields names, and the associated items are called field
values. Maps cannot contain any NULL field value.An instance of MAP (T) is a map
whose field values are all instance of type T. T is called the value type of the map.

www.ctuniversity.in Campus:ludhiana
Abstract Datatype
• The Data Type is basically a type of data that can be used in different computer program. It
signifies the type like integer, float etc, the space like integer will take 4-bytes, character will take
1-byte of space etc.
• The abstract datatype is special kind of datatype, whose behavior is defined by a set of values and
set of operations. The keyword “Abstract” is used as we can use these datatypes, we can perform
different operations. But how those operations are working that is totally hidden from the user. The
ADT is made of with primitive datatypes, but operation logics are hidden.

www.ctuniversity.In Campus:ludhiana
• Some examples of ADT are Stack, Queue, List etc.
Let us see some operations of those mentioned ADT −
• Stack −
• isFull(), This is used to check whether stack is full or not
• isEmpty(), This is used to check whether stack is empty or not
• push(x), This is used to push x into the stack
• pop(), This is used to delete one element from top of the stack
• peek(), This is used to get the top most element of the stack
• size(), this function is used to get number of elements present into the stack

www.ctuniversity.in Campus: Ludhiana


• Queue −
• isFull(), This is used to check whether queue is full or not
• isEmpty(), This is used to check whether queue is empty or not
• insert(x), This is used to add x into the queue at the rear end
• delete(), This is used to delete one element from the front end of the queue
• size(), this function is used to get number of elements present into the queue

www.ctuniversity.In Campus:ludhiana
• List −
• size(), this function is used to get number of elements present into the list
• insert(x), this function is used to insert one element into the list
• remove(x), this function is used to remove given element from the list
• get(i), this function is used to get element at position i
• replace(x, y), this function is used to replace x with y value

www.ctuniversity.in Campus:ludhiana
Representation of Data Structures
• Data structure representation can be implemented in two ways.
• They are: –
• Sequential representation
• Linked representation

www.ctuniversity.In Campus:ludhiana
Sequential Representation
• A sequential representation maintains the data in contiguous memory locations which takes less
time to retrieve the data but leads to time complexity during insertion and deletion operations.
Because of its sequential nature, the elements of the list must be freed, when we want to insert a
new element or new data at a particular position of the list.
• To acquire free space in the list, one must shift the data of the list towards the right side from the
position where the data has to be inserted. Thus, the time taken by the CPU to shift the data will be
much higher than the insertion operation and will lead to complexity in the algorithm. Similarly,
while deleting an item from the list, one must shift the data items towards the left side of the list,
which may waste CPU time.
• A drawback of Sequential representation: – The major drawback of sequential representation is
taking much time for insertion and deletion operations unnecessarily and increasing the
complexity of the algorithm.

www.ctuniversity.in Campus:ludhiana
Linked Representation
• Linked representation maintains the list by means of a link between the adjacent elements which
need not be stored in contiguous memory locations. During insertion and deletion operations, links
will be created or removed between which takes less time when compared to the corresponding
operations of sequential representation.

www.ctuniversity.In Campus:ludhiana
Difference Between Static and Dynamic
Allocation
S.No Static Memory Allocation Dynamic Memory Allocation

In the static memory allocation, variables get allocated permanently, In the Dynamic memory allocation, variables get allocated only if
1
till the program executes or function call finishes. your program unit gets active.

2 Static Memory Allocation is done before program execution. Dynamic Memory Allocation is done during program execution.

3 It uses stack for managing the static allocation of memory It uses heap for managing the dynamic allocation of memory

4 It is less efficient It is more efficient

In Dynamic Memory Allocation, there is memory re-usability and


5 In Static Memory Allocation, there is no memory re-usability
memory can be freed when not required

In static memory allocation, once the memory is allocated, the In dynamic memory allocation, when memory is allocated the
6
memory size can not change. memory size can be changed.

www.ctuniversity.in Campus:ludhiana
Difference Between Static and
Dynamic Allocation
In this memory allocation scheme, execution is In this memory allocation scheme, execution is
7 faster than dynamic memory allocation. slower than static memory allocation.

8 In this memory is allocated at compile time. In this memory is allocated at run time.

In this allocated memory remains from start to In this allocated memory can be released at any time
9
end of the program. during the program.

Example: This static memory allocation is Example: This dynamic memory allocation is
10
generally used for array. generally used for linked list.

www.ctuniversity.In Campus:ludhiana
Recursion Algorithms

• The process in which a function calls itself directly or indirectly is called recursion. Using a
recursive algorithm, certain problems can be solved quite easily. Examples of such problems
are Towers of Hanoi (TOH), Inorder/Preorder/Postorder Tree Traversals, DFS of Graph, etc.

www.ctuniversity.in Campus : Ludhiana


Recursion Functions

• Recursive Functions are the corresponding functions that implement Recursion (Function calling
itself) within them. A recursive function solves a particular problem by calling a copy of itself and
solving smaller subproblems of the original problems. Many more recursive calls can be generated
as and when required.

CT UNIVERSITY CAMPUS:LUDHI
www.ctuniversity.in ANA Campus : Ludhiana
Data Structure Functions
• Unlike the programming language C, Benchmark Description Language (BDL) does not support
structured data types. Instead, BDL uses a series of type-dependent Get and Set functions to access
data in external C data structures.
• The following example illustrates a C data structure:

CTwww.ctuniversity.in
UNIVERSITY CAMPUS:LUDHIANA
Campus:ludhiana
Case study on data structure

Exercise 1 Write a program that reads a file, breaks each line into words, strips whitespace and punctuation from the words,
and converts them to lowercase.
Hint: The string module provides strings named whitespace, which contains space, tab, newline, etc., and punctuation which
contains the punctuation characters. Let’s see if we can make Python swear:
>>> import string >>> print string.punctuation !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
Also, you might consider using the string methods strip, replace and translate.
Exercise 2
Modify your program from the previous exercise to read the book you downloaded, skip over the header information at the
beginning of the file, and process the rest of the words as before.
Then modify the program to count the total number of words in the book, and the number of times each word is used.
Print the number of different words used in the book. Compare different books by different authors, written in different eras.
Which author uses the most extensive vocabulary?

CT UNIVERSITY
www.ctuniversity.in
Assignment

CTwww.ctuniversity.in
CT UNIVERSITY
UNIVERSITY Campus:ludhiana
CAMPUS:LUDHIANA
CAMPUS:LUDHIANA
Very Short Answer Type

1.What do you linear data structure? Give example.


2.What do you mean by non-linear data structure? Give example.
3.What is an algorithm?
4.Define flowchart.
5.Discuss some disadvantages of an algorithm.

www.ctuniversity.in
CTwww.ctuniversity.in
UNIVERSITY CAMPUS:LUDHIANA
Campus:ludhiana
Short Answer Type

1. Define data structure.


2. List the various operations that can be performed on data structure.
3. What is a linked list?
4. List any four applications of stack.
5.What is the advantage of linked list over arrays?

www.ctuniversity.in Campus:ludhiana
Long Answer Type

1.Explain the insertion operation in linked list. How nodes are inserted after a specified node.
2.Write an algorithm to insert a node at the beginning of list? 3.Discuss the merge operation in circular linked lists.
3.What are the applications of linked list in dynamic storage management?
4.How polynomial expression can be represented using linked list?
5.What are the benefit and limitations of linked list?
6.Define the deletion operation from a linked list.
7.What are the different types of data structure?

CTwww.ctuniversity.in
UNIVERSITY CAMPUS:LUDHIANA
Campus:ludhiana

You might also like