Skip to content

Conversation

@mehakmalhotra1
Copy link
Contributor

Fixes issue:

Changes:

Added comments

#include <cstdlib>
#include <iostream>
#include <vector>

Choose a reason for hiding this comment

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

@mehakmalhotra1 Please remove unwanted line breaks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please review it


int mid = (beg + end) / 2; //If there are more than 2 elements
//If there are more than 2 elements
int mid = (beg + end) / 2;

Choose a reason for hiding this comment

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

@mehakmalhotra1 it is the wrong way to find mid element this may cause an overflow. Use mid = beg + (end - beg) / 2

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