Suffix Array

Sharon Christine
Updated on 15-Jun-2020 19:15:53

884 Views

From a given string, we can get all possible suffixes. After sorting the suffixes in lexicographical order, we can get the suffix array. Suffix arrays can also be formed using suffix trees. By using the DFS traversal of suffix trees, we can get suffix arrays. Suffix arrays are helpful to find suffixes in linear time. We can also find substrings using suffix array by using binary search type procedure.The time complexity is O(m log n)Input and OutputInput: Main String: “BANANA”, Pattern: “NAN” Output: Pattern found at position: 2AlgorithmfillSuffixArray (text, suffArray)Input: The main stringOutput: The array of suffixesBegin    n := text Length ... Read More

Align Flex Item at the Baseline in Bootstrap 4

Amit Diwan
Updated on 15-Jun-2020 19:13:04

117 Views

Use the .align-self-*-start class to align a flex item at the baseline on different screens in Bootstrap 4.On different screen sizes, set the baseline as −Small Screen   A-one   B-one   C-one   D-one Medium Screen   A-one   B-one   C-one   D-one Large Screen   A-one   B-one   C-one   D-one You can try to run the following code to implement the align-self-*-start class −ExampleLive Demo       Bootstrap Example                         Align Specific Flex Item at the baseline       A-one     B-one     C-one     D-one     Small Screen Size       A-one     B-one     C-one     D-one     Medium Screen Size       A-one     B-one     C-one     D-one     Large Screen Size         A-one     B-one     C-one     D-one  

Trie of All Suffixes

karthikeya Boyini
Updated on 15-Jun-2020 19:10:41

526 Views

From the text, we can generate all suffixes to make a tree structure. We know that every pattern that presents in the text, must be a prefix of one of the possible suffix in the text. By building Trie of all suffixes, we can find any substring in linear time. Every suffix is ending with string terminating symbol. From each node if there is any path, it moves forward, otherwise returns that pattern is not found.For this algorithm, the time complexity is O(m+k), where the m is the length of string and k is the frequency of the pattern in ... Read More

Align Rows of Items from the Start in Bootstrap 4

Amit Diwan
Updated on 15-Jun-2020 19:06:14

124 Views

Use the .align-items-*-start class in Bootstrap 4 to align single rows of items from the start on different screens.For different screen size, use the class as −Align Single Rows of Items on Small Screen   Product 1   Product 2   Product 3   Product 4 Align Single Rows of Items on Medium Screen   Product 1   Product 2   Product 3   Product 4 Align Single Rows of Items on Large Screen   Product 1   Product 2   Product 3   Product 4 The following is an example to align single rows of items from the ... Read More

Hidden BS Modal Bootstrap Event

David Meador
Updated on 15-Jun-2020 19:02:53

4K+ Views

The hidden.bs.modal event in Bootstrap fires when the modal is completely hidden.Hide the modal on button click −$("#button1").click(function(){   $("#newModal").modal("hide"); });After you will hide it, use the hidden.bs.modal Bootstrap event to generate an alert before the modal completely hides −$("#newModal").on('hidden.bs.modal', function () {   alert('The modal is completely hidden now!'); });You can try to run the following code to implement the hidden.bs.modal event −ExampleLive Demo       Bootstrap Example                              #button1 {       width: 140px;   ... Read More

Kasai's Algorithm

karthikeya Boyini
Updated on 15-Jun-2020 19:00:01

689 Views

Kasai’s Algorithm is used to get the Longest Common Prefix (LCP) array from suffix array. At first suffix arrays are found. After that Kasai's algorithm takes the suffix array list to find LCP.For the LCP array, it takes O(m log n), where m is pattern length and n is the length of the text. The Kasai’s Algorithm, it takes O(n) for searching the pattern in the main string.Input and OutputInput: Main String: “banana” Output: Suffix Array : 5 3 1 0 4 2 Common Prefix Array : 1 3 0 0 2 0AlgorithmbuildSuffixArray(text)Input: The main stringOutput: The suffix array, built ... Read More

Display Flex Items Vertically on Different Screen Sizes in Bootstrap 4

David Meador
Updated on 15-Jun-2020 18:56:33

1K+ Views

To show flex items vertically on different screen sizes, use the flex-*- column class. For small, medium and large screen sizes, use it as −For Small screen size −For Medium screen size −For Large screen size −Let us see an example to learn how to set flex items vertically on different screen sizes −ExampleLive Demo       Bootstrap Example                             Example     Note: Change the browser size to see the effect.     Default           One       Two       Three         Flex on differet screen size (Medium)           One       Two       Three         Flex on differet screen size (Large)           One       Two       Three    

Activate Content as a Bootstrap Modal

David Meador
Updated on 15-Jun-2020 18:52:21

540 Views

If you want to set content as a Bootstrap modal, then use the .modal(options) method.On button click, the modal generates as in the following script.$(document).ready(function(){   $("#button1").click(function(){     $("#newModal1").modal({backdrop: true});   }); });Above, I have set options as “backdrop:true”. Another option, we can set is “backdrop: true” −backdrop: true =  Clicking outside the modal, close it.backdrop: false = Clicking outside the modal, won’t close it.You can try to run the following code to implement the modal(“options”) class −ExampleLive Demo       Bootstrap Example                     ... Read More

Hide Bootstrap Modal

Amit Diwan
Updated on 15-Jun-2020 18:46:03

2K+ Views

The .modal(“hide”) method hides the modal on button click.Firstly, generate the modal and display it −$("#newModal").modal("show");After that, use the modal(“hide”) method on a button to hide the modal on button click −$("#button1").click(function(){   $("#newModal").modal("hide"); });Let us see an example of the modal(‘hide”) method wherein we are hiding a modal which generates on page load −ExampleLive Demo       Bootstrap Example                             #button1 {       width: 140px;       padding: 20px;       bottom: 150px; ... Read More

Align Rows of Items at the Baseline in Bootstrap 4

Amit Diwan
Updated on 15-Jun-2020 18:43:33

203 Views

Align single rows of items at the baseline in Bootstrap 4, use the .align-items-baseline class.To align at the baseline:

Advertisements