Docsity

Data Structures Laboratory, Cheat Sheet of Chemistry

Toggle sidebar
bg1
Maharaja Education Trust (R), Mysuru
Maharaja Institute of Technology Mysore
Belawadi, Sriranga Pattana Taluk, Mandya – 571 477
Approved by AICTE, New Delhi,
Affiliated to VTU, Belagavi & Recognized by Government of Karnataka
Lecture Notes on
Data Structures Laboratory (18CSL38)
Prepared by,
Kavya Priya M L,
Assistant Professor, CSE, MITM
Department of Computer Science & Engineering
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d

Partial preview of the text

Download Data Structures Laboratory and more Cheat Sheet Chemistry in PDF only on Docsity!

Maharaja Education Trust (R), Mysuru

Maharaja Institute of Technology Mysore

Belawadi, Sriranga Pattana Taluk, Mandya – 571 477

Approved by AICTE, New Delhi, Affiliated to VTU, Belagavi & Recognized by Government of Karnataka

Lecture Notes on

Data Structures Laboratory (18CSL38)

Prepared by,

Kavya Priya M L,

Assistant Professor, CSE, MITM

Department of Computer Science & Engineering

Maharaja Education Trust (R), Mysuru

Maharaja Institute of Technology Mysore

Belawadi, Sriranga Pattana Taluk, Mandya – 571 477

Vision/ ಆಶಯ

“To be recognized as a premier technical and management institution promoting extensive education fostering research, innovation and entrepreneurial attitude" ಸಂವೆ ೋಧನೆ , ಆವಿ ಶ಺ಾರ ಸ಺ಗೂ ಉದ್ ಯಮಶೋಲತೆ ಯನ್ ನು ಉತೆ ತ ೋಜಿ ಸನವ ಅಗರಮ಺ನ್ ಯ ತ಺ಂತ್ರ ರಕ ಮತ್ ನತ ಆಡಳಿತ್ ವಿಜ್ಞ ಺ನ್

ಶಕ್ಷ ಣ ಕೆ ೋಂದ್ ರ಴಺ಗಿ ಗನರನತ್ರಸಿ ಕೆ ೂಳ್ ಳುವುದ್ ನ.

Mission/ ಧ್ ಯೇಯ

 To empower students with indispensable knowledge through dedicated teaching and

collaborative learning. ಸಮರ್ ಪಣ಺ ಮನೆ ೂೋಭ಺ವದ್ ಬೆ ೂೋಧನೆ ಸ಺ಗೂ ಸಹಭ಺ಗಿತ್ ವದ್ ಕಲಿ ಕ಺ಕರಮಗಳಿ ಂದ್ ವಿದ್ ಺ಯರ್ಥ ಪಗಳ್ನ್ ನು ಅತ್ ಯತ್ ೃಷಟ

ಜ್ಞ ಺ನ್ ಸಂರ್ನ್ ುರ಺ಗಿ ಸನವುದ್ ನ.

 To advance extensive research in science, engineering and management disciplines.

಴ೆ ೈಜ್ಞ ಺ನಿ ಕ, ತ಺ಂತ್ರ ರಕ ಸ಺ಗೂ ಆಡಳಿತ್ ವಿಜ್ಞ ಺ನ್ ವಿ ಭ಺ಗಗಳ್ಲಿಿ ವಿ ಸೃತ್ ಸಂವೆ ೋಧನೆ ಗಳೆ ೊಡನೆ ಬೆಳ್ ವಣಿ ಗೆ

 To facilitate entrepreneurial skills through effective institute - industry collaboration and

interaction with alumni.

ಉದ್ ಯಮ ಕ್ೆ ೋತ್ ಗಳೆ ೊಡನೆ ಸಹಯೋಗ, ಸಂಷೆೆ ಯ ಹಿರಿ ಯ ವಿದ್ ಺ಯರ್ಥ ಪಗಳೆ ೊಂದಿ ಗೆ ನಿ ರಂತ್ ರ ಸಂವಹನ್ ಗಳಿ ಂದ್

ವಿದ್ ಺ಯರ್ಥ ಪಗಳಿ ಗೆ ಉದ್ ಯಮಶೋಲತೆ ಯ ಕೌ ಶಲಯ ರ್ ಡೆ ಯಲನ ನೆ ರ಴಺ಗನವುದ್ ನ.

 To instill the need to uphold ethics in every aspect.

