Cse Lab Manual
Cse Lab Manual
AIM:
To develop programming skills in design and implementation of data
structures and
their applications.
Algorithm:
Step3: Get the option from the user for list process.
Step4: In addtem process give the number of nodes and nodes value.
Step5: In listitems process display the items untill the current node point’s null
value.
Step6: In delnode process check the list status, if not null get the value of
deleted
Step7: In insert process give the value of the new node and give the new node
position
Step8: After the entire process give the option to exit from the program.
Ex.No:2 Doubly Linked List
Date:
Aim:
Algorithm:
Step 4: If the choice is 1, then enter the element to be inserted to the left of the
Step 5: If the choice is 2, then delete all the occurrences of the element to be
Step 6: If the choice is 3, then display all the elements in doubly linked list.
Step 9: Stop.
Ex.No:3 Polynomial Addition
Date:
Aim:
Algorithm:
Step3: Get the value of co – efficient and exponent value of two polynomial
expressions
Step5: If the exponent values are same add the polynomial co – efficient.
Step6: If the exponent values are different add the biggest exponent’s co –
efficient value in to the result polynomial.
Date:
Aim:
Algorithm:
Step3: Read the given infix expression into string called infix.
Step7: If the character is a right parenthesis, pop all operators from the stack till
it encounters left parenthesis, discard both the parenthesis in the output.
Step8: Display the postfix expression for the given infix expression.
Aim:
Algorithm:
Step3: Declare the following function Rinsert(), RDelete(), LInsert() and LDelete()
to insert and delete an element into and from the queue.
Aim:
Algorithm:
Date:
Aim:
Algorithm:
Step5: The find() function gets the value of element to be search and return the
element
Step6: The findmin() function display the minimum value element of the tree.
Date:
Aim:
Algorithm:
Step 2: Get no.of edges, no.of vertices and the edges & their cost.
Step 3: Assign lowcost of all vertices from 2 to n to cost of first vertex to the
vertex and assign closest of all vertices to 1.
Assign 2 to k,
and assign j to k.
Check whether cost of j,k < lowcost of j,and lowcost of j < infinity,
Date:
Aim:
Algorithm:
Step 3:
Date:
Aim:
Algorithm:
Step2: Create the main function and declare the functions create(), linearprob
and display().
Step3: Create function for generating the hash key and return the hash key.
Step5: If the location indicate by the hash key is empty and placed the number in
the hash table.
2. List out the areas in which data structures are applied extensively?
The names of areas are:
• Compiler Design,
• Operating System,
• Database Management System,
• Statistical analysis package,
• Numerical Analysis,
• Graphics,
• Artificial Intelligence,
• Simulation
1. What are the major data structures used in the following areas: RDBMS,
Network data model & Hierarchical data model?
The major data structures used are as follows:
• RDBMS - Array (i.e. Array of structures)
• Network data model - Graph
• Hierarchical data model - Trees
Two. One queue is used for actual storing of data and another for
storing priorities.
system stack for storing the return addresses of the function calls.
4. What is a Register?
A register is a small amount of memory within the CPU that is used to temporarily
store instructions and data.
7. Which of the following abstract data types are NOT used by Integer Abstract
Data type group?
• Short
• Int
• Float
• long
Explanation: The integer abstract data type group consists of four abstract data
types used to reserve memory to store whole numbers: byte, short, int , and long
1. What are all the applications for the tree data structure?
• Manipulation of the arithmetic expressions.
• Symbol table construction.
• Syntax analysis.
1. Which data structure is used to perform recursion?
The answer is Stack. Stack has the LIFO (Last In First Out) property; it
remembers it's ‘caller’. Therefore, it knows to whom it should return when the
function has to return. On the other hand, recursion makes use of the system stack
for storing the return addresses of the function calls.
2. Which data structures algorithm used in solving the eight Queens problem?
Backtracking
4. There are 8, 15, 13, and 14 nodes in four different trees. Which one of them
can form a full binary tree?
The answer is the tree with 15 nodes. In general, there are 2^n-1 nodes in a full
binary tree.
Full binary trees contain odd number of nodes, so there cannot be full binary
trees with 8 or 14 nodes. Moreover, with 13 nodes you can form a complete binary
tree but not a full binary tree. Thus, the correct answer is 15.
5. Convert the expression ((A + B) * C - (D - E) ^ (F + G)) to equivalent Prefix
and Postfix notations.
Prefix Notation: ^ - * +ABC - DE + FG
Postfix Notation: AB + C * DE - - FG + ^
6. List out few of the applications that make use of Multilinked Structures?
The applications are listed below:
• Sparse matrix,
• Index generation.
1. What are the methods available in storing sequential files?
10.Priority Queue
A priority queue is essentially a list of items in which each item has associated
with it a priority. In general different items may have different priorities and we
speak of one item having a higher priority than another. Given such a list we can
determine which is the highest (or the lowest) priority item in the list. Items are
inserted into a priority queue in any arbitrary order.