All Matches
Solution Library
Expert Answer
Textbooks
Search Textbook questions, tutors and Books
Oops, something went wrong!
Change your search query and then try again
Toggle navigation
FREE Trial
S
Books
FREE
Tutors
Study Help
Expert Questions
Accounting
General Management
Mathematics
Finance
Organizational Behaviour
Law
Physics
Operating System
Management Leadership
Sociology
Programming
Marketing
Database
Computer Network
Economics
Textbooks Solutions
Accounting
Managerial Accounting
Management Leadership
Cost Accounting
Statistics
Business Law
Corporate Finance
Finance
Economics
Auditing
Ask a Question
Search
Search
Sign In
Register
study help
Computer science
algorithm design
introduction to programming
Questions and Answers of
Introduction To Programming
Download the file medium.txt from the booksite (which reflects the 50-page example depicted in this section) and add to it links from page 23 to every other page. Observe the effect on the page
Add to medium.txt (see the previous exercise) links to page 23 from every other page, observe the effect on the page ranks, and discuss the result.Data from in previous exerciseDownload the file
Suppose that your page is page 23 in medium.txt. Is there a link that you could add from your page to some other page that would raise the rank of your page? public class IntOps { } public static
Suppose that your page is page 23 in medium.txt. Is there a link that you could add from your page to some other page that would lower the rank of that page? public class IntOps { } public static
Use Transition and RandomSurfer to determine the page ranks for the eight-page graph shown below.
Use Transition and Markov to determine the page ranks for the eightpage graph shown below. Eight-page example (6)
Matrix squaring. Write a program like Markov that computes page ranks by repeatedly squaring the matrix, thus computing the sequence p, p2, p4, p8, p16, and so forth. Verify that all of the rows in
Random web. Write a generator for Transition that takes as commandline arguments a page count n and a link count m and prints to standard output n followed by m random pairs of integers from 0 to
Hubs and authorities. Add to your generator from the previous exercise a fixed number of hubs, which have links pointing to them from 10% of the pages, chosen at random, and authorities, which have
Page ranks. Design a graph in which the highest-ranking page has fewer links pointing to it than some other page.
Hitting time. The hitting time for a page is the expected number of moves between times the random surfer visits the page. Run experiments to estimate the hitting times for tiny.txt, compare hitting
Cover time. Write a program that estimates the time required for the random surfer to visit every page at least once, starting from a random page.
Graphical simulation. Create a graphical simulation where the size of the dot representing each page is proportional to its page rank. To make your program data driven, design a file format that
Write a static method max3() that takes three int arguments and returns the value of the largest one. Add an overloaded function that does the same thing with three double values.
Write a static method odd() that takes three boolean arguments and returns true if an odd number of the argument values are true, and false otherwise.
Write a static method majority() that takes three boolean arguments and returns true if at least two of the argument values are true, and false otherwise. Do not use an if statement.
Write a static method eq() that takes two int arrays as arguments and returns true if the arrays have the same length and all corresponding pairs of of elements are equal, and false otherwise.
Write a static method areTriangular() that takes three double arguments and returns true if they could be the sides of a triangle (none of them is greater than or equal to the sum of the other two).
Write a static method sigmoid() that takes a double argument x and returns the double value obtained from the formula 1 / (1 + ex).
Write a static method sqrt() that takes a double argument and returns the square root of that number. Use Newton’s method (see PROGRAM 1.3.6) to compute the result.
Give the function-call trace for java Harmonic 3 5
Write a static method lg() that takes a double argument n and returns the base-2 logarithm of n. You may use Java’s Math library.
Write a static method lg() that takes an int argument n and returns the largest integer not larger than the base-2 logarithm of n. Do not use the Math library.
Write a static method signum() that takes an int argument n and returns -1 if n is less than 0, 0 if n is equal to 0, and +1 if n is greater than 0.
Consider the static method duplicate() below.public static String duplicate(String s){String t = s + s;return t;}What does the following code fragment do?String s = "Hello";s = duplicate(s);String t
Consider the static method cube() below.public static void cube(int i){i = i * i * i;}How many times is the following for loop iterated?for (int i = 0; i < 1000; i++)cube(i);
The following checksum formula is widely used by banks and credit card companies to validate legal account numbers:The di are the decimal digits of the account number and f (d) is the sum of the
Given two stars with angles of declination and right ascension (d1, a1) and (d2, a2), the angle they subtend is given by the formulawhere a1 and a2 are angles between -180 and 180 degrees, d1 and d2
Write a static method scale() that takes a double array as its argument and has the side effect of scaling the array so that each element is between 0 and 1 (by subtracting the minimum value from
Write a static method reverse() that takes an array of strings as its argument and returns a new array with the strings in reverse order. (Do not change the order of the strings in the argument
Write a static method readBoolean2D() that reads a two-dimensional boolean matrix (with dimensions) from standard input and returns the resulting two-dimensional array.
Write a static method histogram() that takes an int array a[] and an integer m as arguments and returns an array of length m whose ith element is the number of times the integer i appeared in a[].
Assemble code fragments in this section and in SECTION 1.4 to develop a program that takes an integer command-line argument n and prints n five-card hands, separated by blank lines, drawn from a
Write a static method multiply() that takes two square matrices of the same dimension as arguments and produces their product (another square matrix of that same dimension). Extra credit : Make your
Write a static method any() that takes a boolean array as its argument and returns true if any of the elements in the array is true, and false otherwise.Write a static method all() that takes an
Develop a version of getCoupon() that better models the situation when one of the coupons is rare: choose one of the n values at random, return that value with probability 1 /(1,000n), and return all
Modify PlayThatTune to add harmonics two octaves away from each note, with half the weight of the one-octave harmonics.
Birthday problem. Develop a class with appropriate static methods for studying the birthday problem.
Euler’s totient function. Euler’s totient function is an important function in number theory: φ(n) is defined as the number of positive integers less than or equal to n that are relatively prime
Write a program Harmonic that contains three static methods harmoinc(), harmoincSmall(), and harmonicLarge() for computing the harmonic numbers. The harmonicSmall() method should just compute the sum
Black–Scholes option valuation. The Black–Scholes formula supplies the theoretical value of a European call option on a stock that pays no dividends, given the current stock price s, the exercise
Fourier spikes. Write a program that takes a command-line argument n and plots the functionfor 500 equally spaced samples of t from -10 to 10 (in radians). Run your program for n = 5 and n = 500.
Calendar. Write a program Calendar that takes two integer commandline arguments m and y and prints the monthly calendar for month m of year y, as in this example: % java Calendar 2 2009 February 2009
Horner’s method. Write a class Horner with a method evaluate() that takes a floating-point number x and array p[] as arguments and returns the result of evaluating the polynomial whose coefficients
Develop a version of PlayThatTune that can handle songs with chords (including harmonics). Develop an input format that allows you to specify different durations for each chord and different
The American astronomer Simon Newcomb observed a quirk in a book that compiled logarithm tables: the beginning pages were much grubbier than the ending pages. He suspected that scientists performed
Write a function public static double binomial(int n, int k, double p)to compute the probability of obtaining exactly k heads in n biased coin flips (heads with probability p) using the formulaTo
Develop a version of getCoupon() that uses binomial() from the previous exercise to return coupon values according to the binomial distribution with p = 1/2. Generate a uniformly random number x
The barcode used by the U.S. Postal System to route mail is defined as follows: Each decimal digit in the ZIP code is encoded using a sequence of three half-height and two full-height bars. The
Showing 600 - 700
of 649
1
2
3
4
5
6
7