Hi all , please i have a question about the Iterative implementation of Binary Search
This is the function i create in c:
int BinarySearch(int arr[], int l, int r, int x)
{
while(l <= r) {
int mid = l + (r - l) / 2;
printf("%d\n", mid);
if(arr[mid] == x)
return mid;
if(arr[mid] > x)
r = mid - 1;
else
l = mid + 1;
}
return -1;
}
This is my main function :
int main()
{
int arr[] = {1,2,3,5,16,15,20};
int n = sizeof(arr) / sizeof(arr[0]);
int x = 16;
int result = BinarySearch(arr, 0, n-1, x);
(result == -1)
// WE CALL THIS ternary operator.
? printf("Element is not present in array")
: printf("Element is present at index %d", result);
return 0;
}
The question is: when i search 16 the function return -1.
If you see the number 16 is on the list any help please ??
Hi, I have a question,
How to add watchlist/wishlist item to MongoDB using nodejs and react js?
Please the link for details description:
https://stackoverflow.com/questions/71468023/how-to-add-watchlist-wishlist-item-to-mongodb-using-nodejs-and-react-js
Thanks a million for the help
Hi there!
I've built a simple boilerplate generator for Node.js, and Express projects.
Here is the GitHub link: https://github.com/gunvantsr/expressgen
Would love to hear any suggestions or feedback :)
Hi Guys, we are facing some issue here- https://stackoverflow.com/questions/74189623/how-to-integrate-mustache-template-to-read-json-data-and-dynamically-display-it
That's a blocker for our release. Can you anyone help with this?
Hi I am looking for jobs.
Main Skills:
π Blockchain, Crypto, Solidity, Smart contract (ERC20, ERC721), NFT, web3.js, ether.js, Dapp, DAO, Defi, NFT, NFT marketplace, Opensea
π React, React Hooks, React Context,
π Vue 3, Vue 2, Vuex
π Tailwind CSS, Material-UI, Bootstrap
π GraphQL, Apollo
π Node.js, Express.js, Hapi.js
π PHP, Wordpress, Laravel, Shopify, Yii, Symfony, Mangeto
π MongoDB, Mysql, PostgreSQL, DynamoDB, Google Apps
π AWS, DigitalOcean, Heroku
Hi I am looking for jobs.
Main Skills:
π Blockchain, Crypto, Solidity, Smart contract (ERC20, ERC721), NFT, web3.js, ether.js, Dapp, DAO, Defi, NFT, NFT marketplace, Opensea
π React, React Hooks, React Context,
π Tailwind CSS, Material-UI, Bootstrap
π GraphQL, Apollo
π Node.js, Express.js, Hapi.js
π PHP, Wordpress, Laravel, Shopify, Yii, Symfony, Mangeto
π MongoDB, Mysql, PostgreSQL, DynamoDB, Google Apps
π AWS, DigitalOcean, Heroku