Computer Science, asked by ak2170198, 6 months ago

Draw an algorithm to find a word computer in the dictionary

Answers

Answered by sonuchauhan8810
2

Answer:

helo guys its your answer

Explanation:

(1) So if the number of words in dictionary be n and no of words in the sentence be m this algorithm will take (2)I recently came across an algorithm design problem that I'd like some help with: Given some letters, for example a,e,o,g,z,k,l,j,w,n and a dictionary of ...

Answered by Anonymous
2

import java.util.*;

class SearchInsearch {

   public static void main(String[] args) {

       Hashtable<String, Integer> search = new Hashtable<String, Integer>();

       search.put("laptop", 1);

       search.put("amazon", 2);

       search.put("apple", 3);

       search.put("google", 4);

       search.put("windows", 5);

       search.put("mac", 6);

       search.put("games", 7);

       search.put("computer", 8);

       search.put("calculator", 9);

       search.put("java", 10);

       search.put("maths", 11);

       search.put("python", 12);

       search.put("c++", 13);

       System.out.print("Enter your search query in string only: ");

       Scanner getInput = new Scanner(System.in);

       String searchString = getInput.next();

       String strLower = searchString.toLowerCase();

       if (search.containsKey(strLower) == true) {

           System.out.println("Yes, we found " + searchString + " at index "+ search.get(strLower) + ".");

       } else {

           System.out.println("\r\nNo results found...\r\nTry another query...");

       }

       getInput.close();

   }

}

Similar questions