Find Jobs
Hire Freelancers

Stack Algorithm

$30-50 USD

Closed
Posted almost 20 years ago

$30-50 USD

Paid on delivery
Suppose we are given a function f that maps some domain D into itself. Given an initial element x0 from D, define the infinite sequence x1=f(x0), x2=f(x1), etc. Our basic algorithm is as follows: Keep a stack of pairs (xi, i), where, at all times, both the i's and the xi's in the stack form strictly increasing sequences. The stack is initially empty. At each step j, pop from the stack all entries (xi, i) where xi>xj. If an xi=xj is found in the stack, we are done; then the cycle length is equal to j-i. Otherwise, push (xj, j) on top of the stack and continue. This algorithm always halts on the smallest value of the sequence's cycle xmin, on the second occurrence of this value: Once xmin is added to the stack the first time it appears, it is never removed. Therefore, the algorithm will halt when it encounters xmin for the second time. On the other hand, any other cycle value is greater than xmin, so it will be removed by xmin before it has a chance to appear again. Implement this Stack Algorithm using C++ ## Deliverables Include a makefile ## Platform Windows or UNIX
Project ID: 3241113

About the project

13 proposals
Remote project
Active 20 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
13 freelancers are bidding on average $24 USD for this job
User Avatar
See private message.
$4.25 USD in 1 day
5.0 (37 reviews)
5.6
5.6
User Avatar
See private message.
$34 USD in 1 day
4.9 (212 reviews)
5.8
5.8
User Avatar
See private message.
$17 USD in 1 day
5.0 (36 reviews)
5.5
5.5
User Avatar
See private message.
$34 USD in 1 day
5.0 (13 reviews)
2.7
2.7
User Avatar
See private message.
$42.50 USD in 1 day
5.0 (8 reviews)
2.4
2.4
User Avatar
See private message.
$17 USD in 1 day
5.0 (7 reviews)
2.3
2.3
User Avatar
See private message.
$6.80 USD in 1 day
0.0 (0 reviews)
0.0
0.0
User Avatar
See private message.
$42.50 USD in 1 day
0.0 (0 reviews)
0.0
0.0
User Avatar
See private message.
$34 USD in 1 day
0.0 (0 reviews)
0.0
0.0
User Avatar
See private message.
$42.50 USD in 1 day
0.0 (0 reviews)
0.0
0.0
User Avatar
See private message.
$6.35 USD in 1 day
0.0 (0 reviews)
0.0
0.0
User Avatar
See private message.
$12.75 USD in 1 day
0.0 (0 reviews)
0.0
0.0
User Avatar
See private message.
$12.75 USD in 1 day
0.0 (0 reviews)
0.0
0.0

About the client

Flag of UNITED STATES
Riverside, United States
0.0
0
Member since Jun 9, 2004

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.