Data Structures and Algorithms in Java
Data Structures and Algorithms in Java
6th Edition
ISBN: 9781118771334
Author: Michael T. Goodrich
Publisher: WILEY
bartleby

Concept explainers

Expert Solution & Answer
Book Icon
Chapter 4, Problem 36C

Explanation of Solution

Efficient algorithm to find ten largest numbers in an array:

//Create a class

public class Integers

{

The main() function stores number of integers in an array and then use the for loop to determine the first ten largest numbers in an array.

//Main function definition

public static void main (String[]args)

{

//Declare the array of integers

int[] x= new int[]{3,4,5,6,7,8,9,10,11,2,12,13,14,15,16};

//Execute the condition until the length is 9

if(x.length>9)

{

/*Execute the for loop until it ends with the array of integers*/

for(int i=1;i<x...

Explanation of Solution

Explanation:

  • Create a class and then declare the main() function.
  • Declare the required variable and assign the integer array with values.
  • Use if condition to execute until the length of array.
  • Use the outer for loop to execute until it includes all the elements in the array.
  • Use the inner for loop to determine the ten largest numbers in an array by swapping the values.
  • Then use for loop to print the ten largest numbers from an array.

Running time of algorithm:

In the above algorithm, it uses three for loop...

Blurred answer
Students have asked these similar questions
You are tasked with developing a portable system that can be worn to collect health and fitness data. The challenge is to integrate all functions into the smaller form of an ear clip. The device should include heart rate, movement and temperature sensor and wireless communication with a mobile app. Draw a diagram- hardware architecture of the system- including the selection of suitable sensors, communication modules, and an energy-efficient microcontroller. (visualize the components and their connections)
Draw out an example of 3 systems using Lamport’s logical clock and explain the steps in words.
"Systems have become very powerful and sophisticated, providing quality information fordecisions that enable the firm to coordinate both internally and externally."With reference to the above statement compare the operations of any three data gatheringsystems today’s organisations use to aid decision making.

Chapter 4 Solutions

Data Structures and Algorithms in Java

Chapter 4, Problem 11R Chapter 4, Problem 12R Chapter 4, Problem 13R Chapter 4, Problem 14R Chapter 4, Problem 15R Chapter 4, Problem 16R Chapter 4, Problem 17R Chapter 4, Problem 18R Chapter 4, Problem 19R Chapter 4, Problem 20R Chapter 4, Problem 21R Chapter 4, Problem 22R Chapter 4, Problem 23R Chapter 4, Problem 24R Chapter 4, Problem 25R Chapter 4, Problem 26R Chapter 4, Problem 27R Chapter 4, Problem 28R Chapter 4, Problem 29R Chapter 4, Problem 30R Chapter 4, Problem 31R Chapter 4, Problem 32R Chapter 4, Problem 33R Chapter 4, Problem 34R Chapter 4, Problem 35C Chapter 4, Problem 36C Chapter 4, Problem 37C Chapter 4, Problem 38C Chapter 4, Problem 39C Chapter 4, Problem 40C Chapter 4, Problem 41C Chapter 4, Problem 42C Chapter 4, Problem 43C Chapter 4, Problem 44C Chapter 4, Problem 45C Chapter 4, Problem 46C Chapter 4, Problem 47C Chapter 4, Problem 48C Chapter 4, Problem 49C Chapter 4, Problem 50C Chapter 4, Problem 51C Chapter 4, Problem 52C Chapter 4, Problem 53C Chapter 4, Problem 54C Chapter 4, Problem 55C Chapter 4, Problem 56C Chapter 4, Problem 57C Chapter 4, Problem 58C Chapter 4, Problem 59C Chapter 4, Problem 60P Chapter 4, Problem 61P Chapter 4, Problem 62P Chapter 4, Problem 63P
Knowledge Booster
Background pattern image
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
    SEE MORE QUESTIONS
    Recommended textbooks for you
    Text book image
    Programming Logic & Design Comprehensive
    Computer Science
    ISBN:9781337669405
    Author:FARRELL
    Publisher:Cengage
    Text book image
    C++ Programming: From Problem Analysis to Program...
    Computer Science
    ISBN:9781337102087
    Author:D. S. Malik
    Publisher:Cengage Learning
    Text book image
    Systems Architecture
    Computer Science
    ISBN:9781305080195
    Author:Stephen D. Burd
    Publisher:Cengage Learning
    Text book image
    Programming with Microsoft Visual Basic 2017
    Computer Science
    ISBN:9781337102124
    Author:Diane Zak
    Publisher:Cengage Learning
    Text book image
    EBK JAVA PROGRAMMING
    Computer Science
    ISBN:9781337671385
    Author:FARRELL
    Publisher:CENGAGE LEARNING - CONSIGNMENT
    Text book image
    Microsoft Visual C#
    Computer Science
    ISBN:9781337102100
    Author:Joyce, Farrell.
    Publisher:Cengage Learning,