Contains solutions for all DS Lab Programs. This repository contains all you need for DS Lab of KTU Semester 3 The program description are given below and you can open the corresponding program from the repository.
- 1.Write a function rotate(int a[],int n,char d,int cr) to rotate given array elements.The function will take the array, number of elements in the array, direction of rotation(l-left r-right) and count of rotation( how many times to rotate)
- 2.Find the mean, median and mode of list of elements. Use array to implement the same.(assume Unimode )
- 3.Find the frequency of occurrence of each character in the string ( histogram)
- 4.Consider two sets S1={1,2,3,4}, and S2={3,4,5}. Find the intersection of S1 and S2={3,4}.Implement the set operation intersection using arrays.
- 5.An nx4 array stores 4 bit binary numbers. Read the matrix and print the hexadecimal equivalent of the same.
- 6.Write a program to read two polynomials and store them in an array. Calculate the sum of the two polynomials and display the first polynomial, second polynomial and the resultant polynomial.
- 7.Read and polynomial of degree n and store in an array. Evaluate this polynomial for a given value of x. Eg: 3x^2+2x+1 x=2 evaluation=12+4+1=17
- 8.Given a sparse matrix . Represent and store it using an efficient method. Also find the sparsity (The sparsity of a matrix can be quantified with a score, which is the number of zero values in the matrix divided by the total number of elements in the matrix.)
- 9.Input the representation of two sparse matrices. Obtain the representation of their sum.
- 10.Input the representation of a sparse matrix. Find the representation of its transpose.
- 11.Check whether the given matrix is sparse symmetric using the representation given.
- 12.Implement a stack using an array.
- 13.Implement multiple stacks(2 stacks) using an array. Consider memory efficient implementation
- 14.Find the minimum element in a stack in O(1) time using an auxiliary stack which keeps track of the minimum element.
- 15.implement a sorted push so that stack is always maintained in sorted order.
- 16.Convert a given decimal number into binary and hex using stack.
- 17.Check whether a string is palindrome using stack.
- 18.Check whether the parenthesis are balanced in an expression using stack.
- 19.Convert a given infix expression to postfixusing stack.
- 20.Convert a given infix expression to prefix using stack.
- 21.Evaluate a postfix expression.
- 22.Evaluate a prefix expression.
- 23.Create a linked list with n elements by adding elements at the end.
- 24.Given a node data, insert a new node after it.
- 25.Given a node data, insert a new node before it.
- 26.Insert a new node in the given position.
- 27.Delete a node, given the key data value.
- 28.Delete a node given the position.
- 29.Delete the smallest element from the list.
- 30.Reverse a list.
- 31.Search for a given element and print it's position.
- 32.Create a list in sorted order.
- 33.Implement a stack using singly linked list (this can be considered as a part of the previous assignment on stack).
- 34.Queue - Implement using array and Linked List.
- 35.Circlular Queue ( Ring Buffer)- Implement Using Array and Linked List.
- 37.Priority Queue -Implement Using Array or Linked List.
- 38.Double Ended Queue –Implement using linked list.