Translate

Wednesday 6 November 2019

Data structure in c : Array problem solving for finding summation of overlapped sub array

//K maximum sums of non-overlapping contiguous sub-arrays
//Given an Array of Integers and an Integer value k, find out k non-overlapping sub-arrays which have k maximum sums.
//---- code by manish
#include<stdio.h>
main(){
//======================= user entry : array and size ================   
int a [5]={1,2,3,4,5};
int array_size=5;
//====================================================================
int no_of_sum,itr;
int i,j;
no_of_sum = array_size-1;
itr=no_of_sum-1;
while(itr!=0){
no_of_sum=no_of_sum+itr;
itr--;
}

int *sum_ptr= (int*) malloc((no_of_sum+array_size) * sizeof(int));
int *sum_ptr_loc= (int*) malloc((no_of_sum+array_size) * sizeof(int));

int *sum_ptr_new;
int *sum_ptr_loc_new;

sum_ptr_new=sum_ptr;
sum_ptr_loc_new=sum_ptr_loc;

int location;
//============================== calculating all sumation and storing into malloc mem ============================
for(i=0;i<array_size-1;i++){
 
    for(j=i+1;j<array_size;j++){
        location = i*10+j;
        *sum_ptr_loc=location;
       
       
if(j-i==1){       
*sum_ptr=a[i]+a[j];
}else{
    *sum_ptr=a[j]+*(sum_ptr-1);
}


sum_ptr++;
sum_ptr_loc++;
    }
 
}
//========================== including array into sumations   ==========================

for(i=0;i<array_size;i++){
   *sum_ptr = a[i] ;
   *sum_ptr_loc=i*10+i;

   sum_ptr++;
   sum_ptr_loc++;

 
}
//============================ sorting of sumation (selection short)    ======================
int swap,swap_loc;

for(i=0;i<(no_of_sum+array_size-1);i++){
    for(j=i+1;j<=(no_of_sum+array_size-1);j++){
        if(*(i+sum_ptr_new)<*(j+sum_ptr_new)){
           
         swap=*(i+sum_ptr_new);
         swap_loc=*(i+sum_ptr_loc_new);
       
         *(i+sum_ptr_new)=*(j+sum_ptr_new);
         *(i+sum_ptr_loc_new)=*(j+sum_ptr_loc_new);
       
       
         *(j+sum_ptr_new)=swap;
         *(j+sum_ptr_loc_new)=swap_loc;
       
           
        }
       
    }
}

//========================== printing all sumation  ========================

for(i=1;i<=(no_of_sum+array_size);i++ ){
    printf(" sum =  %d     location = %d  \n ", *sum_ptr_new,*sum_ptr_loc_new);
    sum_ptr_new++;
    sum_ptr_loc_new++;
}
free(*sum_ptr_new);
free(*sum_ptr_loc_new);

}

Thursday 14 February 2019

Offical Logo

I am here by announcing  the Official Logo of Embedded4me tech-blog and shall be continue with all the original content posted with this logo as sign of our originality.

I make sure I shall post more and more content on this blog and on the youtube channel by same name .    
Here is the link of the channel .please do like and subscribe :
https://youtu.be/hWoVBl7shBA.

Monday 29 January 2018

MyIOT Helpdesk

We offers following Featured platforms :
Blynk
Mathworks's Thingspeak
Adafruit IO (MQTT  based)
Webhost based cloud IOT
offline webserver using TCP/IP

For more details, contact:
bande220@gmail.com
+918390671961

Monday 22 January 2018

My IOT server with esp8266 SOCs

Struggling for IOT projects??
Fed up with complex connection and communication with open source IOT clouds??

Here is the simplest breakthrough of all your problems ...
We proudly presents ....MYIOT..A platform where in minutes one can design iot server and start communicating with hardware..

For demo visit:
https://embedded4me.000webhostapp.com/EmbeddedIOT.php

For more details contact:
bande220@gmail.com
+918390671961

Tuesday 16 January 2018

MyIOT .....open source platform of IOT applications with thinkspeak and Google cloud

Hey IOT Lovers....this time Embedded4me is launching an simple platform for IOT applications with esp8266,nodemcu and esp32 chips..

Features:
1] controlling devices ,sensors from anywhere
2] live data logging using thinkspeak and Google cloud
3] publishing applications as webapp or as live websites using free web hosting.

If you're still confused...see the demo:

WEB PLATFORM USING FREE WEB HOSTING

https://embedded4me.000webhostapp.com/index.html/iot.html

THINKSPEAK CLOUD DATA LOGGING

https://thingspeak.com/channels/404270/charts/1?bgcolor=%23ffffff&color=%23d62020&dynamic=true&results=60&type=line

GOOGLE CLOUD BASED DATA LOGGING AND PLOTTING

https://docs.google.com/spreadsheets/d/e/2PACX-1vRSlhyGsmPf9wMRsusNd2SGweRXBaQJFVgpNQA8Sh24XJVS5o-auELYB1XUyf5NX2xPSOYVyENz1Vlc/pubhtml?gid=0&amp;single=true&amp;widget=true&amp;headers=false#



Stay tuned with us for more updates!

Tuesday 29 August 2017

Internet of things via Arduino+ ESP8266

this post is about optimistic solution in coding for  the esp8266 wifi and arduino TCP/IP communication.
Just install the below linked library followed by an example .


https://drive.google.com/file/d/0B1-Y-GZQ_x1jUkZqb0p2NURleTQ/view?usp=sharing


leave a comment regarding any queries and  the usage of above .

Tuesday 2 May 2017

I2C /TWI PROTOCOL WITH ARDUINO

The most useful serial communication protocol with practical implementation.

Visit the below link which is having a document based on this.

Kindly leave a comment after download.

https://drive.google.com/file/d/0B1-Y-GZQ_x1jcGF4UFRqQnBTalU/view?usp=drivesdk