Skip to content

lifeF/algorithoms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Algorithms

Basic algorithms in Computer Science mathamatics (Discrete Mathamatics)

1. Longest Increasing Sub-sequence in an Array
In Longest Increasing Subsequence (LIS) problem, find the length of the longest subsequence of a given sequence such that all elements of the subsequence are sorted in increasing order

    Ex: Input : arr[] = {3, 10, 2, 1, 20,4,56,78,90}
    Output : Length of LIS = 6
    The longest increasing subsequence is 3, 10, 20, 56, 78, 90

Usage :Replace Your array with arr array and run it, static int [] arr ={3, 10, 2, 1, 20,4,56,78,90};

2. Pancake Problem

Suppose you are given a stack of n pancakes of different sizes. You want to sort the pancakes so that smaller pancakes are on top of larger pancakes. The only operation you can perform is a flip — insert a spatula under the top k pancakes, for some integer k between 1 and n, and flip them all.

Releases

No releases published

Packages

No packages published

Languages