Active TopicsActive Topics  Display List of Forum MembersMemberlist  CalendarCalendar  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
 One Stop GATE ForumGATE Technical DiscussionsGATE CS
Message Icon Topic: Max-Min Searh Post Reply Post New Topic
Author Message
gita
Newbie
Newbie


Joined: 08Apr2007
Online Status: Offline
Posts: 19
Quote gita Replybullet Topic: Max-Min Searh
    Posted: 08Apr2007 at 10:33pm
4.2 Max-Min Search Max-Min search problem aims at finding the smallest as well as the biggest element in a vector A of n elements. Following the steps of Divide and Conquer the vector can be divided into sub-problem as shown below.  
 
 
   
 
       
 
               
 
                               
    The search has now reduced to comparison of 2 numbers. The time is spent in conquering and comparing which is the major step in the algorithm.   Algorithm: Max-Min (p, q, max, min) { If (p = q) Then max = a(p) min = a(q) Else If ( p – q-1) Then If a(p) > a(q) Then max = a(p) min = a(q) Else max = a(q) min = a(p) If End Else m ¬ (p+q)/2 max-min(p,m,max1,min1) max-min(m+1,q,max2,min2) max ¬ large(max1,max2) min ¬ small(min1,min2) If End If End Algorithm End. Illustration     Consider a data set with elements {82,36,49,91,12,14,06,76,92}. Initially the max and min variables have null values. In the first call, the list is broken into two equal halves.. The list is again broken down into two. This process is continued till the length of the list is either two or one. Then the maximum and minimum values are chosen from the smallest list and these values are returned to the preceding step where the length of the list is slightly big. This process is continued till the entire list is searched. The detail description is shown in fig 4.1
click here for more details:
http://www.vyomworld.com/gate/cs/ada/4.2.asp



Post Resume: Click here to Upload your Resume & Apply for Jobs

IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum

GET LATEST FRESHERS JOBS IN YOUR MAIL





This page was generated in 0.313 seconds.
Vyom is an ISO 9001:2000 Certified Organization

© Vyom Technosoft Pvt. Ltd. All Rights Reserved.

Job Interview Questions | Girls Magazine | DLL, OCX File Errors | Freshers Jobs | Placement Papers | More Papers