递归和中断类别 [英] Recursive and breaking categories

查看:93
本文介绍了递归和中断类别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有以下类别的列表:

If i have a list of categories like:

1. Billboards and advertisement section
  1(a)City Clock
    1(a)(i)Application fee  (has columns for approved price and proposed price)
    1(a)(ii)Advertisement Per year (has columns for approved price and proposed price)

  1(b)Billboards
    1(b)(i)Application fee for construction (has columns for approved price and proposed price)
    1(b)(ii)Charge per year without advertisement (has columns for approved price and proposed price)

  1(c)Something here.....
    1(c)(i) something here...(has columns for approved price and proposed price)
    1(c)(ii)something here...(has columns for approved price and proposed price)
    1(c)(iii) something here... (has columns for approved price and proposed price)
     e.t.c

THEN SOME CATEGORIES LOOK LIKE:category 2
2. Category name
  2(a)something here..(has columns for approved price and proposed price)
  2(b)something here..
    2(b)(i)something here..(has columns for approved price and proposed price)
    2(b)(ii)something here..(has columns for approved price and proposed price)


现在:我有没有子类别的类别,其他有子类别的类别,主类别没有价格列(或只说其他列),没有子类别的子类别将有价格列,如果子类别具有子类别,则其子类别应具有价格列(这是我的问题所在-我如何在vb.net中处理这种情况?)


NOW: i have categories without sub categories and others with sub-sub categories , a main category doesn''t does have a column for prices ( or lets just say other columns) , a sub category WITHOUT its sub category will have columns for prices, if a sub category has its sub category, then its subcategory should have columns for prices (this is where my problem is - how do i handle such a situation in vb.net?? )

推荐答案

没有这样的问题.这只不过是表示 tree 的数据结构,这是编程中最常见的一种.

就是说,您没有这样的问题,您不应该解决这个特殊的问题.首先,您迫切需要解决另一个问题-您自己的计算机教育问题.如果这个问题有一小部分,那就是学习最常见的数据结构,例如树,不同类型的链表,其他列表,哈希表,字典等.好吧,从树开始:

http://en.wikipedia.org/wiki/Tree_%28data_structure%29 [ ^ ].

只是警告:不要试图简化或泛化"您在问题中描述的数据结构-这是一棵树,仅此而已.

还有一个极端警告:不要试图通过使用诸如我现在没有时间"之类的借口来避免受教育.按照这种方式,您终生会陷入困境.是的,开个玩笑.

—SA
There is no such problem. This is nothing more but a data structure representing a tree, one of the most common in programming.

That said, you don''t have such problem and you should not solve this particular problem. First, you urgently need to solve another problem — the problem of your own computing education. One small part if this problem is learning of most common data structures, such as trees, different kinds of linked lists, other lists, hash tables, dictionaries, etc. OK, start with the tree:

http://en.wikipedia.org/wiki/Tree_%28data_structure%29[^].

Just a warning: don''t try to simplify or "de-generalize" the data structure you described in your question — this is a tree and nothing else.

And one extreme warning: don''t try to avoid education by using excuses such as "I don''t have time right now". Following this way, you will eventually get stuck for the rest of your life. Yes, jokes aside.

—SA


大声笑!!!教育程度:
感谢您的注意!我需要那个.现在我记得上学期我学习了数据结构,在那里我遇到了链表,数组,不同类型的树.好吧,我曾经在VBA中实现一棵树,但不是到第三兄弟姐妹.

现在:我认为问题出在数据库中,以及如何设计一种表单来帮助新手用户管理此类数据.

从我的记忆中,我记得您告诉我的结构通常有助于内存使用和代码效率.好吧,一定要做到最好.

好吧,我试图弄清楚如何允许用户从该结构中进行编辑,添加和删除. (树)

这是我想到的数据库结构(MySQl):
lol!!! Education:
Thanks for the heads up! i needed that. Now i remember last semester i learnt Data Structures, where i encountered linked lists, arrays, different types of trees. Well, i implemented a tree in VBA once but it was not to third siblings.

Now: I think the problem is putting in database, and How to design a form that helps a novice user to manage this kind of data.

FROM my memory, i remember that the structures you have told me usually helps in memory usage and efficiency of code. Well, am sure to implement the best when it comes to that.

Well, am trying to figure out how allow the user to edit , add and delete from this structure. (Tree)

Here is the database structure i have in mind (MySQl):
CREATE TABLE IF NOT EXISTS `price_category` (
  `act_code` int(20) NOT NULL,
  `name` text NOT NULL,
  PRIMARY KEY  (`act_code`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

-- --------------------------------------------------------

--
-- Table structure for table `price_sub_category`
--

CREATE TABLE IF NOT EXISTS `price_sub_category` (
  `id` int(11) NOT NULL auto_increment,
  `act_code` int(20) NOT NULL,
  `name` text NOT NULL,
  `aprovedp1` int(20) default NULL,
  `aprovedp1y` char(20) default NULL,
  `aprovedp2` int(20) default NULL,
  `aprovedp2y` char(20) default NULL,
  `proposedp` int(20) default NULL,
  `proposedpy` char(20) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `price_sub_sub_category`
--

CREATE TABLE IF NOT EXISTS `price_sub_sub_category` (
  `id` int(11) NOT NULL auto_increment,
  `act_code` int(20) NOT NULL,
  `sub_code` int(20) NOT NULL,
  `name` text NOT NULL,
  `aprovedp1` int(20) default NULL,
  `aprovedp1y` char(20) default NULL,
  `aprovedp2` int(20) default NULL,
  `aprovedp2y` char(20) default NULL,
  `proposedp` int(20) default NULL,
  `proposedpy` char(20) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;


这篇关于递归和中断类别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