首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2SE开发 >

求救!作业题,各位大大帮忙解决方案

2012-01-10 
求救!!!作业题,各位大大帮忙可能有点多,麻烦了!!!我真的很急啊!1).ProductCatalogSearchIndexing1a).Drawt

求救!!!作业题,各位大大帮忙
可能有点多,麻烦了!!!我真的很急啊!
1).   Product   Catalog   Search   Indexing
1a).   Draw   the   entity-relationship   (ER)   diagram   for   a   Product   Catalog.

Sample   Data:

Catalog   “A”   contains
Category   “A1”   contains
Products   P1   ($1.99),   P2   ($2.99),   P3   ($3.99),   P4   ($4.99)
Category   “A2”   contains
Category   “A21”   contains
Products   P5   ($5.99),   P6   ($6.99)
Category   “A22”   contains
Products   P7   ($7.99),   P8   ($8.99)

Catalog   “B”   contains
Category   “B1”   contains
Category   “B11”   contains
Products   P1   ($11.99),   P2   ($12.99)
Category   “B12”   contains
Products   P3   ($13.99),   P4   ($14.99)
Category   “B2”
Products   P5   ($15.99),   P6   ($16.99),   P7   ($17.99),   P8   ($18.99)

Hints:
•This   is   NOT   a   Binary   Tree.     A   Category   may   contain   more   than   two   (2)   Child-Categories,   and/or   more   than   two   (2)   Child-Products.     For   example,   Category   A1   contains   four   (4)   Products:   P1,   P2,   P3   and   P4.
•Prices   are   “attached   to”   Category   –   Product   combinations.     As   such,   Prices   are   Category   specific.     For   example,   under   Catalog   A   ->   Category   A1,   Product   P1   is   $1.99.     Under   Catalog   B   ->   Category   B1   ->   Category   B11,   Product   P1   is   $11.99.
•Product   may   show   up   in   different   Catalogs   and   Categories.     For   example,   Product   P1   shows   up   under   Catalog   A   ->   Category   A1,   but   also   shows   up   under   Catalog   B   ->   Category   B1   ->   Category   B11.

 
1b).   Design   and   implement,   in   Java   /   C#   /   C++,   the   data   structure   and   algorithm   for   generating   a   Product   Search   Index   Table   from   the   Product   Catalog.

Sample   Input:   (Same   as   the   Sample   Data   in   #1a)

Catalog   “A”   contains
Category   “A1”   contains
Products   P1   ($1.99),   P2   ($2.99),   P3   ($3.99),   P4   ($4.99)
Category   “A2”   contains
Category   “A21”   contains
Products   P5   ($5.99),   P6   ($6.99)
Category   “A22”   contains
Products   P7   ($7.99),   P8   ($8.99)

Catalog   “B”   contains
Category   “B1”   contains
Category   “B11”   contains
Products   P1   ($11.99),   P2   ($12.99)
Category   “B12”   contains
Products   P3   ($13.99),   P4   ($14.99)
Category   “B2”


Products   P5   ($15.99),   P6   ($16.99),   P7   ($17.99),   P8   ($18.99)

Sample   Output:   Product   Search   Index   Table

Catalog   /   Category   PathProduct   NamePrice
A   ->   A1P1$1.99  
A   ->   A1P2$2.99  
A   ->   A1P3$3.99  
A   ->   A1P4$4.99  
A   ->   A1   ->   A21P5$5.99  
A   ->   A1   ->   A21P6$6.99  
A   ->   A2   ->   A22P7$7.99  
A   ->   A2   ->   A22P8$8.99  
B   ->   B1   ->   B11P1$11.99  
B   ->   B1   ->   B11P2$12.99  
B   ->   B1   ->   B12P3$13.99  
B   ->   B1   ->   B12P4$14.99  
B   ->   B2P5$15.99  
B   ->   B2P6$16.99  
B   ->   B2P7$17.99  
B   ->   B2P8$18.99  

Note:     Given   Product   Name,   one   can   use   this   table   to   find   all   Catalog   /   Category   Paths   in   O(1)   time   via   a   hash   table   look-up.


[解决办法]
JAVA?
[解决办法]
遍历多叉树,随便找个中文的数据结构书,把上面的伪代码翻译成java/c/c#语言就行了。
[解决办法]

热点排行