ಜಿ ೋವನ್ದ್ಲಿಿ ನೆ ೈತ್ರ ಕ ಮೌ ಲಯಗಳ್ನ್ ನು ಅಳ್ ವಡಿಸಿ ಕೆ ೂಳ್ ಳುವುದ್ ರ ಮಹತ್ ವದ್ ಕನರಿತ್ ನ ಅರಿ ವು ಮೂಡಿ ಸನವುದ್ ನ.

 To mould holistic individuals capable of contributing to the advancement of the society.

ಸಮ಺ಜದ್ ಬೆಳ್ ವಣಿ ಗೆ ಗೆ ಗಣನಿ ೋಯ ಕೆ ೂಡನಗೆ ನಿ ೋಡಬಲಿ ರ್ರಿರ್ ೂಣಪ ವಯಕ್ತ ತತ್ ವವುಳ್ ು ಸಮರ್ ಪ ನ಺ಗರಿ ೋಕರನ್ ನು

Maharaja Institute of Technology Mysore

Department of Computer Science & Engineering

Program Outcomes

  1. Engineering knowledge : Apply the knowledge of mathematics, science, engineering

fundamentals, and an engineering specialization to the solution of complex engineering

problems.

  1. Problem analysis : Identify, formulate, review research literature, and analyze complex

engineering problems reaching substantiated conclusions using first principles of

mathematics, natural sciences, and engineering sciences.

  1. Design/development of solutions : Design solutions for complex engineering problems and design system components or processes that meet the specified needs with appropriate

consideration for the public health and safety, and the cultural, societal, and environmental

considerations.

  1. Conduct investigations of complex problems : Use research-based knowledge and

research methods including design of experiments, analysis and interpretation of data, and

synthesis of the information to provide valid conclusions.

  1. Modern tool usage : Create, select, and apply appropriate techniques, resources, and modern engineering and IT tools including prediction and modeling to complex engineering

activities with an understanding of the limitations.

  1. The engineer and society : Apply reasoning informed by the contextual knowledge to

assess societal, health, safety, legal and cultural issues and the consequent responsibilities

relevant to the professional engineering practice.

  1. Environment and sustainability : Understand the impact of the professional engineering

solutions in societal and environmental contexts, and demonstrate the knowledge of, and need

for sustainable development.

  1. Ethics : Apply ethical principles and commit to professional ethics and responsibilities and

norms of the engineering practice.

  1. Individual and team work : Function effectively as an individual, and as a member or

leader in diverse teams, and in multidisciplinary settings.

  1. Communication : Communicate effectively on complex engineering activities with the

engineering community and with society at large, such as, being able to comprehend and

write effective reports and design documentation, make effective presentations, and give and receive clear instructions.

  1. Project management and finance : Demonstrate knowledge and understanding of the

engineering and management principles and apply these to one’s own work, as a member and

leader in a team, to manage projects and in multidisciplinary environments.

12. Life-long learning : Recognize the need for, and have the preparation and ability to

engage in independent and life-long learning in the broadest context of technological change.

Maharaja Institute of Technology Mysore

Department of Computer Science and Engineering

Course Overview

SUBJECT: DATA STRUCTURES LABORATORY SUBJECT CODE: 18CSL

In computer science, a data structure is a data organization, management, and storage format that enables efficient access and modification. Data structures are generally based on the ability of a computer to fetch and store data at any place in its memory, specified by a pointer-a bit string, representing a memory address, that can be itself stored in memory and manipulated by the program. Thus, the array and record data structures are based on computing the addresses of data items with arithmetic operations, while the linked data structures are based on storing addresses of data items within the structure itself. The implementation of a data structure usually requires writing a set of procedures that create and manipulate instances of that structure. The efficiency of a data structure cannot be analysed separately from those operations. This observation motivates the theoretical concept of an abstract data type, a data structure that is defined indirectly by the operations that may be performed on it, and the mathematical properties of those operations. Different types of data structures are suited to different kinds of applications, and some are highly specialized to specific tasks. For example, relational databases commonly use B- tree indexes for data retrieval, while compiler implementations usually use hash tables to look up identifiers. Data structures provide a means to manage large amounts of data efficiently for uses such as large databases and internet indexing services. Usually, efficient data structures are key to designing efficient algorithms. Some formal design methods and programming languages emphasize data structures, rather than algorithms, as the key organizing factor in software design. Data structures can be used to organize the storage and retrieval of information stored in both main memory and secondary memory.

