Sharon Christine has Published 413 Articles

Naive Pattern Searching

Sharon Christine

Sharon Christine

Updated on 15-Jun-2020 18:34:58

6K+ Views

Naïve pattern searching is the simplest method among other pattern searching algorithms. It checks for all character of the main string to the pattern. This algorithm is helpful for smaller texts. It does not need any pre-processing phases. We can find substring by checking once for the string. It also ... Read More

Bad Character Heuristic

Sharon Christine

Sharon Christine

Updated on 15-Jun-2020 17:45:08

1K+ Views

The bad character heuristic method is one of the approaches of Boyer Moore Algorithm. Another approach is Good Suffix Heuristic. In this method we will try to find a bad character, that means a character of the main string, which is not matching with the pattern. When the mismatch has ... Read More

Efficient Construction of Finite Automata

Sharon Christine

Sharon Christine

Updated on 15-Jun-2020 17:31:15

1K+ Views

By constructing Finite Automata, we can simply perform the pattern searching in texts. At first, we have to fill a 2D array to make the transition table of the finite automata. Once the table is created, the searching procedure is simple. By starting from the first state of the automaton, ... Read More

Prim’s MST for Adjacency List Representation

Sharon Christine

Sharon Christine

Updated on 15-Jun-2020 17:13:06

2K+ Views

It is similar to the previous algorithm. Here the only difference is, the Graph G(V, E) is represented by an adjacency list.Time complexity adjacency list representation is O(E log V).Input and OutputInput: The cost matrix: Output: Edge: A--B And Cost: 1 Edge: B--E And Cost: 2 Edge: A--C And ... Read More

Aho-Corasick Algorithm

Sharon Christine

Sharon Christine

Updated on 15-Jun-2020 16:35:18

1K+ Views

This algorithm is helpful to find all occurrences of all given set of keywords. It is a kind of Dictionary-matching algorithm. It uses a tree structure using all keywords. After making the tree, it tries to convert the tree as an automaton to make the searching in linear time. There ... Read More

Efficient Huffman Coding for Sorted Input

Sharon Christine

Sharon Christine

Updated on 15-Jun-2020 16:08:20

685 Views

In the previous Huffman code problem, the frequency was not sorted. If the frequency list is given in sorted order, the task of assigning code is being more efficient.In this problem, we will use two empty queues. Then create a leaf node for each unique character and insert it into ... Read More

Minimum Number of Platforms Problem

Sharon Christine

Sharon Christine

Updated on 15-Jun-2020 15:48:57

814 Views

A list of arrival and departure time is given. Now the problem is to find the minimum number of platforms are required for the railway as no train waits.By sorting all timings in sorted order, we can find the solution easily, it will be easy to track when the train has ... Read More

Cycle Sort

Sharon Christine

Sharon Christine

Updated on 15-Jun-2020 15:43:42

915 Views

Cycle Sort is an in-place sorting algorithm. It is also a comparison based sort and efficient for any other in-place sorting technique. It finds the minimum number of memory write to perform the sorting tasks.The complexity of Cycle Sort TechniqueTime Complexity: O(n^2)Space Complexity: O(1)Input and OutputInput: A list of unsorted ... Read More

Pigeonhole Sort

Sharon Christine

Sharon Christine

Updated on 15-Jun-2020 15:31:17

1K+ Views

This is an example of the non-comparison sorting technique. It is used where the number of items and the range of possible key values is approximately the same.To perform this sort, we need to make some holes. The number of holes needed is decided by the range of numbers. In ... Read More

Multi-Dimensional Array in Javascript

Sharon Christine

Sharon Christine

Updated on 15-Jun-2020 14:37:44

716 Views

Basically, multi-dimension arrays are used if you want to put arrays inside an array. Let's take an example. Say you wanted to store every 6 hour's temperature for every weekday. You could do something like:let monday = [35, 28, 29, 31]; let tuesday = [33, 24, 25, 29]; //...This is ... Read More

Advertisements