In an ancient land, the beautiful princess Eve (or handsome prince Val) had many suitors. Being royalty, it was decided that a special process must be used to determine which suitor would win the hand of the prince/princess. First, all of the suitors would be lined up one 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 4 the suitor in the first position, she/he would then count three suitors down the line (because of the three letters in his/her name) and that suitor would be eliminated and removed from the line. The prince/princess would then continue, counting three more suitors, and eliminate every third suitor. When the end of the line is reached, counting would continue from the beginning. For example, if there were 6 suitors, the elimination process would proceed as follows:_____.
12456 Suitor 3 eliminated; continue counting from 4.
1245 Suitor 6 eliminated; continue counting from 1.
125 Suitor 4 eliminated; continue counting from 5.
15 Suitor 2 eliminated; continue counting from 5.
1 Suitor 5 eliminated; 1 is the lucky winner.
Write a program 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

Answer 1

Explanation:

public class CircularLinkedListTest  

{

private Node head;

private int size;

private class Node

{

 private int num;

 private Node next;

 public Node(int n)

 {

  num = n;

  next = null;

 }

 public int getNum()

 {

  return num;

 }

 public void setNext(Node n)

 {

  this.next = n;

 }

 public Node getNext()

 {

  return next;

 }

}

public CircularLinkedListTest ()

{

 head = null;

 int numNodes = 0;

}

public void add(int num)

{

 int numNodes = 0;

 if(head == null)

 {

  head = new Node(num);

  head.setNext(head);

  numNodes++;

 }

 else

 {

  Node temp = head;

  while(temp.getNext() != head)

   temp = temp.getNext();

   

  temp.setNext(new Node(num));

  temp.getNext().setNext(head);

  numNodes++;

   

 }

}

public int size()

{

 int numNodes = 0;

 return numNodes;

}

public int get(int index)

{

 Node t = head;

 for(int i = 0; i < index; i++)

  t= t.getNext();

 

 return t.getNum();

}

public int remove(int index)

{

 if(index < 0 || index >= size)

 {

  System.out.println("Error, index out of Qbounds.");

  System.exit(0);

 }

 Node temp = head;

 if(index == 0)

 {

  while(temp.getNext() != head)

   temp = temp.getNext();

  int value = head.getNum();

  if(size > 1)

  {

   head = head.getNext();

   temp.setNext(head);

  }

  else

   head = null;

   size--;

   

  return value;

 }

 else

 {

  for(int i = 0; i < index - 1; i++)

   temp = temp.getNext();

   

  int answer = temp.getNext().getNum();

  temp.setNext(temp.getNext().getNext());

  size--;

  return answer;

 }

}

public static void main(String args[])

{

 CircularLinkedListTest  suitors = new CircularLinkedListTest ();

 for(int i = 1; i <= 6; i++)

  suitors.add(i);  

 int currentIndex = 0;

 while(suitors.size() != 1)

 {

  for(int i = 1; i <= 2; i++)

  {

   currentIndex++;

   if(currentIndex == suitors.size())

    currentIndex = 0;

  }

   

  suitors.remove(currentIndex);

  if(currentIndex == suitors.size())

   currentIndex = 0;

   

  for(int i = 0; i < suitors.size(); i++)

   System.out.print(suitors.get(i) + " ");

  System.out.println();

 }

}

}


Related Questions

Write a program that prompts the user to enter two points (x1, y1) and (x2, y2) and displays their distance between them. The formula for computing the distance is: Square root of ((x2 - x1) squared + (y2 - y1) squared) Note that you can use pow(a, 0.5) to compute square root of a.

Answers

Answer:

x1 = input("enter x value of first number: ")

y1 = input("enter y value of first number: ")

x2 = input("enter x value of second number: ")

y2 = input("enter y value of second number: ")

ans = (float(x2)-float(x1))**2 + (float(y2)-float(y1))**2

ans = pow(ans, 0.5)

print(ans)

it is important organic mineral that is found in the soil as ash​

Answers

Answer:

Calcium is the most abundant element in wood ash and gives ash properties similar to agricultural lime. Ash is also a good source of potassium, phosphorus, and magnesium.

Huh this is very confusing

What are the disadvantages of using folders ​

Answers

Answer:

√ folders can cause some inconvenience situation...

√ The decompress / compress action takes time.

√ When you double-click on a file inside a “folder”, what really happens is the file gets extracted to a temporary folder.

heres one:

when you delete a folder, he stuff inside gets deleted, and there isnt a way to get it back.

How many components of a computer? ​

Answers

Answer:

