查看: 1952| 回复: 6
跳转到指定楼层
上一主题 下一主题
收起左侧

[题目讨论] 求版内大牛帮助解答以下两道问题

全局:

注册一亩三分地论坛,查看更多干货!

您需要 登录 才可以下载或查看附件。没有帐号?注册账号

x
1.Given millions of unsorted words on different memorycomponents and was asked to sort them in dictionary format with out usingadditional memory.


2. there are 10different processing components which are interconnected (there is centralprocessing component), a list of tasks is available in a queue and componentsin this network should complete the available tasks, non of the tasks should beleft incomplete or ignored, also there is nothing like a multi broadcast thingavailable, no two components can work on same task.

上一篇:求推荐学习C++ Design Pattern 比较好的资料
下一篇:系统设计要准备到什么程度?
🔗
hxtang 2016-9-18 00:08:18 | 只看该作者
全局:
试着回答一下,不保证对
1. 觉得不太可能严格不需要additional memory...假设意思是memory只能提供很小的buffer。觉得可以外排序。
2. 听起来像thread pool.
回复

使用道具 举报

🔗
 楼主| 珠子手镯 2016-9-18 01:44:53 | 只看该作者
全局:
第一道题我自己写了下,可以实现排序了。。。不过请大神指点有没有更好的方法
public class sorting {
        public static void sortWords(String[] arr){
                String temp;
               
                for(int i=0;i<arr.length;i++){
                        temp=arr[i].toLowerCase();
                       
                        for(int j=0;j<arr.length;j++){
                                if(i==j){
                                        continue;
                                }
                               
                                int x=temp.compareTo(arr[j].toLowerCase());
                               
                                if(x<0){
                                        temp=arr[j];
                                        arr[j]=arr[i];
                                        arr[i]=temp;
                                }
                        }
                }
               
                for(int i=0;i<arr.length;i++){
                        System.out.println(arr[i]);
                }
        }
       
       
        public static void main(String[] args) {
                String[] arr = { "Banana","abc", "Abc", "Apple", "Orange", "Fruit",
                                "Watermelon", "Hello World" };

                sortWords(arr);
        }
}


第二道求讨论
回复

使用道具 举报

🔗
shuashua 2016-9-18 02:14:54 | 只看该作者
全局:
memory有限  应该就是外排
回复

使用道具 举报

🔗
 楼主| 珠子手镯 2016-9-18 02:20:33 | 只看该作者
全局:
请问什么交外排。。。
回复

使用道具 举报

🔗
 楼主| 珠子手镯 2016-9-18 02:41:26 | 只看该作者
全局:
求第一题代码。。。
回复

使用道具 举报

🔗
hxtang 2016-9-18 03:31:52 | 只看该作者
全局:
珠子手镯 发表于 2016-9-18 02:20
请问什么交外排。。。

https://zh.wikipedia.org/wiki/%E5%A4%96%E6%8E%92%E5%BA%8F

你如果sort还只会冒泡排序的话...先把基础打好吧...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号
隐私提醒:
  • ☑ 禁止发布广告,拉群,贴个人联系方式:找人请去🔗同学同事飞友,拉群请去🔗拉群结伴,广告请去🔗跳蚤市场,和 🔗租房广告|找室友
  • ☑ 论坛内容在发帖 30 分钟内可以编辑,过后则不能删帖。为防止被骚扰甚至人肉,不要公开留微信等联系方式,如有需求请以论坛私信方式发送。
  • ☑ 干货版块可免费使用 🔗超级匿名:面经(美国面经、中国面经、数科面经、PM面经),抖包袱(美国、中国)和录取汇报、定位选校版
  • ☑ 查阅全站 🔗各种匿名方法

本版积分规则

>
快速回复 返回顶部 返回列表