0% found this document useful (0 votes)
103 views3 pages

C Programming Data Structures Experiments

This document outlines 10 experiments involving data structures and algorithms. The experiments cover implementing and using arrays, stacks, queues, linked lists, trees, and their applications. Students will design, develop and implement programs in C featuring operations and demonstrations of overflow, underflow and traversal for each data structure. The goal is for students to gain practical experience with common data structures.

Uploaded by

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

C Programming Data Structures Experiments

This document outlines 10 experiments involving data structures and algorithms. The experiments cover implementing and using arrays, stacks, queues, linked lists, trees, and their applications. Students will design, develop and implement programs in C featuring operations and demonstrations of overflow, underflow and traversal for each data structure. The goal is for students to gain practical experience with common data structures.

Uploaded by

varun
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

(ISO 9001:2015 Certified)

Accredited with ‘A’ Grade by NAAC


.Department of Computer Science & Engineering.
_______________________________________________________________________

Subject Code: CS2001-1 Subject Title: Data Structures


Chapter Number: Chapter Title: Practical’s

PlannedHours:02 per Experiments

Experiment List

1. Design, Develop and Implement a menu driven Program in C for the following
a) To create an Array of N Integer Elements and store n values.
• Inserting an Element (ELEM) at a given valid Position (POS)
• Deleting an Element at a given valid Position POS)
• Display of Array Elements
• Exit.
Support the program with functions for each of the above operations.

b) To create student structure with fields Roll No, Name, Semester, marks in 3
subjects. And Write functions to
• Enter 5 students’ details and display the same using pointer to structure
• Find Student wise and subject wise total marks and display the same.

2. Design, Develop and Implement a menu driven Program in C for the following
operations on
a) STACK of Integers (Array with structure Implementation of Stack with size
MAX)
• Push an Element on to Stack.
• Pop an Element from Stack.
• Demonstrate Overflow and Underflow situations on Stack.
• Display the status of Stack.
• Exit
3. Queue of Integers (Array with structure Implementation of Queue with size MAX)
• Insert an Element in to Queue.
• Delete an Element from Queue.
• Demonstrate Overflow and Underflow situations on Queue.
• Display the status of Queue.
• Exit

Support the program with appropriate functions for each of the above
operations

4. Design, Develop and Implement a Program in C for the following Stack Applications
• Evaluation of Suffix expression with single digit operands and operators: +, -,
*, /, %, ^ b
(ISO 9001:2015 Certified)
Accredited with ‘A’ Grade by NAAC
.Department of Computer Science & Engineering.
_______________________________________________________________________

5. Design, Develop and Implement a Program in C for converting an Infix Expression to


Postfix Expression. Program should support for both parenthesized and free
parenthesized expressions with the operators: +, -, *, /, % (Remainder), ^ (Power)
and alphanumeric operands

6. Design, Develop and Implement a menu driven Program in C for the following
operations on Circular QUEUE of Characters (Array Implementation of Queue with
maximum size MAX)
• Insert an Element on to Circular QUEUE.
• Delete an Element from Circular QUEUE.
• Demonstrate Overflow and Underflow situations on Circular QUEUE d.
Display the status of Circular QUEUE.
• Exit
Support the program with appropriate functions for each of the above
operations

7. Design, Develop and Implement a menu driven Program in C for the following
operations on Singly Linked List (SLL) for data of integers.
• Create a SLL of Data using front insertion.
• Display the status of SLL and count the number of nodes in it.
• Demonstration of stack
• Demonstration of Queue.
• Exit

8. Design, Develop and Implement a menu driven Program in C for the following
operations on Circular Singly Linked List (CSLL) for data of integers.
• Create a CSLL of data using front insertion.
• Perform Insertion and Deletion to the right of the given node.
• Perform Insertion and Deletion at end of CSLL.
• Display the status of CSLL and count the number of nodes in it.
• Exit