There are five main hardware components in a computer system: Input, Processing, Storage, Output and Communication devices. Are devices used for entering data or instructions to the central processing unit.

Explanation:

3.5 code practice question 1

Answers

Answer:

what is this a question or just saying something?

Explanation:

Answer:

uh what?

Explanation:

It can be hard to get close enough to photograph animals in the wild true or false

Answers

Answer:

True

Explanation:

Answer:

true

Explanation:

// The QuickCopy company currently makes 100,000 copies per year// at 15 cents each.// They expect to increase the number of copies produced// by 4 percent per year each year for the next 10 years,// starting with this year.// They also expect the price of each copy to increase// by 3 cents per year, starting with this year.// This program displays the company's expected// income for each of the next 10 years.// Modify it to be more efficient.startDeclarationsnum year = 1num copies = 100000num price = 0.15num total = 0num COPIES_INCREASE = 0.04num PRICE_INCREASE = 0.03copies = copies + copies * COPIES_INCREASEprice = price + price * PRICE_INCREASEtotal = total + copies * priceoutput year, totalyear = year + 1copies = copies + copies * COPIES_INCREASEprice = price + price * PRICE_INCREASEtotal = total + copies * priceoutput year, totalyear = year + 1copies = copies + copies * COPIES_INCREASEprice = price + price * PRICE_INCREASEtotal = total + copies * priceoutput year, totalyear = year + 1copies = copies + copies * COPIES_INCREASEprice = price + price * PRICE_INCREASEtotal = total + copies * priceoutput year, totalyear = year + 1copies = copies + copies * COPIES_INCREASEprice = price + price * PRICE_INCREASEtotal = total + copies * priceoutput year, totalyear = year + 1copies = copies + copies * COPIES_INCREASEprice = price + price * PRICE_INCREASEtotal = total + copies * priceoutput year, totalyear = year + 1copies = copies + copies * COPIES_INCREASEprice = price + price * PRICE_INCREASEtotal = total + copies * priceoutput year, totalyear = year + 1copies = copies + copies * COPIES_INCREASEprice = price + price * PRICE_INCREASEtotal = total + copies * priceoutput year, totalyear = year + 1copies = copies + copies * COPIES_INCREASEprice = price + price * PRICE_INCREASEtotal = total + copies * priceoutput year, totalyear = year + 1copies = copies + copies * COPIES_INCREASEprice = price + price * PRICE_INCREASEtotal = total + copies * priceoutput year, totalstop

Answers

Answer:

See Explanation

Explanation:

Required

Modify the program

To modify the program, we simply make use of an iterative statement.

To do this, I'll make use of a do while loop.

So, we have:

Declarations

num year = 1

num copies = 100000

num price = 0.15

num total = 0

num COPIES_INCREASE = 0.04

num PRICE_INCREASE = 0.03

do:

copies = copies + copies * COPIES_INCREASE

price = price + price * PRICE_INCREASE

total = total + copies * price

output year, total

year = year + 1

while year<=10

The above do while loop enables the program to repeat the statements in the following block:

do:

----

---------

---

-

while year <=10

The loop calculates the copies & price in each year and also updates the values of the variables; so that they can be used for the nexr iteration

What Is an Antivirus?

Answers

Antivirus software, or anti-virus software, also known as anti-malware, is a computer program used to prevent, detect, and remove malware. Antivirus software was originally developed to detect and remove computer viruses, hence the name.

Answer:

Antivirus software is a type of program designed and developed to protect computers from malware like viruses, computer worms, spyware, botnets, rootkits, keyloggers and such. Antivirus programs function to scan, detect and remove viruses from your computer.

Explanation:

What is a Web server application?
A.An application that receives information, provided by an end user on a user-input form, from a Web server or a database server.
B.An application that is used to make Webpages interactive
C.An application that stores and processes the information provided by an end user on a user-input form
D.An application that authoritatively confirms the identity of a person, host or organization

Answers

Answer:

I prefer to go for the answer D

If a program has no syntax errors, can we assume that it is secure? Why or why not?

Answers

Answer:

We cannot say it is secure until it has gone through security testing.

Explanation:

Syntax errors are caused by errors that occur in the source code. Some of these errors are caused by spellings and punctuation. If the code does not follow the syntax of the programming language that it is being written, it would likely display a syntax error.

A program is secure only when it has gone through security testing and found to be protected from vulnerabilities and attacks.

An if statement must always begin with the word “if.” True False python

Answers

Answer:

true

Explanation:

The given statement is true, that an if statement must always begin with the word “if.” in python.

What is the python?

