Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Array queue in js and ts #97

Closed
wants to merge 139 commits into from

Conversation

S-N-O-R-L-A-X
Copy link
Contributor

Array queue in js and ts

@vercel
Copy link

vercel bot commented Dec 12, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Updated
hello-algo ⬜️ Ignored (Inspect) Dec 19, 2022 at 4:01PM (UTC)


/* 基于环形数组实现的队列 */
class ArrayQueue {
queue; // 用于存储队列元素的数组
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use private member, #queue

class ArrayQueue {
queue; // 用于存储队列元素的数组
front = 0; // 头指针,指向队首
rear = 0; // 尾指针,指向队尾 + 1
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

console.log("第 " + i + " 轮入队 + 出队后 queue = ");
console.log(queue.toArray());
}

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant empty line.

@krahets
Copy link
Owner

krahets commented Dec 12, 2022

Thanks for the contribution! This PR will keep open waiting for the linkedlist_queue implementation.

By the way, could you help implement linkedlist_stack.js? As array_stack.js and stack.js are written by you as well. Maybe it is proper for you to finish them. Thanks!

@krahets krahets added the code Code-related label Dec 12, 2022
@S-N-O-R-L-A-X
Copy link
Contributor Author

S-N-O-R-L-A-X commented Dec 19, 2022

@krahets Hi, I have completed queue but I suddenly find that this title is Array queue and the branch is called array_queue. So should we still use this to merge the linkedlist_queue?

@krahets
Copy link
Owner

krahets commented Dec 19, 2022

Prefer to changing the title.

@S-N-O-R-L-A-X
Copy link
Contributor Author

Prefer to changing the title.

It is easy to change the title for this PR. But the branch is also called array_queue, is it easy to rename a branch?

@krahets
Copy link
Owner

krahets commented Dec 19, 2022

I think it is not necessary. We can ignore this problem this time.

@S-N-O-R-L-A-X
Copy link
Contributor Author

S-N-O-R-L-A-X commented Dec 19, 2022

It seems going wrong when cherry-picking my commits from another branch to this branch.

@krahets
Copy link
Owner

krahets commented Dec 19, 2022

It seems going wrong when cherry-picking my commits from another branch to this branch.

Please close this PR and re-create one.

@krahets
Copy link
Owner

krahets commented Dec 19, 2022

This PR is closed because of the inconsistent header with the master branch of the main repo.

It is recommended to

  1. save your work locally
  2. re-fork the repo.
  3. Copy your code to the repo.
  4. Create a pull request.

@krahets krahets closed this Dec 19, 2022
@S-N-O-R-L-A-X
Copy link
Contributor Author

This PR is closed because of the inconsistent header with the master branch of the main repo.

It is recommended to

  1. save your work locally
  2. re-fork the repo.
  3. Copy your code to the repo.
  4. Create a pull request.

I used another branch and reraised a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code Code-related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants