Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++ build active file",
"command": "/usr/bin/g++",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}
2 changes: 1 addition & 1 deletion C/linearSort.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ for(e=0;e<=size-1;e++)
scanf("%d",&i);
array[e]=i;
}
linearSort(arary,0,size-1);
linearSort(array,0,size-1);
printf("Sorted array:\n");
for(e=0;e<=size-1;e++) printf("%d\n",array[e]);
free(array);
Expand Down
12 changes: 6 additions & 6 deletions CPP/insertionSort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ void insertionSort(int array[], int n)
/* Move elements of arr[0..i-1], that are
greater than key, to one position ahead
of their current position */
while (j >= 0 && array[j] > key)
while (j >= 0 && array[j] > key)
{
array[j + 1] = array[j];
j = j - 1;
j--;
}
array[j + 1] = key;
}
Expand All @@ -26,14 +26,14 @@ int main()
int size=0;
cout<<"Enter no. of elements: ";
cin>>size;
int *array = new int[size];
int array[size];

cout<<"Enter elements of array:"<<endl;
for(int i=0;i<size;++i) cin>>array[i];

insertionSort(array, size);
cout<<"Sorted array:"<<endl;
for(int i=0;i<size;++i) cout<<array[i]<<endl;

return 0;
return 0;
}