A high-level, all-purpose programming language is Python. Code readability is prioritized in its design philosophy, which makes heavy use of indentation. Python uses garbage collection and has dynamic typing.

It supports a variety of paradigms for programming, including functional, object-oriented, and structured programming. An “if” statement must always be the first word in a sentence.

One of the most often used conditional statements in computer languages is the if statement in Python. It determines whether or not particular statements must be performed. It verifies a specified condition; if it is true, the set of code included within the “if” block will be run; if not, it will not.

Therefore, it is true.

Learn more about the python, refer to:

https://brainly.com/question/18502436

#SPJ2

what do you mean by an ISP? why do we need a modem to access the internet? name any two Internet browsers​

Answers

Answer:

ISP means INTERNET SERVICE PROVIDER. These are organisations that provide internet to public.

Modems are needed to access the internet as they act like a server for us to get internet.

Internet browsers-

1. Goo.gle Chrom.e

2. Micro.soft Ed.ge

3. Fire.fox

A restaurant buys a pizza oven that is 4.5 feet long, 5 feet wide and 6 feet tall. What is the volume of the pizza oven?

Answers

Answer:

135 as 4.5 times 5 times 6 gives you the volume and it =135

After building muscle memory, what comes next when you are learning to type?
Speed
GWPM
Finger placement
Home row keys

Answers

Answer:

B

Explanation:

Its B because i had a test like dat  go it correct.

Hope this helps!

After building muscle memory, GWPM comes next when you are learning to type. Thus, option B is correct.

What are windows key?

The Starting keys are also known as the windows key. It was introduced in 1994 by the Microsoft Natural keyboard. The Numeric keypad is also known as number pad, Numpad, etc. This keypad has a 17-key palm segment of a standard computer keyboard, normally at the far right.    

The cursor is also known as Cursor control keys. These are buttons that push the cursor on a computer keyboard. That's why the answer to this question is "home row".

It is easy to add zero digit number here it will be we can club the two number or we can club two pair so as to form 10 in each of the pair

It will be (8+2) which gives 10

And (9+1) which gives 10

And it will very easy and fast to add 10 + 10

Rather than any other pair.

Therefore, After building muscle memory, GWPM comes next when you are learning to type. Thus, option B is correct.

Learn more about windows key on:

https://brainly.com/question/11884418

#SPJ2

why use a chart legend?

Answers

Answer:

A legend or key helps the user build the necessary associations to make sense of the chart.

Explanation:

Legends summarize the distinguishing visual properties such as colors or texture used in the visualization.

Write a program which asks the user for their name and age. The program should then print a sentence.

What is your name?
Cory
What is your age?
48
Cory is 48 years old.

Answers

Answer:

name = input("What is your name? ")

age = int(input("What is your age? "))

print("%s is %d years old."% (name, age))

Explanation:

This is a solution in python.

NO THIS ISNT ANY HOMEWORK!

Does anyone know a laptop under $200 that can run Minecraft Java edition and maybe 60fps?


PLEASE NAME A SPECIFIC ONE not to be rude but please don’t waste my time!



Sorry if I’m asking for too much we’re gonna travel soon and it’s gonna be for long months and I can’t bring my entire set up but I also don’t have much money and I can’t find any laptop like that so if you can help? Thank you!

Answers

Answer:

Name CPU, GPU & RAM My Rating (Out of 10)

HP Pavilion 15 Intel Core i7-8565U Nvidia MX 250 16GB 8.1

Asus VivoBook S15 Intel Core i5-8265U Nvidia MX250 8GB 7.8

Dell Inspiron 15 Intel Core i5-8250U Intel HD Graphics 16GB 7.6

Acer Aspire 5 Intel Core i5-8265U Nvidia MX250 8GB 7.5

Explanation:

I dont know the prices, I just searched it, though I will look into it more

Answer:

dont know the price but my mom bought me a macbook pro 13 inch and it works great !

Explanation:

edit: oop lol its like 1200 dollars

Give a regular expression for binary numbers. They can be integers or binary fractions. A leading - sign is always allowed. Leading 0's are not allowed except when the integer part is 0. When the binary points is present, then neither the integer part nor the fractional part are allowed to be empty. If the integer part has more than 3 bits, then grouping with commas is required. Examples: Allowed: -0 1,111,010 -1,111.00 Not allowed: .11 1000 The 4-letter alphabet consists of 0, 1, dot, and comma.

Answers

Solution :

We have to provide an expression for the binary numbers. There can be binary fractions or integers. Whenever there is leading 0, it is not allowed unless the integer part is a 0.

