Reference no: EM13968066
1. Given two sorted lists, L1 and L2, write a procedure to compute L1 ∪ L2 using only the basic list operations.
2. The Josephus problem is the following game: N people, numbered 1 to N, are sitting in a circle. Starting at person 1, a hot potato is passed. After M passes, the person holding the hot potato is eliminated, the circle closes ranks, and the game con- tinues with the person who was sitting after the eliminated person picking up the hot potato. The last remaining person wins. Thus, if M = 0 and N = 5, players are eliminated in order, and player 5 wins. If M = 1 and N = 5, the order of elimination is 2, 4, 1, 5.
a. Write a program to solve the Josephus problem for general values of M and N. Try to make your program as ef?cient as possible. Make sure you dispose of cells.
b. What is the running time of your program?
c. If M = 1, what is the running time of your program? How is the actual speed affected by the delete routine for large values of N (N > 100,000)?
Implementation of self-adjusting lists
: Write a linked list implementation of self-adjusting lists. Suppose each element has a ?xed probability, pi, of being accessed. Show that the elements with highest access probability are expected to be close to the front.
|
Program to evaluate a post?x expression
: 1. Write a program to evaluate a post?x expression. 2. a. Write a program to convert an in?x expression that includes (, ), +, -, *, and / to post?x.
|
Application of operator
: Looking ahead in an STL iterator requires an application of operator++, which in turn advances the iterator. In some cases looking at the next item in the list, without advancing to it, may be preferable.
|
Describe the various shipping boxes
: Describe the various shipping boxes available to the customer as listed above and then create a second table that lists the US Postal Service Hat Rate boxes and their shipping costs
|
Find out the running time of program
: What is the running time of your program? If M = 1, what is the running time of your program? How is the actual speed affected by the delete routine for large values of N (N > 100,000)?
|
What is maximum load current il
: What is maximum load current IL that can be drawn from the Zener regulator in Fig. if it is to maintain a regulated output? What is the minimum value of RI that can be used and still have a regulated output voltage?
|
Cubic maximum subsequence sum algorithm performs
: The inner loop of the cubic maximum subsequence sum algorithm performs N(N+1)(N+2)/6 iterations of the innermost code. The quadratic version performs N(N + 1)/2 iterations.
|
?x the size of the longest word
: 1. Why is it important to assume that integers in our computer model have a ?xed size? 2. Consider the word puzzle problem on page 2. Suppose we ?x the size of the longest word to be 10 characters.
|
Briefly describe the main point of the article.
: What do you think could be driving the change in the skill sets employer's desire from their accountants?
|