GithubHelp home page GithubHelp logo

jaison080 / ds_lab Goto Github PK

View Code? Open in Web Editor NEW
7.0 1.0 6.0 2.42 MB

Contains solutions for all DS Lab Programs.

Home Page: https://jaison080.github.io/ds_lab

C 100.00%
mec modelengineeringcollege dslab ds dsktu mecthrikkakara s3 c datastructures datastructureslab

ds_lab's Introduction

Data Structures Lab(2019 Scheme)

DS LAB

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.


CYCLE 1

  • 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

CYCLE 2

  • 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

CYCLE 3

  • 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

CYCLE 4

  • 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

CYCLE 5

  • 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

CYCLE 6

Implement the following using doubly linked list:

  • 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

Represent polynomials using linked list


CYCLE 7

Build a Binary Search Tree and Implement all the operations and Traversals

  • 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

CYCLE 8

  • 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

CYCLE 9

  • 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

Answer the queries like degree of a vertex. List of vertices adjacent to a vertex. Etc..


EXTERNAL EXAM

  • 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

ds_lab's People

Contributors

jaison080 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.