首页 > 代码库 > 《Cracking the Coding Interview》——第17章:普通题——题目10
《Cracking the Coding Interview》——第17章:普通题——题目10
2014-04-28 23:54
题目:XML文件的冗余度很大,主要在于尖括号里的字段名。按照书上给定的方式进行压缩。
解法:这题我居然忘做了,只写了一句话的注解。用python能够相对方便地实现,因为有直接的XML工具可以调用。书上的那种要求应该是符合前序遍历规则。
代码:
1 # 17.10 Parse an XML file, and try to save some space by mapping every item name to an integer index. 2 # Answer: 3 # Preordere traversal of an element tree, maybe ElementTree will be a good tool.
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。