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) Solution
- 2.Find the mean, median and mode of list of elements. Use array to implement the same.(assume Unimode ) Solution
- 3.Find the frequency of occurrence of each character in the string ( histogram) Solution
- 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. Solution
- 5.An nx4 array stores 4 bit binary numbers. Read the matrix and print the hexadecimal equivalent of the same. Solution
- 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. Solution
- 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 Solution
- 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.) Solution
- 9.Input the representation of two sparse matrices. Obtain the representation of their sum. Solution
- 10.Input the representation of a sparse matrix. Find the representation of its transpose. Solution
- 11.Check whether the given matrix is sparse symmetric using the representation given. Solution
- 12.Implement a stack using an array. Solution
- 13.Implement multiple stacks(2 stacks) using an array. Consider memory efficient implementation. Solution
- 14.Find the minimum element in a stack in O(1) time using an auxiliary stack which keeps track of the minimum element. Solution
- 15.Implement a sorted push so that stack is always maintained in sorted order. Solution
- 16.Convert a given decimal number into binary and hex using stack. Solution
- 17.Check whether a string is palindrome using stack. Solution
- 18.Check whether the parenthesis are balanced in an expression using stack. Solution
- 19.Convert a given infix expression to postfixusing stack. Solution
- 20.Convert a given infix expression to prefix using stack. Solution
- 21.Evaluate a postfix expression. Solution
- 22.Evaluate a prefix expression. Solution
- 23.Create a linked list with n elements by adding elements at the end. Solution
- 24.Given a node data, insert a new node after it. Solution
- 25.Given a node data, insert a new node before it. Solution
- 26.Insert a new node in the given position. Solution
- 27.Delete a node, given the key data value. Solution
- 28.Delete a node given the position. Solution
- 29.Delete the smallest element from the list. Solution
- 30.Reverse a list. Solution
- 31.Search for a given element and print it's position. Solution
- 32.Create a list in sorted order. Solution
- 33.Implement a stack using singly linked list (this can be considered as a part of the previous assignment on stack). Solution
- 34.Queue - Implement using Array. Solution
- 35.Queue - Implement using Linked List. Solution
- 36.Circular Queue ( Ring Buffer)- Implement Using Array. Solution
- 37.Circular Queue ( Ring Buffer)- Implement Using Linked List. Solution
- 38.Priority Queue -Implement Using Array. Solution
- 39.Priority Queue -Implement Using Linked List. Solution
- 40.Double Ended Queue –Implement using linked list. Solution
- 41.Create a doubly linked list with n elements by adding elements at the end. Solution
- 42.Given a node data, insert a new node after it. Solution
- 43.Given a node data, insert a new node before it. Solution
- 44.Insert a new node in the given position. Solution
- 45.Delete a node, given the key data value. Solution
- 46.Delete a node given the position. Solution
- 47.Delete the smallest element from the list. Solution
- 48.Implement a circular linked list with provisions to insert and delete elements(singly/doubly) Solution
- 52.Create a binary search tree. Solution
- 53.Inorder,Preorder,Post Order. Solution
- 54.Level Order. Solution
- 55.Delete a specified node. Solution
- 56.Search for a given key element (print found/not found also print the number of comparisons made). Solution
- 57.Implement Linear Search. Solution
- 58.Implement Binary Search. Solution
- 59.Implement Bubble Sort. Solution
- 60.Implement Exchange Sort. Solution
- 61.Implement Selection Sort. Solution
- 62.Implement Insertion Sort. Solution
- 63.Merge two sorted Arrays. Solution
- 64.Implement Merge sort. Solution
- 65.Implement Quick sort. Solution
- 66.Implement Heap sort. Solution
- 67.Find the second largest element from a list. There may be more than one largest element. Solution
- 68.Find the duplicate element from a list. Also list the number of occurrence of each element. Solution
- 69.Find the mean, median, mode, and range of the list of values: ( if the list is not sorted sort the list first). Solution
- 70.Implement The Graph representation and BFS and DFS for Adjacency Matrix. Solution
- 71.Implement The Graph representation and BFS and DFS for Incident Matrix. Solution
- 72.Implement The Graph representation and BFS and DFS for Adjacency List. Solution
- 73.Enter a string and check if it’s palindrome using stack. Solution
- 74.Given a Linked List split the odd and even numbers into seperate Linked List. Solution
- 75.Write a C program to display 2 Queues and check if they're the same or different. Solution
- 76.Write a C program to reverse elements in a queue using stack.Use linked list implementation of queue.Display queue before and after reversing . Solution
- 77.Write a C program to display a double ended queue and display the largest number in dequeue. Solution
Made with ❤️ Jaison Dennis