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

Added Depth first traversal [C] #253

Closed
wants to merge 18 commits into from
Closed

Added Depth first traversal [C] #253

wants to merge 18 commits into from

Conversation

HarshKhatore
Copy link
Contributor

@HarshKhatore HarshKhatore commented Jun 12, 2017

Fixes #250

By submitting this pull request I confirm I've read and complied with the below declarations.

  • I have read the Contribution guidelines and I am confident that my PR reflects them.
  • I have followed the coding guidelines for this project.
  • My code follows the skeleton code structure.
  • This pull request has a descriptive title. For example, Added {Algorithm/DS name} [{Language}], not Update README.md or Added new code.
  • This pull request will be closed if I fail to update it even once in a continuous timespan of 7 days.

A program in C++ to perform a recursive binary search.
C++ implementation of recursive binary search.
Adding this program to the recursive_binary_search directory.
Updated the program for recursive binary search [C++].
Updated the link for recursive binary search because it was added to a new directory.
Corrected the indentation according to the standards.
Added recursive implementation to binary_search.c [ C ]
Added it to binary_search.c
Removed binary_search link for C++ because the file was merged with binary_search.c [ C ]
Updated the name of binarySearch function to recursive_binary_search
Corrected indentation in recursive_binary_search.c
Updated with proper brackets
Added required white spaces.
Whitespace around binary operator
Created program file for depth-first traversal in C language.
Indentation inaccuracy resolved.
Updated README.md for depth_first_traversal.c
@HarshKhatore HarshKhatore changed the title Depth first traversal [ C ] Added Depth first traversal [ C ] Jun 12, 2017
if (ar[mid] == ele) {
return mid;
}

Copy link
Member

Choose a reason for hiding this comment

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

Please rebase correctly. These changes are not a part of this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@aviaryan Ok, how do I do that? Can you help?

Copy link
Member

Choose a reason for hiding this comment

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

Just delete these (extra) lines from your branch. This has been already merged.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@aviaryan How do I delete the extra lines?

Copy link
Member

Choose a reason for hiding this comment

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


for ( int j=0; j<size; j++) {
if(ar[start][j] == 1 && visited[j]==0) {

Copy link
Member

Choose a reason for hiding this comment

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

Avoid giving extra empty lines. Only give empty lines where necessary. (e.g. Adding a blank line helps to symbolize different steps of the code)

@singhpratyush singhpratyush changed the title Added Depth first traversal [ C ] Added Depth first traversal [C] Jun 12, 2017
@size - size of the array
*/

void depth_first_search(int ar[5][5], int *visited, int start, int size) {
Copy link
Member

Choose a reason for hiding this comment

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

If this is a search, then what are you searching for?

{0, 0, 0, 0, 0}
};

int visited[5] = {0, 0, 0, 0, 0};
Copy link
Member

Choose a reason for hiding this comment

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

you can use memset for this purpose and instead of directly using 5 you can use a separate variable for it.

* @r - right index of array.
* @ele - element to be searched.
*/
int recursive_binary_search(const int *ar, int l, int r, int ele) {
Copy link
Member

Choose a reason for hiding this comment

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

Remove these changes.

@Monal5031
Copy link
Member

@HarshKhatore Please update this PR, if you are having trouble you can ask at gitter. This PR will be closed after two days so please do it in time.

@Monal5031
Copy link
Member

@aviaryan Sir please close this one due to inactivity.

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

Successfully merging this pull request may close these issues.

Depth First Traversal [C]
4 participants