Course Objectives

 Explain fundamentals of data structures and their applications essential for programming/problem solving.  Illustrate linear representation of data structures: Stack, Queues, Lists, Trees and Graphs.  Demonstrate sorting and searching algorithms.  Find suitable data structure during application development/Problem Solving.

Course Outcomes

CO’s DESCRIPTION OF THE OUTCOMES

18CSL38.1 (^) Apply the concept of data structure through ADT including Stacks, Queues, Lists.

18CSL38.2 (^) Implement appropriate sorting, searching and traversing technique for given problem.

18CSL38.3 (^) Implement a suitable solution for solving problems on non-linear data structure.

18CSL38.4 (^) Analyse the problems with respect to data structures and document the result in a required format.

a. Insert an Element on to Circular QUEUE b. Delete an Element from Circular QUEUE c. Demonstrate Overflow and Underflow situations on Circular QUEUE d. Display the status of Circular QUEUE e. Exit Support the program with appropriate functions for each of the above operations

  1. Design, Develop and Implement a menu driven Program in C for the following operations on Singly Linked List (SLL) of Student Data with the fields: USN, Name, Branch, Sem, PhNo a. Create a SLL of N Students Data by using front insertion. b. Display the status of SLL and count the number of nodes in it c. Perform Insertion / Deletion at End of SLL d. Perform Insertion / Deletion at Front of SLL(Demonstration of stack) e. Exit
  2. Design, Develop and Implement a menu driven Program in C for the following operations on Doubly Linked List (DLL) of Employee Data with the fields: SSN, Name, Dept, Designation, Sal, PhNo a. Create a DLL of N Employees Data by using end insertion. b. Display the status of DLL and count the number of nodes in it c. Perform Insertion and Deletion at End of DLL d. Perform Insertion and Deletion at Front of DLL e. Demonstrate how this DLL can be used as Double Ended Queue f. Exit
  3. Design, Develop and Implement a Program in C for the following operations on Singly Circular Linked List (SCLL) with header nodes a. Represent and Evaluate a Polynomial P(x,y,z) = 6x2y2z-4yz5+3x3yz+2xy5z- 2xyz b. Find the sum of two polynomials POLY1(x,y,z) and POLY2(x,y,z) and store the result in POLYSUM(x,y,z) Support the program with appropriate functions for each of the above operations
  4. Design, Develop and Implement a menu driven Program in C for the following operations on Binary Search Tree (BST) of Integers a. Create a BST of N Integers: 6, 9, 5, 2, 8, 15, 24, 14, 7, 8, 5, 2 b. Traverse the BST in Inorder, Preorder and Post Order c. Search the BST for a given element ( KEY ) and report the appropriate message e. Exit
  5. Design, Develop and Implement a Program in C for the following operations on Graph(G) of Cities a. Create a Graph of N cities using Adjacency Matrix. b. Print all the nodes reachable from a given starting node in a digraph using DFS/BFS method
  6. Given a File of N employee records with a set K of Keys(4-digit) which uniquely determine the records in file F. Assume that file F is maintained in memory by a Hash Table(HT) of m memory locations with L as the set of memory addresses (2- digit) of locations in HT. Let the keys in K and addresses in L are Integers. Design and develop a Program in C that uses Hash function H: K L as H( K )= K mod m (remainder method), and implement hashing technique to map a given key K to the address space L. Resolve the collision (if any) using linear probing.

Conduct of Practical Examination:

Experiment distribution o For laboratories having only one part: Students are allowed to pick one experiment from the lot with equal opportunity. o For laboratories having PART A and PART B: Students are allowed to pick one experiment from PART A and one experiment from PART B, with equal opportunity. Change of experiment is allowed only once and marks allotted for procedure to be made zero of the changed part only. Marks Distribution (Courseed to change in accoradance with university regulations) c) For laboratories having only one part – Procedure + Execution + Viva-Voce: 15+70+15 = 100 Marks d) For laboratories having PART A and PART B i. Part A – Procedure + Execution + Viva = 6 +28 + 6 = 40 Marks ii. Part B – Procedure + Execution + Viva = 9 + 42 + 9 = 60 Marks

