From 4d9d7e23eb5de05605448dd869bdf4ac778b5670 Mon Sep 17 00:00:00 2001 From: psthejohn <36690315+psthejohn@users.noreply.github.com> Date: Sat, 25 Mar 2023 08:54:45 +0530 Subject: [PATCH] optimizing the maximum of 3 numbers --- schedule.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/schedule.cpp b/schedule.cpp index 9cda553..f29386f 100644 --- a/schedule.cpp +++ b/schedule.cpp @@ -55,13 +55,11 @@ void get_process_info(int selected_algo){ //get maximum of three numbers int max(int a,int b, int c){ - long max,lcom, count, flag=0; + long max=c,lcom, count, flag=0; if( a>=b && a>=c) return max=a; - else if(b >=a && b>=c) + else if(b>c) return max=b; - else if(c>=a && c>=b) - return max=c; } //calculating the observation time for scheduling timeline