Circular Queue#387
Closed
hmangukia wants to merge 1 commit into
Closed
Conversation
| import java.io.*; | ||
| import java.util.*; | ||
|
|
||
| class cqueue |
There was a problem hiding this comment.
Please respect name conversions. class names begin with uppercase.
| public void insert() | ||
| { | ||
| int e; | ||
| if((f==0 && r==4)||((r+1)==f)) |
There was a problem hiding this comment.
With this condition I can only put 4 elements in the queue. Even though it has a capacity of 5 elements.
| int queue[]=new int[5]; //maximum size of queue is 5. | ||
| public void insert() | ||
| { | ||
| int e; |
There was a problem hiding this comment.
The local variable e is unnecessary. You can assign the user given value direct.
| } | ||
| } | ||
| } | ||
| class circularqueue |
There was a problem hiding this comment.
The same thing as above. Classname begin with upper case
| System.out.print("\nThe queue is empty."); | ||
| else if(f>=0) | ||
| { | ||
| queue[f]='\0'; |
There was a problem hiding this comment.
This mark is error-prone. What is if the user give a 0 as input? Use a negative value and inform the user that he can give only positive integers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.