Question: could you please explain every line in the following code? does it run on O(n)? why? Presentation exercise 1 Write a method that, given two

Presentation exercise 1 Write a method that, given two Strings, checks whether one is a permutation of the other. You can assume that the two strings only contain letters of the English alphabet. Your method should not be case sensitive. If n is the number of characters in the strings, can you write a method that performs this task using a number of steps which can be represented by the function c*n+o, where both and a are constants? (i.e. can you write a method that runs in O(n) ?) Java code public class Presentationl{ public static void main(String[] args) System.out.println(permutation("Charles", "ArchLes")); System.out.println(permutation("df", "fY"); System.out.println(permutation("asdf", "fdsg")); System.out.println(permutation("JOHN", "OHNj")); System.out.println(permutation("wow", "woow")); 3 public static boolean permutation(String si, String s2) { if(s1.length() != s2.length() return false; int count[] = new int[26]; char ch; for(int i=0; i='a' && ch='A' && ch='a' && ch='A' && ch return true; )
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
