[SOLVED] DSA - Assignment 1  

30.00 $

Category:

Description

5/5 - (3 votes)

Implement the following String functions w/o using any of the library functions in C

string length, string copy, string reverse, string concatenate

  1. Three integer arrays are sorted. Find the common elements in the 3 arrays
  2. For a given string and pattern, check if the pattern exists in the given string using:
    • Brute Force
    • KMP
    • Rabin Karp Algorithm

4 For a given set of flights, the arrival and departure times are provided in 2 arrays. Lets say there are 3 flights with arrival and departure times provided as per the arrays provided below:

 

int arr[] = { 100, 300, 500 };

int dep[] = { 900, 400, 600 };

Find the minimum number of runways required to land/depart for each flight.

 

 

  1. Use Counting Sort to  sort the elements/characters in the following array:

 

char arr[]={‘M’, ‘T’, ‘Y’, ‘S’, ‘A’, ‘P’};

 

  1. Assume that you are creating a Text editor. Like any other text editor, your editor must have a feature to find a particular set of characters/String. Write code to implement the same using Automata. Explain KMP and Rabin-Karp Algorithm
  2. Using Binary Search find the count/frequency (how many times it occurs) of a particular element in an array.
  3. An array contains only 0s and 1s. Write a code to count the Sub arrays having equal no. of 0s and 1s