0% found this document useful (0 votes)
2 views

Dsa 1

Uploaded by

23z335
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Dsa 1

Uploaded by

23z335
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

#include <stdio.

h>
#include <stdlib.h>
/*
int *sort(int *arr ,int len)
{
int i , j , temp ,minindex , flag;
for (i=0;i<len ; i++)
{
minindex = i;
for(j= i ; j<len ; j++)
{

if (arr[j]<arr[minindex])
{
minindex =j ;

}
}
temp =arr[i];
arr[i] = arr[minindex];
arr[minindex] = temp;

}
return arr;
}
int main()
{
int arr[] = {0,3,4,3,8,8,4,8};
int *sorted = sort(arr , 8 );
int i ,count =1 ,num;
for(i=0;i<8;i++)
{num = sorted[i];

if(sorted[i+1]==num)
{
count++;
}
else
{if(count%2==1){

printf("%d", num);

}
count =1;
}

}
*/
/*
#include <stdio.h>

int main() {
int arr[] = {-2, -3, 4, -1, -2, 1, 5, -3, 4};
int len =9;
int cur_sum =0 ,start , end, max_sum =0;
int i , j , k;
for(i=0 ; i< len ; i++)
{
cur_sum = cur_sum+arr[i];
if (cur_sum< 0)
{
cur_sum=0;
start = i+1;
}
if(cur_sum>max_sum)
{
max_sum = cur_sum;
end = i;
}
}
printf("%d \n " ,max_sum);
for (i=start ; i<=end ; i++)
{
printf("%d " ,arr[i]);
}
return 0;
}
*/

You might also like