Find out the running time of program

Assignment Help Basic Computer Science
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: people, numbered 1 to N, are sitting in a circle. Starting at person 1, a hot potato is passed. After 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 = 0 and = 5, players are eliminated in order, and player 5 wins. If = 1 and = 5, the order of elimination is 2, 4, 1, 5.

a. Write a program to solve the Josephus problem for general values of 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 = 1, what is the running time of your program? How is the actual speed affected by the delete routine for large values  of (100,000)?

Reference no: EM13968066

Questions Cloud

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?

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Ip addresses could not be assigned to the router

IP addresses could not be assigned to the router's Fa0/0 interface?

  Define an appropriate data structure for a sector

define an appropriate data structure for a sector, using methods discussed during the lecture. Declare three sectors. Use 31 asthe track number and 1, 2 , 3 as the sector numbers; Access the sectors using a pointer.

  Make an instance of romannumerals

Make an instance of RomanNumerals and invoke the method toRoman(int n). Enter a number in the Arabic notation and it will convert it to a Roman numeral. For example 17 will be converted to XVII.You will notice a test suite that we provide with the..

  Laser printer and inkjet printer

Identify the make and model of one (1) laser printer and one (1) inkjet printer that are similarly priced. Evaluate the quality of each in terms of print speed (i.e., pages per minute), resolution (i.e., dots per inch), memory, color capability, d..

  Write a program to print a business travel expenses

Write a program to print a business travel expenses attachment for an income tax return. The program should request as input the name of the organization visited, the dates and location of the visit, and the expenses for meals and entertainment, a..

  Write a bash shell script

Write a bash shell script that asks the user for a number and then tells the user whether the number is a prime number or not.  Need the answer to use /tmp/primes, a file containing the first million known primes.

  Discuss the issues that managing and implementing

Discuss the issues that managing and implementing the technology architecture you would have and how you would overcome these challenges. Be sure to discuss at least three challenges.

  The jsp input page with the form containing four input

1). The JSP Input page with the form containing four input textboxes and the submit button. The form will be used to collect user's input typed in the textboxes ( Customer First Name, Customer Last Name, Item Description and Item Price ) and submit t..

  Major key establishment protocols

Cryptography transforms security problem into key management problems. That is to say, to use encryption, digital signatures, or message authentication codes(MAC), the parties involved have to hold the 'right' cryptographic keys. The following 2 w..

  Process the information on the server

JSP Forms The goal of this problem set is to build a form and a way to process the information on the server. You will need to build a form that collects the following information and saves it to a table named SHIPPING_INFO:

  Calculate the frequency response of the circuit

A continuous-time LTI system has the input x(t) and the impulse response h(t) as shown below. Solve for and sketch the system output y(t) for all time. An automobile with poor shock absorbers is observed bouncing along after striking a speed bump...

  Systems development quality and use case

SYSTEMS DEVELOPMENT QUALITY AND USE CASES:The purpose of SLP 5 is to get acquainted with a third modeling technique and use the output model to document the system and train users. Structure process and data models were introduced in previous modules..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd