Content-Length: 241914 | pFad | http://github.com/Intervue/Data-structures-algorithms-for-interviews/issues/1

30 Code Issue · Issue #1 · Intervue/Data-structures-algorithms-for-interviews · GitHub
Skip to content

Code Issue #1

@JitenderBhati

Description

@JitenderBhati

For question no 16.c of arrays there is a minor issue in Method 3

int findEquilibriumIndex(int a[],int n){
int i = 0,j;
int sum = 0, sumLeft = 0;

for(i=0; i<n; i++){
	sum += a[i];
}
for(j=0;j<n;j++){
	sum = sum - a[j];
	**sumLeft += a[j];** //Should have come after if condition
	if(sum == sumLeft){
		return j;
	}
}
return 0;

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: http://github.com/Intervue/Data-structures-algorithms-for-interviews/issues/1

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy