楼主: 大家开心
3461 25

A Concise Introduction to Data Structures Using Java [推广有奖]

21
charlmei(真实交易用户) 发表于 2015-6-17 02:48:25

Listing 5.1: Resize Circular Array (Pseudocode)

  1. Listing 5.1: Resize Circular Array (Pseudocode)
  2. 1  j = front
  3. 2  for i = 0 to size - 1
  4. 3         newData[i] = data[j]
  5. 4         j = (j + 1) % capacity
  6. 5  Update front, rear, capacity, data
复制代码

已有 1 人评分论坛币 收起 理由
Nicolle + 20 精彩帖子

总评分: 论坛币 + 20   查看全部评分

22
liuqin9198(真实交易用户) 发表于 2015-6-27 19:43:39

Listing 5.2: Fixed-Length Queue

  1. Listing 5.2: Fixed-Length Queue
  2. 1  public class FixedLengthQueue<E> extends ArrayQueue<E> {
  3. 2         private int drops;
  4. 3
  5. 4         public FixedLengthQueue(int capacity) {
  6. 5         super(capacity);
  7. 6         }
  8. 7
  9. 8         @Override
  10. 9         public void enqueue(E item) {
  11. 10         if (size == capacity) {
  12. 11         drops++;
  13. 12         } else {
  14. 13         super.enqueue(item);
  15. 14         }
  16. 15         }
  17. 16
  18. 17         public int drops() {
  19. 18         return drops;
  20. 19         }
  21. 20  }
复制代码

已有 1 人评分论坛币 收起 理由
Nicolle + 20 鼓励积极发帖讨论

总评分: 论坛币 + 20   查看全部评分

23
Eviewschen(未真实交易用户) 发表于 2015-6-27 20:19:42

Listing 5.3: Clock-Based Simulation (Pseudocode)

  1. Listing 5.3: Clock-Based Simulation (Pseudocode)
  2. 1  t = 0
  3. 2  while (t < minTime or processor is busy)
  4. 3         if (t < minTime) randomly add new task to processor
  5. 4         simulate one time step on processor
  6. 5         t++
复制代码

24
Nicolle(未真实交易用户) 学生认证  发表于 2015-6-29 08:19:38

Listing 5.4: Generate Random Tasks (Pseudocode)

提示: 作者被禁止或删除 内容自动屏蔽

25
Nicolle(未真实交易用户) 学生认证  发表于 2015-11-5 09:31:32

Listing 6.1: ArrayList Insertion

提示: 作者被禁止或删除 内容自动屏蔽

26
Nicolle(未真实交易用户) 学生认证  发表于 2015-11-5 09:33:15
提示: 作者被禁止或删除 内容自动屏蔽

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
jg-xs1
拉您进交流群
GMT+8, 2026-1-2 10:57