Hi All,
This question is similar to Question i had asked before.
Suppose a library.
The library has many of Books(say B(1 to n)). (n =number of Books)
Each book can have many Chapters (say C(1 to k)) . (k= number of Chapters)
Every Chapter can have number of Lessons (say L(1 to j)) .. (j = number of Lessons)
Every Lessons can have number of Topics (say T(1 to i)) .. (i = number of Topics ) ... ...
Now suppose if I want to create a list such that it has "all" entries like
Book 1 Chapter 1 Lesson 1 Topic 1 ...
Book 1 Chapter 1 Lesson 1 Topic 2 ...
Book 1 Chapter 1 Lesson 1 Topic 3 ...
Book 2 Chapter 1 Lesson 1 Topic 1 ...
Book 2 Chapter 1 Lesson 1 Topic 2 ...
Book 2 Chapter 1 Lesson 1 Topic 3 ...
Book 2 Chapter 1 Lesson 1 Topic 4 ...
Book 2 Chapter 2 Lesson 1 Topic 1 ...
Book 2 Chapter 2 Lesson 1 Topic 2 ...
Book 2 Chapter 2 Lesson 1 Topic 3 ...
.....
Book (x1) Chapter (x2) Lesson (x3) Topic (x4) ...
where 1 <= x1 <= n, 1 <= x2 <= k, 1<= x3 <= j, 1< = x4 < = i
(Above example shows "Book 1" with 1 chapter 1 lesson 3 topics and "Book 2" with 2 chapters with "lesson 1" and 4 topics in chapter 1 and "lesson 1" and 3 topics in chapter 2. ) How can this list be efficiently generated?
Also, the entry "Book (x1) Chapter (x2) Lesson (x3) Topic (x4)" is not limited to Topic
(4 variables).
It can vary too. Grow or shrink .
eg: Topics can have Questions,Questions can have Sub Questions.
(based on user selection.)
Note: This is purely academic
Does this problem fall in the NP class of problems?
Any programming language ..algorithm :)
Thanks All