Sunteți pe pagina 1din 13

INDEX

Data structures using “C”

S.No Date Program Description Page No


1 Program for stack Operation using C
2 Program for Queue Operation using C
3 Program for Bubble sort using C
4 Program for Quick Sort using C
5 Program for Binary search using C
6 Program for Linear search using C

Operating System (UNIX Lab)

S.No Date Program Description Page No


1 Program for Arithmetic Operation

2 Program for display Employee Details

3 Program for calculate the Electricity Bill

4 Program for File Manipulation

5 Program for Finding Biggest Number

6 Program for Fibonacci Series


C-Programe

Stack operation

Aim: write a program to implement stack operations using pointers.

Algorithm:
Step: 1 Start the program
Step: 2 Declare the variables
Step: 3 Create functions called push ( ), pop( ) and print stack ( ).
Step: 4 Get the choice like push, pop, view, and exit.
Step: 5 In the push function, get the range of the stack and read the values to the stack
range.
Step: 6 Push the values into the stack
Step: 7 In the case of print stack, the remaining items are displayed after push and pop
Step: 8 Save the programe
Step: 9 Stop the process.

Result: The programe has been successfully executed

Inference: From the above programe we came to know about the concept of stack
operation.
Queue Operation

Aim: Write a programe to create a queue and delete and element from queue

Algorithm:
Step: 1: Start the programe
Step: 2: Declare the variable and initialize front=0, rear=0 and get the range
Step: 3: Read the values for queue using the array q[10] by incrementing the rear values
until rear<n
Step: 4: Assign the address if q[] array to the pointer array ptr[] in a for loop
Step: 5: process the operation like add, delete, and list.

Step: 6: The process is performing sequentially


Step: 7: If the process is list the elements of the queue is displayed
Step: 8: If the process is add an elements at the queue

Result: The programe has been successfully executed

Inference: From the above program, we came to know about the concept of queue
operation.
Bubble sort

Aim: Write a programe to sort the given number using Bubble sort.

Algorithm:
Step: 1: Start the program
Step: 2: Declare the values for given range of value
Step: 3: Create a function called bubble sort
Step: 4: Get the range for the number, which is to be sorted
Step: 5: Read the values for the range
Step: 6: Call the bubble sort function
Step: 7: Display the sorted list in table
Step: 8: Repeat the process
Step: 9: Stop the process

Result: The programe has been successfully executed

Inference: From the above program, we came to know about the concept of Bubble sort
Quick sort

Aim: Write a program to sort the number using quick sort


Algorithm:
Step: 1: Start the program
Step: 2: Declare the values for given range of value
Step: 3: get the values for given range
Step: 4: call the function sort (i,n)
Step: 5: if m<n than align i=m, j=n+1 and k= num[m]

Step: 6: while (n[i] <=k) and (i<=n) increment value


Step: 7: if i<j inter change and values in the array
Step: 8: The sort function return the sorted array values
Step: 9: save the programme
Step:10: Save the programe

Result: The programe has been successfully executed

Inference: From the above program, we came to know about the concept of Quick
sorting.
Binary Search

Aim: write a program to create a program for searching an element in the binary tree

Algorithm:
Step: 1: Start the program
Step: 2: Declare the values for given range of value
Step: 3: Get the range
Step: 4: Read the values for the range
Step: 5: Get the item to be search

Step: 6: Compare the upper bound & lower bound and heck the
searching element
Step: 7: If the mid value is equal to the searching item than print the result as true
Step: 8: Save the programe
Step: 9: Stop the Programe

Result: The programe has been successfully executed

Inference: From the above program, we came to know about the concept of Binary
searching.
Linear Search

Aim: Write a programe to find and element in linear way

Algorithm:
Step: 1: Start the programe
Step: 2: Declare the variables
Step: 3: enter the elements in the array
Step: 4: The number to be searched for in entered key
Step: 5: The key is compared with each element in the arry and it found its position and
value is displayed on screen if not found, number in not found, message is
displayed on the screen.

Step: 6: Save the programe


Step: 7: Stop the process

Result: The programe has been successfully executed

Inference: From the above program, we came to know about the concept of Linear
searching.
Linux
Arithmetic Operation

Aim: Write a programme to performs the operations like addition, subtraction,


multiplication and division (arithmetic Operation)

Algorithm:
Step: 1: Start the programe
Step: 2: Read the value for performing the arithmetic operation
Step: 3: Read the operator as the input of our choice
Step: 4: In case statement depending upon the operator perform the arithmetic operation,
such as addition, subtraction, multiplication and division

Step: 5: Display the result

Step: 6: In case choice is not matching In valid operation will display


Step: 7: Stop the process

Result: The programe has been successfully executed

Inference: From the above program, we came to know about the concept of arithmetic
operation.
Employee Details

Aim: Write a shell program to display the employee

Algorithm:
Step: 1: Start the program
Step: 2: Read the basic details of the employee
Step: 3: Read the basic pay of the employee
Step: 4: By using (or) basic pay calculate the HRA,DA,PF, and IT
Step: 5: Display the employee details and also salary details like HRA,DA,PF, and IT
Step: 6: Stop the program

Result: The programe has been successfully executed

Inference: From the above program, we came to know about the concept of “Employee
details”
Electricity Bills

Aim: Write a programme to create the electric bill

Algorithm:
Step: 1: Start the program
Step: 2: Read the customer details
Step: 3: Read the previous and current reading
Step: 4: Calculate the units by subtracting the previous reading from current reading.
Step: 5: If the unit is less than 100 than charge is same as that of the unit consumed

Step: 6: If the unit is less than 200 than subtract 100 from the unit and sorted in unit
stream
Step: 7: Multiply the unit stream by 2nd and store in charge and add 100 to the charge
Step: 8: Display the customer details with the electricity bill
Step: 9: Stop the programe
Step:10: If the processes delete the specified element as deleted from the queue
Step: 11 Save the programe

Step: 12 Stop the process

Result: The programe has been successfully executed

Inference: From the above program, we came to know about the concept of Electricity
bill using Unix.
File Manupulation

Aim: Write a Unix programme to manipulate the file

Algorithm:
Step: 1: Start the programe
Step: 2: Open the vi editor with the new file name
Step: 3: Create a function addition to insert the contents
Step: 4: Create a function edit to edit a file
Step: 5: Create a function sort to get the contents of the file sorted

Step: 6: Create a function list to display the contents


Step: 7: Create a function calendar to display the date of particular month
Step: 8: Display the choices in a next format
Step: 9: Call the functions using the case statement
Step:10: Stop the program.

Result: The programe has been successfully executed

Inference: From the above program, we came to know about the concept of File
manipulation in Unix
Finding Biggest Number

Aim: Write a program to find the biggest of the given number

Algorithm:
Step: 1: Start the program
Step: 2: Enter the number which is to be final as the biggest one, among the declared
numbers.
Step: 3: Read the numbers a,b,c
Step: 4: compare the numbers a & b, if `a` is greater than b than compare a and c
Step: 5: Display a is the biggest number

Step: 6: If a is less than b, than b is compared with c


Step: 7: Display b is the biggest number
Step: 8: if b is less than c, then display c is the biggest process
Step: 9: stop the process

Result: The programe has been successfully executed

Inference: From the above program, we came to know about the concept of Finding
biggest number in Unix.
Fibonacci Series

Aim: To write a program Fibonacci series

Algorithm:
Step: 1: Start the program
Step: 2: Road the no. of the series, n
Step: 3: The Fibonacci series is calculated using the expression $a+$b; a=-1; b:1
Step: 4: The above step is repeated again and again until `n` value becomes zero
Step: 5: Display the Fibonacci series

Step: 6: Save the programe


Step: 7: Stop the programe.

Result: The programe has been successfully executed

Inference: From the above program, we came to know about the concept of Fibonacci
series in Unix.

S-ar putea să vă placă și