Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

Data structure (module 3)

Rating
-
Sold
-
Pages
20
Uploaded on
30-01-2025
Written in
2024/2025

These are class notes,easy to study in short time.

Institution
Course

Content preview

MODULE III
1. Write a C function to insert_front and delete_front using Doubly Linked List(8)
2. Write a c function for concatenation of two doubly linked list(5)
3. Describe the doubly linked list with advantages and disadvantages. Write a c function to
delete a node from a circular doubly linked list with header node(8)
4. For the given sparse matrix, write the diagrammatic linked list representation(4)
3000
5006
A 0000
4008
0090
5. What is a tree. With suitable example define (10)
a. Binary tree
b. Complete binary tree
c. Level of the binary tree
d. Degree of the tree
e. Strictly binary tree
f. Skewed binary tree
6. Consider the following tree T. Write the in-order, pre-order and post-order traversals for
the tree T along with C functions. Also find the depth of the tree T(10)

A


B C




D G H
E



J K


7. Give the following traversal, draw a binary tree
a. Inorder:4 2 5 1 6 7 3 8 L
Postorder: 4 5 2 6 7 8 3 1
b. Preorder: A B C E I F J D G H K L
Inorder: E I C F J B G D K H L
8. Represent the below given tree in A
a. Linked list representation
b. Left child right sibling representation B D
C



E G H
F



I



J K

,9. Define Threaded binary tree. List its advantages and disadvantages. Draw the one way
threading and two way threading of the following binary tree (8)
A

B C



D F G
E
G

H
10. Explain threaded binary trees and their representation with a neat diagram. Also develop a
C function to do the in-order traversal of a Threaded binary tree(8)
11. Draw the binary tree for the following expression: ((6+(3-2)*5)^2+3. Traverse the above
generated tree using in-order, pre-order and post-order traversals and also write their
respective functions(10)
12. Define expression tree. For the given tree traverse using in-order, pre-order and post-order
traversals.(7)
+

*



*
+




B *



C
E



D

13. Outline the steps involved in construction of expression tree. Construct expression tree for
the following input: AB+C* (10)
14. Write the routines for(10)
a. Copying of Binary trees
b. Testing equality of binary trees

, 1. Write a C function to insert_front and delete_front using Doubly Linked List(8)
Doubly Linked List
• A doubly linked list or a two-way linked list is a more complex type of linked list which
contains a pointer to the next as well as the previous node in the sequence.
• Each node has three parts
• data – contains data element
• next – contains the address of the next node in the list
• prev - contains the address of the preceding node in the list




Insert Front
struct node *insert_beg(struct node *start)
{
struct node *new_node;
int num;
printf("\n Enter the data : ");
scanf("%d", &num);
new_node = (struct node *)malloc(sizeof(struct node));
new_node -> data = num;
start -> prev = new_node;
new_node -> next = start;
new_node -> prev = NULL;
start = new_node;
return start;
}

Delete Front
struct node *delete_beg(struct node *start)
{
struct node *ptr;
ptr = start;
start = start -> next;
start -> prev = NULL;
free(ptr);
return start;
}

2. Write C function for the concatenation of two doubly linked lists. (5marks)
C Function to concatenate two doubly linked lists
void concatenate()
{
struct node *link;

Written for

Institution
Course

Document information

Uploaded on
January 30, 2025
Number of pages
20
Written in
2024/2025
Type
Class notes
Professor(s)
Santosh
Contains
Data structure

Subjects

$8.49
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
supriyadhonedhone

Also available in package deal

Get to know the seller

Seller avatar
supriyadhonedhone Guru nanak dev engineering College,bidar
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
1 year
Number of followers
0
Documents
5
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions