answersLogoWhite

0

#include<stdio.h>

#include<conio.h>

#include<iostream.h>

void main()

{

int a[30];

clrscr();

int min=10000,temp=0,i,lev,n,noofc,z;

printf("please enter how many number");

cin>>n;

for(i=0;i<n;i++)

a[i]=0;

cout<<"enter value of root";

cin>>a[0];

for(i=1;i<=n/2;i++)

{

cout<<"please enter no of child of parent with value"<<a[i-1]<<":";

cin>>noofc;

for(int j=1;j<=noofc;j++)

{z=(i)*2+j-2;

cout<<"please enter value of child";

cin>>a[z];

}

}

for(i=n-1;i>=n/2;i--)

{

temp=0;

for(int j=i+1;j>=1;j=j/2)

temp=temp+a[j-1];

if(temp<min)

min=temp;

cout<<"temp min is"<<temp<<"\n";

}

cout<<"min is"<<min;

getch();

}

User Avatar

Wiki User

13y ago

What else can I help you with?

Continue Learning about Engineering

What is the difference between brute force search and heuristic search?

Brute force is a systematic approach. Heuristics use educated guesses, rules of thumb and common sense.


How do you break up cement?

Brute, manual effort. A sledgehammer or jack hammer are the two most common methods for a cement slab or sidewalk. Roadways need much bigger equipment.


Which of the following NOS logon restrictions is most likely to stop a hacker who is attempting to discover someone's password through a brute force or dictionary attack?

Number of unsuccessful logon attempts


What is the pseudo-code for finding all the factors of a positive integer?

The simple (brute-force) way to do it would be something like this: For every integer i from 2 to n-1 do: If n modulo i equals 0, output i. This would be very slow for large n (linear in the size of n, in the best case).


Explain the different searching techniques in c?

In computer science, a search algorithm, broadly speaking, is an algorithm that takes a problem as input and returns a solution to the problem, usually after evaluating a number of possible solutions. Most of the algorithms studied by computer scientists that solve problems are kinds of search algorithms.[citation needed] The set of all possible solutions to a problem is called the search space. Brute-force search, otherwise known as na&iuml;ve or uninformed, algorithms use the simplest method of the searching through the search space, whereas informed search algorithms use heuristic functions to apply knowledge about the structure of the search space to try to reduce the amount of time spent searching.