Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Give 2 examples of a code optimization?

Answers were Sorted based on User's Feedback



Give 2 examples of a code optimization?..

Answer / mms zubeir

I would like to quote two things from the same area.

1. Read/Write chunks from/into a file instead of byte by
byte reading.

2. Aquire resources late and relieve it early. Example, if
you want to use a file, open the file as late as possible
and release it as early as possible after use.

Is This Answer Correct ?    12 Yes 1 No

Give 2 examples of a code optimization?..

Answer / maria

http://en.wikipedia.org/wiki/Modulo_operation

Is This Answer Correct ?    1 Yes 0 No

Give 2 examples of a code optimization?..

Answer / maria

1) For checking modulo use

num1&(num2-1)

instead:

num1%num2

2) For multiplying or dividing by 2 use left and right shift
accordingly.

3) In loop use, if code allows it, decrement,like this:
for(int i = MAX_VALUE ; i > 0 ; i--)
instead:
for(int i = 0 ; i < MAX_VALUE; i++)

Is This Answer Correct ?    7 Yes 7 No

Give 2 examples of a code optimization?..

Answer / sudheer

How this num1&(num2-1) replaces num1%num2. Execute and
check before posting some thing...

Is This Answer Correct ?    1 Yes 4 No

Post New Answer

More C++ General Interview Questions

What is the full form of stl in c++?

0 Answers  


what is the use of void main() in C++ language?

0 Answers  


Is it possible for a member function to use delete this?

0 Answers  


How do you import payscale data from non SAP to SAP?is it through LSMW or any other way is there?

0 Answers  


Difference between declaration and definition of a variable.

0 Answers  


Refer to a name of class or function that is defined within a namespace?

0 Answers  


What are the advantages of c++?

3 Answers  


What is c++ hiding?

0 Answers  


What is the Difference between "C structure" and "C++ structure"?

12 Answers  


Explain about Garbage Collector?

0 Answers  


Is java made in c++?

0 Answers  


Differentiate between an inspector and a mutator ?

0 Answers  


Categories