Thus the expression is :

[tex]$(-+ \in )$[/tex] [tex]$[(1+10+11+100+101+110+111)(,000+,001+,010+,011+,111+,100+,101+,110)^*$[/tex] [tex]$(\in +.(0+1)^*(0+1))+(0.(0+1)^*(0+1))]$[/tex]

In this exercise we have to have knowledge about binary code to calculate with these numbers, so we have:

[tex](E+(0+1)*(0+1))[/tex]

What is a binary code?

A binary code represents text, computer processor instructions, or any other data using a two-symbol system. The two-symbol system used is often "0" and "1" from the binary number system.

Knowing this now we can perform the calculations like:

[tex](1+10+11+100+101+110+111)(000+001+010+011+111+100+101+110)\\(E+(0+1)*(0+1))[/tex]

See more about binary code at brainly.com/question/7960132

Your goals as the IT architect and IT security specialist are to:  Develop solutions to the issues that the specified location of IDI is facing.  Develop plans to implement corporate-wide information access methods to ensure confidentiality, integrity, and availability.  Assess risks and vulnerabilities with operating IT facilities in the disparate locations where IDI now functions and develop mitigation plans and implementation methods.  Analyze the strengths and weaknesses in the current systems of IDI.  Address remote user and Web site user’s secure access requirements.  Develop a proposed budget for the project—consider hardware, software, upgrades/replacements, and consulting services.  Prepare detailed network and configuration diagrams outlining the proposed change to be able to present it to the management.  Develop and submit a comprehensive report addressing the learning objectives and your solutions to the issues within the scenario.  Prepare a 10- to 15-slide PowerPoint presentation that addresses important access control, infrastructure, and management aspects from each location.

Answers


Te chequen casa para ver en su mouse hombre de doble

Please help ASAP!
Combined with a set number of steps to determine size, what number of degrees would you use for turn degrees to command a sprite to trace a triangle with three equal sides?

A. 90, 90

B. 45, 45

C. 90, 180

D. 120, 120

Answers

Answer:

GIVE this man Brainliest!

Explanation:

1. Create an optimized function "print s(n,s)" that prints the given argument s (representing a string) k times. k represents the number of iterations of the inner loop. The print statement that prints s is in the inner loop of the function (a) Initial conditions: i = 1, j = 1, i <= n, and j <= i (b) i and j increments: i = i + 1 and j = j ∗ 2 (c) input as arguments in the function: n (an integer representing the size of the input), and s (the string) (d) output: print s k times (e) example: n=5, s="hello CSC510-01 class", given these conditions, the function "print s(n,s)" will print s 11 times

Answers

Answer:

The program in C is as follows:

void prints(char arr[], int n){

   int count =0;

   for(int i=1 ;i<=n; i++){

   for(int j=1;j<=i; j=j*2){

   count++;    }    }  

   for(int i =0;i<count;i++){

       printf("%s ",arr);

   }

}

Explanation:

This defines the method

void prints(char arr[], int n){

This declares and initializes count variable to 0

   int count =0;

This creates the outer loop

   for(int i=1 ;i<=n; i++){

This creates the inner loop

   for(int j=1;j<=i; j=j*2){

This increments count by 1

   count++;    }    }  

This iterates through count

   for(int i =0;i<count;i++){

And print the string in count times. If count is 3, the string will be printed 3 times.

       printf("%s ",arr);

   }

}

See attachment for complete program that includes the main method

what is invention and inovation do more responsible think for making computer a succsessful product?explain​

Answers

Answer:

I can't explain but I think it is the GUI

What are to be considered before software installation? Why?​

Answers

Answer:

before software installation we should consider the following things:

1. Software must be virus free

2.Required components for software should be installed

3.Computer requirements must be little bit high required for that software

4.software musn't be corrupt

Directions Interview your parent or any member of your family. Identity
v. Performance Tasks
sources of your family income. Classify the types of your family
income if it is Money Income, Real Oncome or Psychic income​

Answers

Answer:

Total family income is first classified by it's four major source, earings of a male head , earings of a wife or female head , earings of a family members , and property or transfer income.

Create a list called numbers containing the values from 1 through 15, then use slices to perform the following operations consecutively: a. Select number’s even integers. b. Replace the elements at indices 5 through 9 with 0s, then show the resulting list. c. Keep only the first five elements, then show the resulting list. d. Delete all the remaining elements by assigning to a slice. Show the resulting list.

Answers

Answer:

Kindly check explanation

Explanation:

From python :

List containing values from 1 through 15:

my_list = list(range(1,16))

