BIG JAVA: LATE OBJECTS
BIG JAVA: LATE OBJECTS
2nd Edition
ISBN: 9781119626220
Author: Horstmann
Publisher: WILEY
Question
Book Icon
Chapter 14, Problem 6PP
Program Plan Intro

Radix sort

Program plan:

Filename: “Main.java”

  • Define “Main” class
    • Define the “getMax” method
      • Declare the variable and set the value.
      • Iterate “i” value until it reaches “n” to get the maximum number
        • Check array of “i” is greater than “mx”
          • Set the maximum value to the variable
      • Return the value
    • Define the “countSort” method
      • Declare the array variables
      • Fill the array with the values
      • Iterate the loop until it gets sorted
        • Calculate the count value
        • Iterate the “i” until it reaches “0”
          • Set the value
          • Decrement the count value
        • Iterate the “i” until it reaches “n”
          • Set the value
    • Define the “radixsort” method
      • Call the “getMax” method with the arguments
      • Iterate the “exp” until it reaches the condition
        • Call the “countSort” method with the arguments
    • Define the “print method
      • Iterate the “i” value until it reaches “n”
        • Display the array of values
    • Define main method
      • Declare the required variables
      • Create an object for “Random” class
      • Iterate the “i” value until it reaches “10”
        • Calculate the value and set into the array
      • Display the unsorted array
      • Display the sorted array by calling “print” method

Blurred answer

Chapter 14 Solutions

BIG JAVA: LATE OBJECTS

Knowledge Booster
Background pattern image
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education