Maharaja Institute of Technology Mysore

Department of Computer Science and Engineering

LABORATORY

General Lab Guidelines:

  • Conduct yourself in a responsible manner at all times in the laboratory. Intentional misconduct will lead to the exclusion from the lab.
  • Do not wander around, or distract other students, or interfere with the laboratory experiments of other students.
  • Read the handout and procedures before starting the experiments. Follow all written and verbal instructions carefully. If you do not understand the procedures, ask the instructor or teaching assistant.
  • Attendance in all the labs is mandatory, absence permitted only with prior permission from Class teacher.
  • The workplace has to be tidy before, during and after the experiment.
  • Do not eat food, drink beverages or chew gum in the laboratory.
  • Every student should know the location and operating procedures of all Safety equipment including First Aid Kit and Fire extinguisher.

DO’S:-

 Uniform and ID card are must.  Records have to be submitted every week for evaluation.  Sign the log book when you enter/leave the laboratory.  After the lab session, shut down the computers.  Keep your belongings in designated area.  Report any problem in system (if any) to the person in-charge.

DONT’S:-

 Do not insert metal objects such as clips, pins and needles into the computer casings(They may cause fire) and should not attempt to repair, open, tamper or interfere with any of the computer, printing, cabling, or other equipment in the laboratory.  Do not change the system settings and keyboard keys.  Do not upload, delete or alter any software/ system files on laboratory computers.  No additional material should be carried by the students during regular labs.  Do not open any irrelevant websites in labs.  Do not use a flash drive on lab computers without the consent of lab instructor.  Students are not allowed to work in Laboratory alone or without presence of the instructor/teaching assistant.

Maharaja Institute of Technology Mysore Department of Computer Science and Engineering

DATA STRUCTURES LABORATORY (18CSL38) Page 1

DATA STRUCTURES

Data Structures:

The logical or mathematical model of a particular organization of data is called data structures. Data structures is the study of logical relationship existing between individual data elements, the way the data is organized in the memory and the efficient way of storing, accessing and manipulating the data elements.

Choice of a particular data model depends on two considerations: it must be rich enough in structure to mirror the actual relationships of the data in the real world. On the other hand, the structure should be simple enough that one can effectively process the data when necessary.

Data Structures can be classified as: Primitive data structures Non-Primitive data structures.

Primitive data structures are the basic data structures that can be directly manipulated/operated by machine instructions. Some of these are character, integer, real, pointers etc.

Non-primitive data structures are derived from primitive data structures, they cannot be directly manipulated/operated by machine instructions, and these are group of homogeneous or heterogeneous data items. Some of these are Arrays, stacks, queues, trees, graphs etc.

Data structures are also classified as Linear data structures Non-Linear data structures.

In the Linear data structures processing of data items is possible in linear fashion, i.e., data can be processed one by one sequentially. Example of such data structures are: Array Linked list Stacks Queues A data structure in which insertion and deletion is not possible in a linear fashion is called as non linear data structure. i.e., which does not show the relationship of logical adjacency between the elements is called as non-linear data structure. Such as trees, graphs and files.

Data structure operations: The particular data structures that one chooses for a given situation depends largely on the frequency with which specific operations are performed. The following operations play major role in the processing of data. i) Traversing. ii) Searching. iii) Inserting. iv) Deleting.

v) Sorting. vi) Merging

STACKS:

A stack is an ordered collection of items into which new items may be inserted and from which items may be deleted at the same end, called the TOP of the stack. A stack is a non-primitive linear data structure. As all the insertion and deletion are done from the same end, the first element inserted into the stack is the last element deleted from the stack and the last element inserted into the stack is the first element to be deleted. Therefore, the stack is called Last-In First-Out (LIFO) data structure.

Maharaja Institute of Technology Mysore Department of Computer Science and Engineering

DATA STRUCTURES LABORATORY (18CSL38) Page 3

The nodes in the list can be accessed using a pointer variable. In the above fig. FIRST is the pointer having the address of the first node of the list, initially before creating the list, as list is empty. The FIRST will always be initialized to NULL in the beginning. Once the list is created, FIRST contains the address of the first node of the list. As each node is having only one link/next, the list is called single linked list and all the nodes are linked in one direction.

Each node can be accessed by the pointer pointing (holding the address) to that node, Say P is pointer to a particular node, then the information field of that node can be accessed using info(P) and the next field can be accessed using next(P). The arrows coming out of the next field in the fig. indicates that the address of the succeeding node is stored in that field. The link field of last node contains a special value known as NULL which is shown using a diagonal line pictorially. This NULL pointer is used to signal the end of a list.

The basic operations of linked lists are Insertion, Deletion and Display. A list is a dynamic data structure. The number of nodes on a list may vary dramatically as elements are inserted and deleted(removed). The dynamic nature of list may be contrasted with the static nature of an array, whose size remains constant. When an item has to inserted, we will have to create a node, which has to be got from the available free memory of the computer system, So we shall use a mechanism to find an unused node which makes it available to us. For this purpose we shall use the getnode operation (getnode() function).

The C language provides the built-in functions like malloc(), calloc(), realloc() and free(), which are stored in alloc.h or stdlib.h header files. To dynamically allocate and release the memory locations from/to the computer system.

TREES:

Definition: A data structure which is accessed beginning at the root node. Each node is either a leaf or an internal node. An internal node has one or more child nodes and is called the parent of its child nodes. All children of the same node are siblings. Contrary to a physical tree, the root is usually depicted at the top of the structure, and the leaves are depicted at the bottom. A tree can also be defined as a connected, acyclic di-graph.

Binary tree: A tree with utmost two children for each node. Complete binary tree: A binary tree in which every level, except possibly the deepest, is completely filled. At depth n, the height of the tree, all nodes must be as far left as possible. Binary search tree: A binary tree where every node’s left subtree has keys less than the node's key, and every right subtree has keys greater than the node's key. Tree traversal is a technique for processing the nodesof a tree in some order. The different tree traversal techniques are Pre-order, In-order and Post-order traversal. In Pre- order traversal, the tree node is visited first and the left subtree is traversed recursively and later right sub-tree is traversed recursively.

Graph:

Definition: A Graph G consists of two sets, V and E. V is a finite set of vertices. E is a set of edges or pair of vertices.

Two types of graphs, Undirected Graph Directed Graph

Maharaja Institute of Technology Mysore Department of Computer Science and Engineering

DATA STRUCTURES LABORATORY (18CSL38) Page 4

Undirected Graph: In undirected graph the pair of vertices representing any edge is unordered. Thus the pairs (u,v)and (v,u) represent the same edge.

Directed graph: In a directed graph each edge is represented by a directed pair <u,v>, u is the tail and v is the head of the edge. Therefore <v,u>and <u,v> represent two different edges.

Graph representation can be done using adjacency matrix.

Adjacency matrix: Adjacency matrix is a two dimensional n x n array a, with the property that a[i][j]=1 iff the edge (i,j) is in E(G). a[i][j]=0 if there is no such edge in G.

Connectivity of the graph: A graph is said to be connected iff for every pair of distinct vertices u and v , there is a path from u to v.

Path: A path from vertex u to v in a graph is a sequence of vertices u, i 1 , i 2 …… ik , v such that (u, i 1 ), (i 1 , i 2 ) ……… (ik , v) are the edges in G.

Graph traversal can be done in two ways: depth first search(dfs) and breadth first search (bfs).

Hashing: Hashing is a process of generating key or keys from a string of text using a mathematical function called hash function. Hashing is a key-to-address mapping process.

Hash Table: In hashing the dictionary pairs are stored in a table called hash table. Hash tables are partitioned into buckets, buckets consists of s slots , each slot is capable of holding one dictionary pair.

Hash function: A hash function maps a key into a bucket in the hash table. Most commonly used hash function is, h ( k ) = k % D where, k is the key D is Max size of hash table.

Collision Resolution: When we hash a new key to an address, collision may be created. There are several methods to handle collision, Open addressing, linked lists and buckets. In open addressing, several ways are listed, Linear probing, quadratic probe, pseudorandom, and key offset.

Linear Probing: In linear probing, when data cannot be stored at the home address,collision is resolved by adding 1 to the current address.

