Give an algorithm for the following problem. Given a list of n distinct positive integers, partition the list into two sublists, each of size n/2, such that the difference between the sums of the integers in the two sublists is minimized. You may assume that n is a multiple of 2.

Consider the following algorithm, where the array A is indexed 1 through n:
int add_them ( int n , int A[ ] ) {
index i , j , k ;
j = 0 ;
for ( i = 1 ; i <= n ; i++)
j = j + A[i] ;
k = 1 ;
for ( i = 1 ; i <= n ; i++)
k = k + k ;
return j + k ;
}
(a) If n = 5 and the array A contains 2, 5, 3, 7, and 8, what is returned?
(b) What is the time complexity T(n) of the algorithm?

Consider the following algorithm:
for ( i = 2 ; i <= n ; i++) {
for ( j = 0 ; j <= n) {
cout << i << j ;
j = j + floor(n/4) ;
}
}
(a) What is the output when n = 4
(b) What is the time complexity T(n). You may assume that n is divisible 4.

Consider the following algorithm:
j = 1 ;
while ( j <= n/2) {
i = 1 ;
while ( i <= j ) {
cout << j << i ;
i++;
}
j++;
}
(a) What is the output when n = 6, n = 8, and n = 10?
(b) What is the time complexity T(n)? You may assume that the input n is divisible by 2.

1. Consider the following algorithm:
for ( i = 1 ; i <= 1 . 5 n ; i++)
cout << i ;
for ( i = n ; i >= 1 ; i - - )
cout << i ;
(a) What is the output when n = 2, n = 4, and n = 6?
(b) What is the time complexity T(n)? You may assume that the input n is divisible by 2.

What is the space complexity of Greedy search?
a) O(b)
b) O(bl)
c) O(m)
d) O(bm)

110

The term ___________ is used for a depth-first search that chooses values for one variable at a time and returns when a variable has no legal values left to assign.
a) Forward search
b) Backtrack search
c) Hill algorithm
d) Reverse-Down-Hill search

210

An omniscient agent knows the actual outcome of its actions and can act accordingly; but omniscience is impossible in reality. Rational Agent always does the right thing; but Rationality is possible in reality. State true or false
a) True
b) False

141

Hill climbing sometimes called ____________ because it grabs a good neighbor state without thinking ahead about where to go next.
a) Needy local search
b) Heuristic local search
c) Greedy local search
d) Optimal local search

269

Draw a flowchart to find the average of four number?

2288

_______________ Is an algorithm, a loop that continually moves in the direction of increasing value – that is uphill
a) Up-Hill Search
b) Hill-Climbing
c) Hill algorithm
d) Reverse-Down-Hill search

124

Which functions are used as preferences over state history?
a) Award
b) Reward
c) Explicit
d) Implicit

140

he process of removing detail from a given state representation is called______.
a) Extraction
b) Abstraction
c) Information Retrieval
d) Mining of data

155

A* is optimal if h(n) is an admissible heuristic-that is, provided that h(n) never underestimates the cost to reach the goal.
a) True
b) False

113

Which were built in such a way that humans had to supply the inputs and
interpret the outputs?
a) Agents
b) AI system
c) Sensor
d) Actuators

149

Evaluate computationalism, as an account of the mind?

776

How many successors are generated in backtracking search?
a) 1
b) 2
c) 3
d) 4

168

A problem in a search space Is defined by,
a) Initial state
b) Goal test
c) Intermediate states
d) All of the above

84

Which are necessary for an agent to solve an online search problem?
a) Actions
b) Step-cost function
c) Goal-test
d) All of the mentioned