Skip to content

Commit

Permalink
Merge pull request #2 from SudhanshuMishra8826/master
Browse files Browse the repository at this point in the history
added linear search implementation in c.
  • Loading branch information
tanseersaji authored Oct 5, 2018
2 parents c513b30 + 2f1a008 commit 7c4d0f0
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
11 changes: 11 additions & 0 deletions bubble_sort/Python/bubble_sort.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
def bubbleSort(arr):
n = len(arr)
for i in range(n):
for j in range(0, n-i-1):
if arr[j] > arr[j+1] :
arr[j], arr[j+1] = arr[j+1], arr[j]
arr = [64, 34, 25, 12, 22, 11, 90]
bubbleSort(arr)
print ("Sorted array is:")
for i in range(len(arr)):
print ("%d" %arr[i]),
24 changes: 24 additions & 0 deletions linear_search/C/linear search.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include <stdio.h>
void main()
{
int a[10], i, item,n,flag=0;
printf("Enter number of elements : ");
scanf("%d",&n);
printf("\nEnter elements of an array:\n");
for (i=0; i<n; i++)
{printf("Element : ");
scanf("%d", &a[i]);}
printf("\nEnter item to search: ");
scanf("%d", &item);
for (i=0; i<n; i++)
{
if (item == a[i])
{ flag=1;
printf("\nItem found at location %d", i+1);
break;
}
}
if (flag==0)
printf("\nItem does not exist.");
getch();
}

3 comments on commit 7c4d0f0

@sangamcse

This comment was marked as outdated.

@sangamcse
Copy link
Member

Choose a reason for hiding this comment

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

Comment on 7c4d0f0.

There are 22 results for the section all.pyjava. They have been shortened and will not be shown inline because they are more than 10.

Message File Line
Line contains following spacing inconsistencies: - Tabs used instead of spaces. linear_search/Python/linearsearch.py 5
Line contains following spacing inconsistencies: - Tabs used instead of spaces. linear_search/Python/linearsearch.py 6
Line contains following spacing inconsistencies: - Tabs used instead of spaces. linear_search/Python/linearsearch.py 10
Line contains following spacing inconsistencies: - Tabs used instead of spaces. linear_search/Python/linearsearch.py 11
Line contains following spacing inconsistencies: - Tabs used instead of spaces. linear_search/Python/linearsearch.py 12
Line contains following spacing inconsistencies: - Tabs used instead of spaces. linear_search/Python/linearsearch.py 14
Line contains following spacing inconsistencies: - Trailing whitespaces. skip_list/Python/SkipList.py 59
Line contains following spacing inconsistencies: - Trailing whitespaces. skip_list/Python/SkipList.py 69
Line contains following spacing inconsistencies: - Trailing whitespaces. skip_list/Python/SkipList.py 76
Line contains following spacing inconsistencies: - Trailing whitespaces. skip_list/Python/SkipList.py 87
Line contains following spacing inconsistencies: - Trailing whitespaces. skip_list/Python/SkipList.py 91
Line contains following spacing inconsistencies: - Trailing whitespaces. bubble_sort/Python/bubble_sort.py 1
Line contains following spacing inconsistencies: - Trailing whitespaces. bubble_sort/Python/bubble_sort.py 2
Line contains following spacing inconsistencies: - Trailing whitespaces. bubble_sort/Python/bubble_sort.py 3
Line contains following spacing inconsistencies: - Trailing whitespaces. bubble_sort/Python/bubble_sort.py 4
Line contains following spacing inconsistencies: - Trailing whitespaces. bubble_sort/Python/bubble_sort.py 5
Line contains following spacing inconsistencies: - Trailing whitespaces. bubble_sort/Python/bubble_sort.py 6
Line contains following spacing inconsistencies: - Trailing whitespaces. bubble_sort/Python/bubble_sort.py 7
Line contains following spacing inconsistencies: - Trailing whitespaces. bubble_sort/Python/bubble_sort.py 8
Line contains following spacing inconsistencies: - Trailing whitespaces. bubble_sort/Python/bubble_sort.py 9
Line contains following spacing inconsistencies: - Trailing whitespaces. bubble_sort/Python/bubble_sort.py 10
Line contains following spacing inconsistencies: - No newline at EOF. bubble_sort/Python/bubble_sort.py 11

Until GitMate provides an online UI to show a better overview, you can run coala locally for more details.

@sangamcse

This comment was marked as outdated.

Please sign in to comment.