Maharaja Institute of Technology Mysore Department of Computer Science and Engineering

DATA STRUCTURES LABORATORY (18CSL38) Page 6

1. Design, Develop and Implement a menu driven program in c for the following Array operations, a. Creating an Array of N integer elements. b. Display of Array elements with suitable headings. c. Inserting an element (ele) at a given valid position(pos). d. Deleting an element at a given valid position (pos). e. Exit. Support the program with functions for each of the above operations.

#include<stdio.h> #include<conio.h> int n,a[50];

void create() { int i; printf("enter the value of n\n"); scanf("%d",&n); printf("enter %d array elements\n",n); for(i=0;i<n;i++) scanf("%d",&a[i]); }

void display() { int i; printf("entered elements are\n"); for(i=0;i<n;i++) printf("%d\n",a[i]); }

void insertion() { int i,POS,ELEM; printf("enter the position and its value\n"); scanf("%d%d",&POS,&ELEM); for(i=n;i>=POS;i--) a[i]=a[i-1]; a[POS]=ELEM; n=n+1; display(); }

void deletion() { int i,POS,ELEM; printf("enter the position to be deleted\n"); scanf("%d",&POS); ELEM=a[POS]; for(i=POS;i<=n-1;i++) a[i]=a[i+1]; printf("the deleated element is %d\n",ELEM); n=n-1; display(); }

void main() { int ch; while(1) {

Maharaja Institute of Technology Mysore Department of Computer Science and Engineering

DATA STRUCTURES LABORATORY (18CSL38) Page 7

printf("enter your choice\n"); printf("1.creat\n2.display\n3.insertion\n4.deletion\n5.exit\n"); scanf("%d",&ch); switch(ch) { case 1: create(); break; case 2: display(); break; case 3: insertion(); break; case 4: deletion(); break; case 5: exit(0); } } }

Maharaja Institute of Technology Mysore Department of Computer Science and Engineering

DATA STRUCTURES LABORATORY (18CSL38) Page 9

operations on STACK of integers(Array implementation of stack with maximum size MAX) a. Push an element onto the stack. b. Pop an element from the stack. c. Demonstrate how stack can be used to check palindrome. d. Demonstrate overflow and underflow situations on stack. e. Display the status of the stack. f. Exit Support the program with appropriate functions for each of the above operations.

#include<stdio.h> #include<conio.h> #include<math.h> #define max 5 int s[max],stop; int ele,st[max],sp,ch;

void push(int ele,int s[],int stop) { if(stop>=max-1) printf("stock overflow\n"); else s[++*stop]=ele; }

int pop(int s[],int top) { if(top==-1) { printf("stock empty\underflow\n"); return 0; } else return(s[(*top)--]); }

void palindrome(int ele,int st[]) { int rem,rev=0,temp=ele,i=0; while(temp!=0) { rem=temp%10;push(rem,st,&sp); temp=temp/10; } while(sp!=-1) rev=rev+(pop(st,&sp)*pow(10,i++)); if(ele==rev) printf("palendrome\n"); else printf("not a palindrome\n"); }

void display(int s[],int stop) { int i; if(stop==-1) printf("stalk is empty\n"); else for(i=*stop;i>-1;i--) printf("%d\n",s[i]);

Maharaja Institute of Technology Mysore Department of Computer Science and Engineering

DATA STRUCTURES LABORATORY (18CSL38) Page 10

}

void main() { stop= -1; sp= -1;

while(1) { printf("enter tne choice\n"); printf("enter 1 to insert an element into the STACK\n"); printf("enter 2 to delete an element from the STACK\n"); printf("enter 3 to check an element is palindrome or not\n"); printf("enter 4 to check the status of the STACK\n"); printf("enter 5 to exit\n"); scanf("%d",&ch); switch(ch) { case 1:printf("enter the elements to de inserted to STACK\n"); scanf("%d",&ele); push(ele,s,&stop); break; case 2:ele=pop(s,&stop); if(ele!=0) printf("element poped is %d\n",ele); break; case 3:printf("enter the elements to chech weather it is a palindrome\n"); scanf("%d",&ele); palindrome(ele,st); break; case 4:printf("the status of the STACK \n"); display(s,&stop); break; case 5:exit(0); } } }