1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Musya8 [376]
2 years ago
14

You are a visitor at a political convention with delegates; each delegate is a member of exactly one political party. It is impo

ssible to tell which political party any delegate belongs to; in particular, you will be summarily ejected from the convention if you ask. However, you can determine whether any pair of delegates belong to the same party or not simply by introducing them to each other. Members of the same party always greet each other with smiles and friendly handshakes; members of different parties always greet each other with angry stares and insults.
Required:
Suppose more than half of the delegates belong to the same political party. Design a divide and conquer algorithm that identifies all member of this majority party and analyze the running time of your algorithm.
Computers and Technology
1 answer:
Fed [463]2 years ago
5 0

Answer:

The algorithm is as follows:

Step 1: Start

Step 2: Parties = [All delegates in the party]

Step 3: Lent = Count(Parties)

Step 4: Individual = 0

Step 5: Index = 1

Step 6: For I in Lent:

Step 6.1: If Parties[Individual] == Parties[I]:

Step 6.1.1: Index = Index + 1

Step 6.2: Else:

Step 6.2.1 If Index == 0:

Step 6.2.2: Individual = I

Step 6.2.3: Index = 1

Step 7: Else

Step 7.1: Index = Index - 1

Step 8: Print(Party[Individual])

Step 9: Stop

Explanation:

The algorithm begins here

Step 1: Start

This gets the political parties as a list

Step 2: Parties = [All delegates in the party]

This counts the number of delegates i.e. the length of the list

Step 3: Lent = Count(Parties)

This initializes the first individual you come in contact with, to delegate 0 [list index begins from 0]

Step 4: Individual = 0

The next person on the list is set to index 1

Step 5: Index = 1

This begins an iteration

Step 6: For I in Lent:

If Parties[Individual] greets, shakes or smile to Party[i]

Step 6.1: If Parties[Individual] == Parties[I]:

Then they belong to the same party. Increment count by 1

Step 6.1.1: Index = Index + 1

If otherwise

Step 6.2: Else:

This checks if the first person is still in check

Step 6.2.1 If Index == 0:

If yes, the iteration is shifted up

Step 6.2.2: Individual = I

Step 6.2.3: Index = 1

If the first person is not being checked

Step 7: Else

The index is reduced by 1

Step 7.1: Index = Index - 1

This prints the highest occurrence party

Step 8: Print(Party[Individual])

This ends the algorithm

Step 9: Stop

The algorithm, implemented in Python is added as an attachment

<em>Because there is an iteration which performs repetitive operation, the algorithm running time is: O(n) </em>

Download txt
You might be interested in
What is the organizational management practices on planning during a pandemic like corona virus.
eduard

Answer:

wear a mask use hand sanitizer dont get in contact with anyone between 6 feet

Explanation:

3 0
3 years ago
In a _____ network, each device on the network is attached to a central router. If the router fails, then the other devices will
Damm [24]

Answer:

In a STAR TOPOLOGY network, each device on the network is attached to a central router. If the router fails, then the other devices will be unable to communicate, but if only one connected device fails, then all other devices will still be able to communicate.

Explanation:

In this type of topology all the computers are connected to a single router through a cable. This router is the central node and all others nodes are connected to the central node.

7 0
2 years ago
Question 15 of 25
GaryK [48]
It gains purchasing power. Less money in circulation = more value.
5 0
2 years ago
The performance of a client-server system is strongly influenced by two major network characteristics: the bandwidth of the netw
Rama09 [41]

Answer:

A bandwidth is the maximum rate of transfer of data across a given path

Latency refers to the delay of data to travel or move between a source and destination

An example of a high bandwidth and high latency network is the Satellite Internet connectivity.

An example of a low bandwidth and latency network is the telephone system connection.

Explanation:

Solution

Bandwidth: Bandwidth determines how fast data can be transferred for example, how many bits/sec it can transport.

Latency: It refers to the delay or how long it takes for data to travel between it's source and destination.

An example of a high bandwidth and high latency network is the Satellite internet connection.

Satellite internet connection: This is responsible for the connectivity of several systems, it has a high bandwidth, since satellite are in space, due to distance it has a high latency.

So, satellite internet connection is compensated with high latency and high bandwidth.

An example of a low bandwidth and low latency network is the Telephony network.

Telephone/telephony internet connection: This connection does not have much data for transfer. it has low size audio files of which a low bandwidth range. also for both end or end users to understand and talk to each other, it has low latency.

3 0
3 years ago
In a java class, variables can be present both inside and outside of methods. question 9 options:
Tems11 [23]
The correct answer is: True

Explanation:

Consider the following program:
<span>class Main {
int a = 10;
public static void main(String[] args) {
add();
}

private static void add() {
int b = a+20;
System.out.println(b);
}<span>
}


The output of the above program is 30. As you can see the variable a is declared outside the method, whereas variable b is declared inside the method.</span></span>
3 0
3 years ago
Other questions:
  • Which statement describes the word "iterative"?
    7·2 answers
  • In this code, identify the repeated pattern and replace it with a function called month_days, that receives the name of the mont
    14·1 answer
  • In an inheritance situation, the new class that you create from an existing class is known as the:
    5·1 answer
  • What does PHP stand for?
    9·2 answers
  • I wonder how world is created
    12·2 answers
  • What is the name of the most expensive car and how much is it and what are its features
    15·1 answer
  • The question of ________ arises when considering the way in which online marketers gather consumers’ information over the Intern
    6·1 answer
  • As a student, how can you sustain focus and attention with technology distracting you from things that matter (academic, persona
    7·1 answer
  • Which three techniques are used in this photo
    12·1 answer
  • Select the correct technical term for each definition by using the drop-down menus.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!