Addition of Readme file contents for each item and addition of Cycle Sort to C++ Algorithm Sorting part etc... #870
 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.    
 
Pull Request Template
What have you Changed(must)
First, we have filled in most of the readme files for each item in the C++ language. (Excluding pattern Searching and already filled Heap)
For example. - Bubble Sort
Algorithm that sorts the data by comparing the n-1st data and the nth data like the first data and the second data, the second data and the third data, exchanging the order. Time complexity = O(n^2)
Second, we added cycle sort in C++'s sorting algorithm.
(Here is an excerpt from the cycle sort code.)
#include<bits/stdc++.h>
using namespace std;
// Sorting the array, Returns the number of writes.
int cycle_sort(int arr[], int size_of_arr) {
int writes, item, pos;
writes = 0;
}
Third, For some code, we have simplified the code.
like c++ -> sort -> MergeSort,
#include <bits/stdc++.h>
using namespace std;
void merge(int arr[], int low, int mid, int high){
int i, j, k;
int n1 = mid + 1 - low;
int n2 = high - mid;
int l[n1], r[n2];
for(int i=0; i<n1; i++) l[i]=arr[low+i]; // left
for(int j=0; j<n2; j++) r[j]=arr[mid+j+1]; // right
i=0; j=0; k=low;
while(i<n1 && j<n2){
if(l[i]<=r[j]) arr[k++]=l[i++];
else arr[k++]=r[j++];
}
while(i<n1) arr[k++]=l[i++];
while(j<n2) arr[k++]=r[j++];
}
void mergeSort(int arr[],int low,int high){ // sorting
int mid;
if(low<high){
mid=low+(high-low)/2;
}
}
int main()
{
//enter number of elements
int n;
cin>>n;
int arr[n];
//enter elemetns
for(int i=0;i<n;i++) cin>>arr[i];
//called Function
mergeSort(arr,0,n-1);
//after Sort array
for(int i=0;i<n;i++) cout<<arr[i]<<" ";
}
fourth, In the case of JumpSearch, there is a problem that you must enter the sorted number when entering, but by adding mergesort, you do not necessarily enter the sorted number when entering.
int main()
{
int n, search;
cout << "Enter no. of elements in an array: ";
cin >> n;
int arr[n];
cout << "Enter elements in an array: ";
for(int i=0;i<n;i++) cin >> arr[i];
mergeSort(arr,0,n-1); // Merge sort is used because the processing speed is rather fast.
cout << "Enter a number to be searched: ";
cin >> search;
int result = jump_search(arr,n,search); // Jump Search
if(result == -1) cout << search << " is not present in the array." << endl;
else cout << search << " is present at index no " << result+1 << endl;
}
lastly, In the c++ part (parts excluding pattern Searching), files that were not commented were searched for and added comments. It also modified files without the .cpp extension.
Extra, in the c++ Data structures related to graphs are divided into "graph" folder and "Graph" folder. So you have to merge the two.
Issue no.(must) - ##531
Pr will be closed and marked as spam. If issue number not found or issue was assigned to someone else.
Marking as spam can block your account from HacktoberFest.
Self Check(Tick After Making pull Request)
README - How to Contribute