last ant on rod,, C/C++ Programming

Assignment Help:
There are ''''n'''' ants on a ''''n+1'''' length rod. The ants are numbered from 1 to n and are initially placed at positions starting from position 1 till position n. They are moving either in left direction (denoted by ''''-1'''') or in the right direction (denoted by ''''1''''). Whenever an ant crosses the boundary of the rod it falls off the rod. You are given the initial direction of the ants. Now, whenever two ants collide their direction switches, i.e. the ant going in left direction (''''-1) changes it''''s direction towards right (''''1'''') and the ant going in the right direction (''''1'''') changes it''''s direction towards left (''''-1''''). Find last ant to fall off the rod.

Related Discussions:- last ant on rod,

Console atm machine coding, construct a console programme for a bank ATM m...

construct a console programme for a bank ATM machine.

Pro, em Ipsum is that it has a more-or-less normal distribution of letters,...

em Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using ''Content here, content here'', making it look like readable English. Many desktop publis

Dynamic initialization of objects and dynamic constructor, Dynamic Initiali...

Dynamic Initialization of objects: It is initializing the objects by passing the valued to the constructor from the user input or other means.   Through cin operator a value

Z transformer, how to write code for z transformer

how to write code for z transformer

Decode the code, Smugglers are becoming very smart day by day. Now they hav...

Smugglers are becoming very smart day by day. Now they have developed a new technique of sending their messages from one smuggler to another. In their new technology, they are send

PEBBLE MERCHANT, C CODE FOR PEBBLE MERCHANTS PROBLEM

C CODE FOR PEBBLE MERCHANTS PROBLEM

Explain the macros, Explain the Macros? Preprocessor' is a translation ...

Explain the Macros? Preprocessor' is a translation stage that is applied to your source code before the compiler proper gets its hands on it. Usually the preprocessor performs

Build a standalone module to extract and parse, A skilled programmer is req...

A skilled programmer is required to build a standalone module to extract, parse and store in database tables, word count data from web pages and RSS feeds. The module will take

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd