Starting from:

$25

DSA - Assignment 1  - Solved

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

 string length, string copy, string reverse, string concatenate 

2.       Three integer arrays are sorted. Find the common elements in the 3 arrays 

3.       For a given string and pattern, check if the pattern exists in the given string using: 

o        Brute Force

o        KMP

o        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. 

 

 

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

 

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

 

6.     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

7.     Using Binary Search find the count/frequency (how many times it occurs) of a particular element in an array.

8.     An array contains only 0s and 1s. Write a code to count the Sub arrays having equal no. of 0s and 1s  

 

More products