#creates a list of values from 1 to 15,(16 is excluded)

B.) select even integers :

for digits in my_list :

if digit%2 == 0;

print(digit)

# prints numbers in the list which does not leave a remainder when divided by .

C.)

for digits in my_list[4,9]:

my_digit[digits] = 0

my_digits

#Replaces the elements at indices 5 through 9 with 0s, then show the resulting list.

D.)

my_digits[:5]

#selects digits with index 0 up to 4

E.)

del my_digits[:5]

#DELETE elements in my digits starting from the fifth index

What is the action take to the input called?

Answers

Answer:

Control types created with INPUT; Examples of forms containing INPUT controls ... The scope of the name attribute for a control within a FORM element is the FORM element. ... Applications should use the id attribute to identify elements. ... The program that will handle the completed and submitted form (the action attribute).

Explanation:

What was the Internet was built off ot?
A) IPv6
B) CIDR
C) NAT
D) IPv4

Answers

Answer:

The internet was built around IPv4.

write asswmbly prgram and do the following:
You have two numbers, the first one is 32 bits and the second is a 16 bits number. Find the result of division and store it in memory location called RESULT then store the reminder of division in memory location called MOD. (Use MACRO) ​

Answers

Answer:

I did this last year :/ i feel your pain.

Explanation:

Which function will display 6 as the output in the following formula?
C1*(C2+B1)
where C1 is 6, C2 is 2, and B1 is 4
_________

Answers

Answer:

36

Explanation:

hi add creeper_king101 i need views on snap

Answer: i just did the pretest and the answer was 36 no cap

Explanation:

3. Create tables CheckingAccount(CheckingAccountNumber, CustomerName, Balance, CustomerID), SavingsAccount(SavingsAccountNumber, CustomerName, Balance, InterestRate, CustomerID), Transactions(TransactionNumber, TransactionAmount, TransactionType, TransactionTime, TransactionDate, FromAccount, ToAccount, CustomerID). Use varchar(50) for any non-numerical value including AccountNumber and TransactionNumber, and float for any numerical value. CustomerID here means Username.

Answers

Answer:

Your answer is B

She forgot to record a transaction.

Explanation:

Edge 20 it’s right

Other Questions
Which U.S. president is most likely to have made this statement?"My idea of American policy toward the Soviet Union is simple. It is this: We win and they lose." What is the image of B(3,2)? The function of pure lines: ? 12=4-4xPLEASE HELPPP Question 5 and 7 please It is said that the brutality of football is necessary to satisfy the blood lust of the fans. Do you think that this is a valid reason for keeping the players' "heads in the game?" Many whales have tiny, unused hip and pelvis bones known as vestigial organs. How does this evidence support theories about animal evolution?O Vestigial organs show that whales evolved at the same time as other non-marine animalsO Vestigial organs show that whales may have evolved from a common ancestor shared with land-dwelling animalsO Vestigial organs show that many animals, including whales, evolved to have unused body partsO Vestigial organs show that marine animals, like whales, evolved much more slowly than land-dwelling animalsU ANSWER FAST I WILL MARK BRAINLIEST"what was it like growing up in Birmingham, Alabama for Wash?" PLEASE HELP this is French 2 btw Imagine that your family decides to have a foreign exchange student live with you for the school year. You want to show your visitor around New York City. In a paragraph, write about the places you would show her and why. Be sure you use at least 5-6 complete French sentences in your response. Thanks :) What is the simplified form of (2x + 3)(x - 5)? What Do You K2Things you know about the climatechange Convert 17/20 into a decimal form.Round any repeating decimals to two digits (hundredths)z help Find all y such that the distance between the points (8,10) and (4,y) is 20. 2. What is the significance of Rachel Carson's Silent Spring? how did the pandemic affect the import and export of products? what is 2(x+6)-6x in simplest form Ms. Rashida is selling the school bag below at a 20% discount. What is the selling price of the bag? the bag price is 115 A vertical beam of power intensity P (in Watts/m2 ) passes downward through a particular substance. The rate at which P decreases with respect to the thickness t (in meters) through which the beam has passed is proportional to P(t). The power intensity P at the top of the substance is 3,000 W/m2 . The power intensity P at a depth of 2.00 meters below the surface is 600 W/m2 . What is the power intensity P at a depth of 1.25 meters below the surface Angle 1 and angle 2 are supplementary. Angle 2 is vertical to a75 angle. What are the measures of angle 1 and angle 2? 6. Due to the moisture present in the room, theis not a recommended location for storing medication.A. bathroomB. bedroomOC. dining roomD. living room