Algorithm For Professional Programmer

Monday, June 19, 2017

Finding the maximum and minimum number

Algorithm StraightMaxMin(a n, max, min)

//Set max to the maximum and min to the minimum of a[1:n].
{
max = min = a[1];
for i:=2 to n do
{
if(max<a[i] then max:=a[i]);
if(min>a[i] then min:=a[i]);
}
}

Posted by Unknown at 1:52 AM
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

Blog Archive

  • ▼  2017 (21)
    • ▼  June (21)
      • What is the Idea of Developing a DP Algorithm?
      • What is 0-1 Knapsack Problem?
      • What is the 8-Queens Problem
      • Algorithm NQueen(k,n)
      • What is Implicit Constraints?
      • What is Explicit Constraints?
      • What is the Formulation of the backtracking?
      • Two Different ways of tree generation
      • Merge Sort Algorithm
      • Finding the maximum and minimum number
      • Algorithm BinSearch(a,n,x)
      • Algorithm for recursive binary search
      • What is Branch and Bound?
      • What is Backtracking?
      • What is Bounding Function?
      • What is E-node?
      • What is A Dead Node?
      • What is Live Node?
      • Difference between backtracking & Branch and Bound
      • SumOfSub(s,k,r)
      • Sum of Subsets
  • ►  2016 (2)
    • ►  March (2)
Awesome Inc. theme. Powered by Blogger.