To build an AI, we need searching algorithm right? The algorithm like DFS, BFS, hill climbing, etc.

So, I need your recommendation about what searching algorithm I should use?

If you guys want to make chatbot, what do you think about the best searching algorithm or the simplest searching algorithm for your chatbot?

And if you guys don't mind, would you guys to explain a little about how to implement the searching algorithm you use for your chatbot?

Or if you don't want to explain that, please just mention the name of the searching algorithm. It's okay :)

P.S: Just as you know, I have a database connected to my program.

Sorry for my bad english

Thanks! ]]>

I have 2d array LL2 extracted from 2-level DWT of an image and a binarized watermark W in a 2D array (only 0s and 255s). (watermark W is split into 4 equal parts as W1, W2, W3 n W4) And I want to embed the watermark according to the following method. But I cant seem to understand how to implement it.

"Embedding. The LL2 is split into blocks, and block size can be used as key K2, such as 4×4 blocks.

We selected a pair of coefficients block (i, j) and block (p, q) to embed watermark. Take the parameter

i, j, p,q as the key K3, K4, K5 and6. Here assign value i = j = 2 , p = q =3 .Watermark W1 was

embedded into LL2 as follows:

When the watermark information is 0, we judged whether block (2, 2) <block (3, 3),if not, exchange the

coefficient value; When the watermark information is 1, we judged whether block (2, 2) ≥block (3, 3),if

not, exchange the coefficient value. " ]]>

Code Java:

class BinaryTreeNode<T extends Comparable<T>>{
private BinaryTreeNode<T> leftNode;
private BinaryTreeNode<T> rightNode;
T data;
BinaryTreeNode(){
leftNode=null;
rightNode=null;
data=null;
}
BinaryTreeNode(T data){
leftNode=null;
rightNode=null;
this.data=data;
}
BinaryTreeNode<T> getLeftNode() {
return leftNode;
}
void setLeftNode(BinaryTreeNode<T> leftNode) {
this.leftNode = leftNode;
}
BinaryTreeNode<T> getRightNode() {
return rightNode;
}
void setRightNode(BinaryTreeNode<T> rightNode) {
this.rightNode = rightNode;
}
T getData() {
return data;
}
void setData(T data) {
this.data = data;
}
}
public class BinaryTree <T extends Comparable<T>> {
private BinaryTreeNode<T> root=null;
private int size;
public BinaryTree(){
size=0;
}
public int Size() {
return size;
}
public void insert(T data){
insert(data,root);
}
private void insert(T data,BinaryTreeNode<T> node){
if(node==null){
node=new BinaryTreeNode<T>(data);
System.out.println(data+" inserted");
size++;
}
else{
if(data.compareTo(node.getData())==1){
System.out.println("right node");
insert(data,node.getRightNode());
}
else{
System.out.println("left node");
insert(data,node.getLeftNode());
}
}
}
}

Code :

import java.util.Scanner;
public class Recursion {
public static void main(String[] args)
{
Scanner kb = new Scanner(System.in);
long n, result1, result2, startTime1, stopTime1, startTime2, stopTime2;
System.out.println("Please Enter A Number in between 0 and maxValue, will be calcualtred using 2 methods....");
n = kb.nextLong();
startTime1 = System.nanoTime();
result1 = fibRecursive(n);
stopTime1 = System.nanoTime();
startTime2 = System.nanoTime();
result2 = fibLoop(n);
stopTime2 = System.nanoTime();
System.out.println("\nDisplaying solution for recursive method "+ result1 + "Time Taken: " + (stopTime1 - startTime1));
System.out.println("\nDisplaying solution for loop method "+ result2 + "Time Taken: " + (stopTime2 - startTime2));
System.out.println("\nThanks for using our fibnoacci calculator. ");
}
public static long fibRecursive(long i)
{
if(i == 0)
return 0;
else if(i == 1)
return 1;
else
return fibRecursive(i - 1) + fibRecursive(i - 2);
}
public static long fibLoop(long k)
{
long a = 0, b = 1, ans = 0;
for(int i = 1; i < k; i++)
{
ans = a + b;
a = b;
b = ans;
}
return ans;
}
}

is there perhaps a built in function/feature in java to determine this number? In my case I am looking for the max value for "long n". Any help is great appreciated, thanks. ]]>