9. Design, Develop and Implement a menu driven Program in C for the following
operations on Doubly Linked List (DLL) for data of integers.
• Create a DLL of data.
• Perform Insertion and Deletion at End of DLL.
• Perform Insertion and Deletion at Front of DLL.
• Display the status of DLL and count the number of nodes in it.
• Exit
(ISO 9001:2015 Certified)
Accredited with ‘A’ Grade by NAAC
.Department of Computer Science & Engineering.
_______________________________________________________________________

10. Design, Develop and Implement a menu driven Program in C for the following
operations on Binary Search Tree (BST) of integers.
• Create a BST of N Integers: 6, 9, 5, 2, 8, 15, 24, 14, 7, 8, 5, 2.
• Traverse the BST in Inorder, Preorder and Post Order.
• Search the BST for a given element (KEY) and report the appropriate
message.
• Exit

Common questions

Powered by AI

For a doubly linked list, operations include insertion and deletion at both the beginning and end of the list, with each node pointing to both its next and previous node, facilitating bidirectional traversal. In contrast, singular linked list operations are performed in a linear fashion with only forward traversal abilities, complicating certain operations like node deletion or end insertion that are more efficient in doubly linked lists .

Suffix expressions, or postfix expressions, can be evaluated using stacks by reading the expression from left to right and applying operators when an operand appears on top of the stack. This method is effective because it naturally respects operator precedence and eliminates the need for parentheses, making evaluation straightforward and efficient with fewer rules to manage compared to infix notation .

The benefits of using a singly linked list to demonstrate stack and queue operations include dynamic memory usage, which allows for flexible size not limited by pre-defined memory allocation, and easy insertion and deletion from the structure's start or end. However, limitations include potential overhead from pointer management, increased complexity in implementation compared to basic arrays, and inefficient access of elements compared to random access data structures .

Implementing menu-driven programs in C for data structures such as arrays, stacks, and queues provides an interactive interface that allows users to select and execute different operations easily. This approach improves user experience by organizing program execution into a series of straightforward choices, facilitating debugging and learning processes, and ensuring operations are available in a controlled and logical manner .

Implementing both singly and doubly linked lists is significant for understanding trade-offs in data structure design. Singly linked lists offer simpler structure and less memory overhead per node as each contains only one pointer, but their operations can be less efficient, particularly for backward traversal. Doubly linked lists support efficient two-way traversal and easier node deletion, as they include pointers to both next and previous nodes, at the cost of increased memory usage and complexity .

A circular queue using arrays in C incorporates pointers that wrap around to the beginning of the array when the end is reached, effectively utilizing space more efficiently compared to a regular queue. This is achieved by maintaining a 'front' and 'rear' index which wrap around upon reaching the array's 'MAX' size, necessitating careful management of the indices to avoid confusion between empty and full states .

Challenges in converting infix to postfix expressions, particularly for parenthesized and non-parenthesized expressions, include correctly handling operator precedence and associativity, managing parentheses, and ensuring operators are applied in the correct order. The algorithm must maintain an auxiliary stack to temporarily hold operators and ensure they are appended to the postfix expression only when appropriate based on precedence and expression structure .

Structures in C enhance the implementation of data structures like stacks and queues by grouping related variables into a single construct, improving data management and program organization. This encapsulation allows more clear and maintainable code by associating the data (like array storage and index pointers) with their respective operations (push, pop, insert, delete) in one structure, thus providing an abstraction layer .

Overflow occurs in a stack when trying to push an element onto a full stack, and underflow occurs when trying to pop from an empty stack. Similarly, in queues, overflow occurs when attempting to insert an element into a full queue, and underflow when deleting from an empty one. These conditions can be demonstrated by attempting these operations on a stack or queue that is initialized to its maximum size limit and observing the resultant error messages or handling .

Binary Search Trees (BSTs) facilitate efficient searching, insertion, and deletion due to their ordered nature—each node's left subtree contains only nodes with values less than the node's key, and the right subtree contains only keys greater than the node's key, enabling operations in O(log n) time on average. Limitations include possible degeneration into a linked list if elements are inserted in sorted order, negatively impacting performance to O(n).

You might also like