Skip to content

Circular Queue#387

Closed
hmangukia wants to merge 1 commit into
TheAlgorithms:masterfrom
hmangukia:master
Closed

Circular Queue#387
hmangukia wants to merge 1 commit into
TheAlgorithms:masterfrom
hmangukia:master

Conversation

@hmangukia

Copy link
Copy Markdown

No description provided.

@christianbender christianbender left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Good Work! I have some requests

import java.io.*;
import java.util.*;

class cqueue

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Please respect name conversions. class names begin with uppercase.

public void insert()
{
int e;
if((f==0 && r==4)||((r+1)==f))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The local variable e is unnecessary. You can assign the user given value direct.

}
}
}
class circularqueue

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The same thing as above. Classname begin with upper case

System.out.print("\nThe queue is empty.");
else if(f>=0)
{
queue[f]='\0';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

@christianbender christianbender left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Please do the tasks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants