How to do that?
Constructing heap , right ?
add data where?
Guys, is everything ok?
Are you not able to store the response into json objects directly?
configuration is wrong in rest controller
{
n=n 1;
arr[n]=value;
int i=n;
while(i>0)
{
int parent=i/2;
if(arr[parent]>arr[i])
{
int temp=arr[i];
arr[i]=arr[parent];
arr[parent]=temp;
i=parent;
}
else {
return;
}
}
}
public static void main(String[] args) {
int[] arr= {70,60,50,55,21,45,33,45,12};
int n= arr.length;
n=n 1;
int insert=45;
maxHeap(arr,insert,n);
System.out.println(Arrays.toString(arr));
}
But not getting output…
I want to increase size of the array by one nd store one element in tht
How to do that???
Please Help 🙏🙏🙏
I want to increase size of the array by one nd store one element in tht
How to do that???
Please Help 🙏🙏🙏
You are using array itself is wrong.
{
int i=n;
while(i>0)
{
int parent=i/2;
if(arr1[parent]>arr1[i])
{
int temp=arr1[i];
arr1[i]=arr1[parent];
arr1[parent]=temp;
i=parent;
}
else {
return;
}
}
}
public static void main(String[] args) {
int[] arr= {70,60,50,55,21,43,33,41,12};
int n= arr.length;
int[] arr1=new int[n 1];
int insert=45;
for(int i=0;i<arr1.length;i )
{
if(i<arr1.length-1)
{
arr1[i]=arr[i];
}
else {
arr1[arr1.length-1]=insert;
}
}
maxHeap(arr1,insert,arr1.length);
System.out.println(Arrays.toString(arr1));
}

{
int i=n;
while(i>0)
{
int parent=i/2;
if(arr1[parent]>arr1[i])
{
int temp=arr1[i];
arr1[i]=arr1[parent];
arr1[parent]=temp;
i=parent;
}
else {
return;
}
}
}
public static void main(String[] args) {
int[] arr= {70,60,50,55,21,43,33,41,12};
int n= arr.length;
int[] arr1=new int[n 1];
int insert=45;
for(int i=0;i<arr1.length;i )
{
if(i<arr1.length-1)
{
arr1[i]=arr[i];
}
else {
arr1[arr1.length-1]=insert;
}
}
maxHeap(arr1,insert,arr1.length);
System.out.println(Arrays.toString(arr1));
}
Constructing heap , right ??
add data where? and, how are you doing it?
i am getting null return value from advice does not match primitive return type
Please rectify
public void executeListAutomatic(String id) throws Exception {
Optional<ListAutomatic> opListAutomatic = repository.findById(id);
if (opListAutomatic.isPresent()) {
ListAutomatic listAutomatic = opListAutomatic.get();
if (listService.countByNameAndId(listAutomatic.getName(), id) > 0) {
listService.removeListByName(listAutomatic.getName());
}
com.b2list.integrator.data.model.List list = new com.b2list.integrator.data.model.List();
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.add(Calendar.HOUR, 1);
list.setStartDate(new Date());
list.setExpiresIn(new CronExpression(listAutomatic.getFrequency()).getNextValidTimeAfter(calendar.getTime()));
list.setName(listAutomatic.getName());
list.setWarehouse(listAutomatic.getWarehouse());
list.setBanner(listAutomatic.getBanner());
if (listAutomatic.getToEveryBuyer()) {
persistForEveryBuyer(list, listAutomatic);
} else {
persistForFilteredBuyer(
list,
listAutomatic
);
}
}
}

I am calling an api from axios.its returning data like this.i want to copy these elements to another array without copying the index means my array should look like this [{name:”hsdh”},{name:”hdhd”}].how can I do that.
https://www.slf4j.org/api/org/slf4j/Logger.html
I don’t know axios; but, seems axios by default returns json. Are you not able to store the response into json objects directly?
Get the json and use map function
Ok thank you

