1 Replies - 2470 Views - Last Post: 26 February 2011 - 03:17 AM Rate Topic: -----

#1 bakizzy  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 16
  • Joined: 25-February 10

control flow graph

Posted 26 February 2011 - 02:56 AM

i want to draw the control flow graph for the following binary search procedure and annotate the graph with the predicates in the program. i kindly ask you for assistance. below is the code that i want to draw the control flow graph for:
int BSearch (List, Elem, LEN)
3.	        int LEN, List [LEN], Elem;
4.	        {
5.	           int high, low, mid;
6.	        
7.	           low  = 1;
8.	           high = LEN-1;
9.	           mid  = (low + high) / 2;
10.	           while (Elem != List[mid])
11.	           {
12.	              mid = (low + high) / 2;
13.	              if (high < low)
14.	                 return (FALSE);
15.	              else if (Elem == List[mid])
16.	                 return (TRUE);
17.	              else if (Elem > List[mid])
18.	                 low = mid + 1;
19.	              else
20.	                 high = mid - 1;
21.	           }
22.	           return (TRUE);
23.	        }



MOD EDIT: When posting code...USE CODE TAGS!!!

:code:

I'll move this to Other Languages, seeing as I'm not sure what language this is.

This post has been edited by JackOfAllTrades: 27 February 2011 - 02:31 PM


Is This A Good Question/Topic? 0
  • +

Replies To: control flow graph

#2 janotte  Icon User is offline

  • code > sword
  • member icon

Reputation: 990
  • View blog
  • Posts: 5,141
  • Joined: 28-September 06

Re: control flow graph

Posted 26 February 2011 - 03:17 AM

Wrong forum.
No code tags.
No demonstration of effort to do the task yourself.
You are almost ticking all the boxes to get ignored but I'll be kind.

The Mods will move this to the right forum. Nothing to do there.

You can fix the missing code tags like this:Please edit your posting (see the "EDIT" button in lower right). (If Edit is not available make a new posting on this thread and skip ( a ) below.)
( a ) Delete all your code.
( b ) Get a fresh copy of the code with formatting in place from your editor / IDE.
( c ) Paste the formatted code between code tags like this :code:
Read here for more help with the code tags
http://www.dreaminco...-code-tags-are/
( d ) Use the "Preview Post" button to check it's all good.
( e ) Use the "Submit Modified Post" button to finish the editing.

Most important.
Show us the work you have already done and explain the problems you are having completing it.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1