Lab Exercise Java -1
1.Read a string and print the words in Sorted order.
2.Insert a string at a particular position in another string
Example:Input:Model College string to insert:Engineering pos:5
Output:Model Engineering College
3.Remove Duplicates
Description: Given a string, remove the duplicate characters in it.Example: Input: "aabbcc"
Output: "abc"
4.Reverse Words in a String
Description: Given an input string s, reverse the order of the words.
Example: Input: "the sky is blue"
Output: "blue is sky the"
5.Find the largest digit in a number also print all its positions
Input:3586708
largest digit is 8 occurs at position 3,8
6.Convert the given decimal number into binary
Input;13
Output;1101
7.Find the mean,median and mode of set of data
8.Given two sorted arrays A and B with unique elements. create a new array C in sorted order by merging A and B
A=[5,8,9,10]
B=[3,6,7]
C=[3,5,6,7,8,9,10]
9.A saddle point in a matrix is an element that is the smallest in its row but the largest in its column
1 2 3
4 5 6
7 8 9
In this matrix, the element 7 is a saddle point.Find all the saddle points
Input:
1 2 3
4 5 6
7 8 9
Output:
7 4 1
8 5 2
9 6 3
Comments
Post a Comment