• 검색 결과가 없습니다.

Homework 2 of Computer Algorithms 2009

N/A
N/A
Protected

Academic year: 2021

Share "Homework 2 of Computer Algorithms 2009"

Copied!
2
0
0

로드 중.... (전체 텍스트 보기)

전체 글

(1)

Homework 2 of Computer Algorithms 2009

Instructor: Dae-Ki Kang April 10, 2009

Deadline: April 30, 2009

1. Write a program (in your favorite computer language) that calculates the following:

Given any integer 0 ≤ n ≤ 10000 not divisible by 2 or 5, some multiple of n is a number which in decimal notation is a sequence of 1’s. How many digits are in the smallest such a multiple of n?

(URL: http://icpcres.ecs.baylor.edu/onlinejudge/external/101/10127.html) 2. Prove Nicomachus’s Theorem shown as follows:

n

X

k=1

k3= ( n

X

k=1

k )2

(1)

3. Suppose we have a binary tree. One of possible C language implementa- tions for its node would be like this:

struct NODE {

int val;

struct *NODE left;

struct *NODE right;

struct *NODE parent;

struct *NODE next;

}

We assume each node have two links for its children, one link for its parent, and one link for the first next node found at the same level of the node.

In the following figure 1, links for the next node are denoted by directed arrows.

(a) Using recursion, describe an algorithm (using pseudo code notation) that fills the next links. What is the time and space complexity for the algorithm?

1

(2)

Figure 1: A binary with next links

(b) Without recursion, describe an algorithm (using pseudo code nota- tion) that fills the next links. What is the time and space complexity for the algorithm? Can you devise an algorithm that takes O(n) time complexity and O(1) space complexity? (As for the space complexity, we don’t count the input memory for the tree itself.)

4. Solve the problem 2.16 of DPV.

5. Solve the problem 2.24 of DPV.

6. Solve the problem 3.5 of DPV.

7. Solve the problem 3.7 of DPV.

8. Solve the problem 3.22 of DPV.

9. Solve the problem 3.23 of DPV.

10. Solve the problem 3.24 of DPV.

2

수치

Figure 1: A binary with next links

참조

관련 문서

In this paper, an adaptive pedestrian detection algorithm using the fusion of CCTV and IR camera is proposed.. One of the drawbacks of the pedestrian

The matrix A show the cost per computer (in thousands of dollars) and B the production figures for the year 2005 (in multiples of 1000 units).. Find a matrix C that

 The simplest method of storing a raster layer in the memory of the computer is using a data structure called an array..  We consider alternative methods for searching through

나는 이것이 고객구분보다는 제품이나 서비스의 다양성 선택에 근거하기 때문에 이를 다양성 근거의 포지셔닝(vari ety based positioning)이라고 부른다... 예를

Now follow the procedure in paper [10], to derive the average complexity bound of the Hybrid-F&R-LLL Algorithm. The results of average complexity bound of

– A collection of molecules (or atoms) in continuous random motion – Average speeds increases as T is raised.. – The molecules of a gas are widely separated (negligible

Average of the indexed values of the following data: (1) Total value of the indexed score for disability-adjusted life years (the number of years lost due to illness,

1 John Owen, Justification by Faith Alone, in The Works of John Owen, ed. John Bolt, trans. Scott Clark, "Do This and Live: Christ's Active Obedience as the