C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN: 9781337102087
Author: D. S. Malik
Publisher: Cengage Learning
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Cluter
Write a program to implement the k-means algorithm .
• The input of the program should is a set of 150 observations of iris data.
• Each observation contains petal length, petal width, sepal length, sepal width and the type of iris
Requirements
• The program should be run your with k=3
• The output should be in a chart with rows and columns. It should give a number of each species of
iris in each cluster.
• The input of the program should is a set of 150 observations of iris data.
• Each observation contains petal length, petal width, sepal length, sepal width and the type of iris
Requirements
• The program should be run your with k=3
• The output should be in a chart with rows and columns. It should give a number of each species of
iris in each cluster.
SAVE
AI-Generated Solution
info
AI-generated content may present inaccurate or offensive content that does not represent bartleby’s views.
Unlock instant AI solutions
Tap the button
to generate a solution
to generate a solution
Click the button to generate
a solution
a solution
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Bus timetables specify to the second the exact arrival and departure time of each bus on each stop. You need to pay for the full fare of every bus you ride and different bus lines charge different fees , but they are flat fees (independent of distance travelled on the line) A travel plan is a sequence of stop-time pairs where stop is a location of a bus stop and time is when we arrive at that stop. The plan is feasible if for any two consecutive pairs (a, t) and (b, t′) in the plan there exists a bus that departs after t and arrives at b at exactly t′. That is, a travel plan does not allow us to walk between stops. Assuming that no two buses arrive at the same time at the same stop, a feasible plan uniquely identifies the bus lines that we need to take to realize the plan. The cost of the plan is the sum of the fares we need to pay. Your task is to design an efficient algorithm that given a departure time t, an arrival time t′, an origin stop a and a destination stop b, finds the…arrow_forward(Numerical) Write a program that tests the effectiveness of the rand() library function. Start by initializing 10 counters to 0, and then generate a large number of pseudorandom integers between 0 and 9. Each time a 0 occurs, increment the variable you have designated as the zero counter; when a 1 occurs, increment the counter variable that’s keeping count of the 1s that occur; and so on. Finally, display the number of 0s, 1s, 2s, and so on that occurred and the percentage of the time they occurred.arrow_forwardReview Loops Write a java program to ask three people three questions about name, number of courses, and number of credit hours. Also, print result in columns as below. Note: the input.nextInt() method reads only the integer value from input buffer.The "\n" is still staying in the input buffer. If you continue reading with input.nextLine(),you will receive the "\n" and CPU will not wait for any input. To fix this problem, you addthe statement input.nextLine() to flush out the "\n" from the input buffer.arrow_forward
- In Python Use the Design Recipe to write a function, print_histogram that consumes a list of numbers and prints a histogram graph using asterisks to represent each number in the list. Use one output line per number in the list. You may assume that only integers are passed to this function. Your function should ignore negative values. Include a docstring!arrow_forwardAssignment for Computer Architecture You are to write a program in MIPS that computes N! using a loop. Remember N! is the product of all the numbers from 1 to N inclusive, that is 1 x 2 x 3 x (N – 1) x N. It is defined as 1 for N = 0 and is undefined for values less than 0. The program first requests the user to input the value of N (display a prompt first so the user knows what to do). If the input value is less than 0, the program is to display “N! undefined for values less than 0” and request input again. If the value input is non-negative, it is to compute N! using a loop. You are to have your name, the assignment number, and a brief description of the program in comments at the top of your program. Since this is an assembly language program, I expect to see comments on almost every line of code in the program. Also make the code neat (line up the commands and comments in nice columns)arrow_forwardWord Statistics: The second requirement change is to allow replacement of all occurrences of a given word to a given replacemWrite the code only in python language with the opeartion exactly and necessary comments to be added.arrow_forward
- Please write me an python (We cannot have while true and break)arrow_forwardLongest String You are given S consisting of only 0 and 1 An integer X Input: The first line contains an integer T denoting the number of the test cases. For each test case , first line contains a string S. The secind line contains an integer X Output. For each test case print an integer number in a new line representing the legth of the longest subsequences of string S. Sample input: 1 111011100 100 Sample output: 7arrow_forwardThis is for r Regarding a for loop, which of the following is not true? The for keyword must be followed by parentheses. Following the for statement, the code to be executed is recognized by it being indented. The number of times the loop will be performed is determined by the length of the vector passed to the for keyword. The for loop can contain other for loops.arrow_forward
- Here is the assignment Write a program that prints the multiplication table but inserts a randomly generated incorrect value between 1 and 50 into a cell whose row and column are randomly selected. Make sure the program does insert an incorrect value. For example, if row and column of 3 and 4 are randomly selected, keep generating a random number to print for that location until it's not the right value of 12. Then, ask the user to tell where in the table the incorrect number is located by entering the row and column of the incorrect number. Print whether the user was right or not. If he or she was right, ask for and read the correct value; if not, the program must give the correct location and the correct number. My main issue: is how to set up the multiplication table? I've only learned the basics in C++ (loops and if statements).arrow_forwardThe program will take in a year as an input from the user and output the popular dance and popular slang from that decade. Years, slang, and dances are stored in parallel lists in the starter code. The decade 1920 is located at index 0 and accompanies the 1920’s slang and dance also located at index 0, the decade 1930 is located at index 1 and accompanies the 1930’s slang and dance also located at index 1, etc. Sample Input/Output: >> Year: 1934 In the 1930's, The Jitterbug was the hip dance craze! >> Year: 1989 In the 1980's, The Moonwalk was the gnarly dance craze! Assume the user enters a year between 1920 and 2022, inclusive. To find the decade, round the year down to the nearest decade.arrow_forwardUsing c++ Create this program in this given instructions. Using a random number generator, create a list of 500 integers. Perform a benchmark analysis using some of the sorting algorithms from this chapter. What is the difference in execution speed? Implement the bubble sort using simultaneous assignment. A bubble sort can be modified to “bubble” in both directions. The first pass moves “up” the list, and the second pass moves “down.” This alternating pattern continues until no more passes are necessary. Implement this variation and describe under what circumstances it might be appropriate.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr