Introduction to Algorithms
Introduction to Algorithms
3rd Edition
ISBN: 9780262033848
Author: Thomas H. Cormen, Ronald L. Rivest, Charles E. Leiserson, Clifford Stein
Publisher: MIT Press
Question
100%
Book Icon
Chapter 1, Problem 1P
Program Plan Intro

To complete the table for given function f(n) and time t .

Expert Solution & Answer
Check Mark

Explanation of Solution

Given Information:The time taken by algorithm to solve the problems in f(n) microseconds.

Explanation:

Since 1 microsecond is equal to 106 seconds. Therefore, 1 second is equal to 106 microseconds.

Consider the function f(n)=lg(n) . Now, determine the value of n such that lgn<106

as follows:

lgn<1062lgn<2 106n<2 106

Therefore, the value of n is 2106 for 1 second.

Since 1 hour is equal to 3600 seconds. Therefore, 1 hour is equal to 3.6×109 microseconds.

Again, consider the function f(n)=lg(n) . Now, determine the value of n such that lgn<3.6×109

as follows:

lgn<3.6×1092lgn<23.6× 109n<23.6× 109

Therefore, the value of n is 23.6×109 for 1 hour.

Consider a month is equal to 30 days and a year is equal to 365 days.

Similarly, calculate the other values of t in the different functions f(n) to obtain the correspondinglargest values of n .

Complete the table for different values of n

as follows:

    f(n)1 second1 minute1 hour1 day1 month1 year1 century
    lgn210626×10723.6×10928.64×101022.592×101223.15×101323.16×1015
    n1×10123.6×10151.29×10197.46×10216.72×10249.95×10269.95×1026
    n1×1066×1073.6×1098.64×10102.59×10123.15×10133.16×1015
    nlgn6274628014171333780582755147513718708564047976338933496.86×1013
    n210007745600002939381609968561569256176151
    n3100391153244201373631593146679
    2n19253136414451
    n!9111213151617

Table 1

Want to see more full solutions like this?

Subscribe now to access step-by-step solutions to millions of textbook problems written by subject matter experts!
Students have asked these similar questions
Create a Database in JAVA Netbeans that saves name of the player and how many labyrinths did the player solve. Record the number of how many labyrinths did the player solve, and if he loses his life, then save this number together with his name into the database. Create a menu item, which displays a highscore table of the players for the 10 best scores public class GameGUI extends JPanel {    private final Labyrinth labyrinth;    private final Player player;    private final Dragon dragon;     private void checkGameState() {        if (player.getX() == 0 && player.getY() == labyrinth.getSize() - 1) {            JOptionPane.showMessageDialog(this, "You escaped! Congratulations!");            System.exit(0);        }         if (Math.abs(player.getX() - dragon.getX()) <= 1 &&            Math.abs(player.getY() - dragon.getY()) <= 1) {            JOptionPane.showMessageDialog(this, "The dragon caught you! Game Over.");            System.exit(0);        }    } } public…
Create a Database in JAVA OOP that saves name of the player and how many labyrinths did the player solve. Record the number of how many labyrinths did the player solve, and if he loses his life, then save this number together with his name into the database. Create a menu item, which displays a highscore table of the players for the 10 best scores. Also, create a menu item which restarts the game. public class GameGUI extends JPanel {    private final Labyrinth labyrinth;    private final Player player;    private final Dragon dragon;     private void checkGameState() {        if (player.getX() == 0 && player.getY() == labyrinth.getSize() - 1) {            JOptionPane.showMessageDialog(this, "You escaped! Congratulations!");            System.exit(0);        }         if (Math.abs(player.getX() - dragon.getX()) <= 1 &&            Math.abs(player.getY() - dragon.getY()) <= 1) {            JOptionPane.showMessageDialog(this, "The dragon caught you! Game Over.");…
Change the following code so that the player can see only the neighboring fields at a distance of 3 units.   public class GameGUI extends JPanel {    private final Labyrinth labyrinth;    private final Player player;    private final Dragon dragon;     private final ImageIcon playerIcon = new ImageIcon("data/images/player.png");    private final ImageIcon dragonIcon = new ImageIcon("data/images/dragon.png");    private final ImageIcon wallIcon = new ImageIcon("data/images/wall.png");    private final ImageIcon emptyIcon = new ImageIcon("data/images/empty.png");     public GameGUI(Labyrinth labyrinth, Player player, Dragon dragon) {        this.labyrinth = labyrinth;        this.player = player;        this.dragon = dragon;         setFocusable(true);        addKeyListener(new KeyAdapter() {            @Override            public void keyPressed(KeyEvent e) {                char move = switch (e.getKeyCode()) {                    case KeyEvent.VK_W -> 'W';                    case…
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning