Alpha Geek

(8)

$10/per page/Negotiable

About Alpha Geek

Levels Tought:
University

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Environmental science,Essay writing,Programming,Social Science,Statistics Hide all
Teaching Since: Apr 2017
Last Sign in: 438 Weeks Ago, 1 Day Ago
Questions Answered: 9562
Tutorials Posted: 9559

Education

  • bachelor in business administration
    Polytechnic State University Sanluis
    Jan-2006 - Nov-2010

  • CPA
    Polytechnic State University
    Jan-2012 - Nov-2016

Experience

  • Professor
    Harvard Square Academy (HS2)
    Mar-2012 - Present

Category > Computer Science Posted 28 Apr 2017 My Price 5.00

The beautiful princess Eve had many suitors

The beautiful princess Eve had many suitors. She decided on the following procedure to determine which suitor she would marry. First, all of the suitors would be lined up on after the other and assigned numbers. The first suitor would be number 1, the second number 2, and so on up to the last suitor, number n. starting at the first suitor she would then count three suitors down the line (because of the three letters in her name) and the third suitor would be eliminated from winning her hand and removed from the line. Eve would then continue, counting three more suitors, and eliminating every third suitor. When she reached the end of the line she would continue counting from the beginning.

For example, if there were six suitors then the elimination process would proceed as follows:

123456                  initial list of suitors, start counting from 1

12456                    suitor 3 eliminated, continue counting from 4

1245                       suitor 6 eliminated, continue counting 1

125                         suitor 4 eliminated, continue from 5

15                           suitor 2 eliminated, continue from 5

1                              suitor 5 eliminated, 1 is the lucky winner.

Write a program in C++ that creates a circular linked list of nodes to determine which position you should stand in to marry the princess if there are n suitors. Your program should simulate the elimination process by deleting the node that corresponds to the suitor that is eliminated for each step in the process.

Answers

(8)
Status NEW Posted 28 Apr 2017 03:04 PM My Price 5.00

-----------

Attachments

file 1493395189-Answer.docx preview (75 words )
#-----------inc-----------lud-----------e&a-----------mp;-----------lt;-----------ios-----------tre-----------am&-----------amp-----------;gt-----------; -----------usi-----------ng -----------nam-----------esp-----------ace----------- st-----------d; ----------- st-----------ruc-----------t S-----------uit-----------s -----------{ -----------str-----------uct----------- Su-----------its----------- *n-----------ext-----------; -----------str-----------uct----------- Su-----------its----------- *p-----------rev-----------; -----------int----------- id-----------; -----------}; ----------- in-----------t m-----------ain-----------() ----------- { ----------- in-----------t n-----------; -----------cou-----------t&a-----------mp;-----------lt;-----------&am-----------p;l-----------t;&-----------quo-----------t;E-----------nte-----------r t-----------he -----------num-----------ber----------- of----------- su-----------ito-----------rs -----------&qu-----------ot;-----------; -----------cin-----------&am-----------p;g-----------t;&-----------amp-----------;gt-----------;n;----------- S-----------uit-----------s s-----------uit-----------; -----------Sui-----------ts -----------*te-----------mp -----------= &-----------amp-----------;am-----------p;s-----------uit-----------; -----------Sui-----------ts -----------*te-----------mp1-----------; -----------for-----------(in-----------t i-----------=0;-----------i&a-----------mp;-----------lt;-----------n;+-----------+i)----------- {----------- i-----------f(i-----------==n------------1)----------- {----------- t-----------emp------------&a-----------mp;-----------gt;-----------id=-----------i+1-----------; -----------tem-----------p-&-----------amp-----------;gt-----------;ne-----------xt=-----------&am-----------p;a-----------mp;-----------sui-----------t; ----------- te-----------mp1----------- = -----------&am-----------p;a-----------mp;-----------sui-----------t; ----------- te-----------mp1------------&a-----------mp;-----------gt;-----------pre-----------v
Not Rated(0)